diff options
| author | Jack Koenig | 2019-01-02 17:37:18 -0800 |
|---|---|---|
| committer | Jack Koenig | 2019-01-02 17:37:18 -0800 |
| commit | 8bc25bbc0ff998565afd153a44bf8f11316ba0f0 (patch) | |
| tree | 0465949193ce089197f88640968fda02408e05c5 /src/test | |
| parent | 4253791132c5c550e1bc4a8070cb54e558f17809 (diff) | |
Make GroupComponents run ResolveKinds
This fixes an issue where expressions created by GroupComponents would
be improperly lowered because they were not marked as references to
instance ports.
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/scala/firrtlTests/transforms/GroupComponentsSpec.scala | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/src/test/scala/firrtlTests/transforms/GroupComponentsSpec.scala b/src/test/scala/firrtlTests/transforms/GroupComponentsSpec.scala index 3a32ec71..f51d44ae 100644 --- a/src/test/scala/firrtlTests/transforms/GroupComponentsSpec.scala +++ b/src/test/scala/firrtlTests/transforms/GroupComponentsSpec.scala @@ -3,6 +3,10 @@ package transforms import firrtl.annotations.{CircuitName, ComponentName, ModuleName} import firrtl.transforms.{GroupAnnotation, GroupComponents} +import firrtl._ +import firrtl.ir._ + +import FirrtlCheckers._ class GroupComponentsSpec extends LowTransformSpec { def transform = new GroupComponents() @@ -288,3 +292,35 @@ class GroupComponentsSpec extends LowTransformSpec { execute(input, check, groups) } } + +class GroupComponentsIntegrationSpec extends FirrtlFlatSpec { + def topComp(name: String): ComponentName = ComponentName(name, ModuleName("Top", CircuitName("Top"))) + "Grouping" should "properly set kinds" in { + val input = + """circuit Top : + | module Top : + | input clk: Clock + | input data: UInt<16> + | output out: UInt<16> + | reg r: UInt<16>, clk + | r <= data + | out <= r + """.stripMargin + val groups = Seq( + GroupAnnotation(Seq(topComp("r")), "MyModule", "inst", Some("_OUT"), Some("_IN")) + ) + val result = (new VerilogCompiler).compileAndEmit( + CircuitState(parse(input), ChirrtlForm, groups), + Seq(new GroupComponents) + ) + result should containTree { + case Connect(_, WSubField(WRef("inst",_, InstanceKind,_), "data_IN", _,_), WRef("data",_,_,_)) => true + } + result should containTree { + case Connect(_, WSubField(WRef("inst",_, InstanceKind,_), "clk_IN", _,_), WRef("clk",_,_,_)) => true + } + result should containTree { + case Connect(_, WRef("out",_,_,_), WSubField(WRef("inst",_, InstanceKind,_), "r_OUT", _,_)) => true + } + } +} |
