blob: f512bf26be5001e0e3bcd062580b6b3acdaead40 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
// See LICENSE for license details.
package chisel3.core
import scala.language.experimental.macros
import scala.reflect.macros.blackbox.Context
trait CompileOptions {
// Should Record connections require a strict match of fields.
// If true and the same fields aren't present in both source and sink, a MissingFieldException,
// MissingLeftFieldException, or MissingRightFieldException will be thrown.
val connectFieldsMustMatch: Boolean
// When creating an object that takes a type argument, the argument must be unbound (a pure type).
val declaredTypeMustBeUnbound: Boolean
// Module IOs should be wrapped in an IO() to define their bindings before the reset of the module is defined.
val requireIOWrap: Boolean
// If a connection operator fails, don't try the connection with the operands (source and sink) reversed.
val dontTryConnectionsSwapped: Boolean
// If connection directionality is not explicit, do not use heuristics to attempt to determine it.
val dontAssumeDirectionality: Boolean
// Issue a deprecation warning if Data.{flip, asInput,asOutput} is used
// instead of Flipped, Input, or Output.
val deprecateOldDirectionMethods: Boolean
// Check that referenced Data have actually been declared.
val checkSynthesizable: Boolean
}
object CompileOptions {
// Provides a low priority Strict default. Can be overridden by importing the NotStrict option.
// Implemented as a macro to prevent this from being used inside chisel core.
implicit def materialize: CompileOptions = macro materialize_impl
def materialize_impl(c: Context): c.Tree = {
import c.universe._
q"_root_.chisel3.core.ExplicitCompileOptions.Strict"
}
}
object ExplicitCompileOptions {
// Collection of "not strict" connection compile options.
// These provide compatibility with existing code.
// import chisel3.core.ExplicitCompileOptions.NotStrict
implicit object NotStrict extends CompileOptions {
val connectFieldsMustMatch = false
val declaredTypeMustBeUnbound = false
val requireIOWrap = false
val dontTryConnectionsSwapped = false
val dontAssumeDirectionality = false
val deprecateOldDirectionMethods = false
val checkSynthesizable = false
}
// Collection of "strict" connection compile options, preferred for new code.
// import chisel3.core.ExplicitCompileOptions.Strict
implicit object Strict extends CompileOptions {
val connectFieldsMustMatch = true
val declaredTypeMustBeUnbound = true
val requireIOWrap = true
val dontTryConnectionsSwapped = true
val dontAssumeDirectionality = true
val deprecateOldDirectionMethods = true
val checkSynthesizable = true
}
}
|