diff options
| author | Jack Koenig | 2021-10-28 10:33:55 -0700 |
|---|---|---|
| committer | GitHub | 2021-10-28 17:33:55 +0000 |
| commit | 84da5fdb528bbedc9a32c3e075bb3865994cd4aa (patch) | |
| tree | fc28aefd6a4bc68c3a0e5faaa8a088cc9b70cea0 /docs/src | |
| parent | ef8a9c2148f01e058d2986c9d64f0c35f640790c (diff) | |
[docs] Improve tieoff Bundle to 0 (#2218)
Previously, the example had an extra wrapping module that led
to the interesting example getting optimized away.
Diffstat (limited to 'docs/src')
| -rw-r--r-- | docs/src/cookbooks/cookbook.md | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/docs/src/cookbooks/cookbook.md b/docs/src/cookbooks/cookbook.md index ce49b668..4b2b088e 100644 --- a/docs/src/cookbooks/cookbook.md +++ b/docs/src/cookbooks/cookbook.md @@ -88,13 +88,14 @@ you are tying off, you can use `chiselTypeOf`: ```scala mdoc:silent:reset import chisel3._ +import chisel3.stage.ChiselStage class MyBundle extends Bundle { val foo = UInt(4.W) val bar = Vec(4, UInt(1.W)) } -class Foo(typ: Data) extends RawModule { +class Foo(typ: MyBundle) extends RawModule { val bundleA = IO(Output(typ)) val bundleB = IO(Output(typ)) @@ -107,9 +108,7 @@ class Foo(typ: Data) extends RawModule { bundleB := 0.U.asTypeOf(chiselTypeOf(bundleB)) } -class Bar extends RawModule { - val foo = Module(new Foo(new MyBundle())) -} +ChiselStage.emitVerilog(new Foo(new MyBundle)) ``` ### How do I create a Vec of Bools from a UInt? |
