Skip to content

Commit

Permalink
Add ParentChildBeta example
Browse files Browse the repository at this point in the history
  • Loading branch information
colin4124 committed Sep 23, 2021
1 parent 94a0c68 commit 3292ae8
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/example/modules/Modules.scala
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ object Modules {
() => new Mux2,
() => new WhichFruit,
() => new ParentChild,
() => new ParentChildBeta,
() => new ChildChild,
() => new BlackBoxCase,
() => new BlackBoxAggCase,
Expand Down
29 changes: 29 additions & 0 deletions src/example/modules/ParentChildBeta.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package example

import knitkit._

class AddBeta extends RawModule {
val in0 = IO(Input(UInt(32.W)))
val in1 = IO(Input(UInt(32.W)))
val out = IO(Output(UInt(32.W)))
val out1 = IO(Output(UInt(32.W)))
out := in0 + in1
out1 := in0 + in1
}

class ParentChildBeta extends RawModule {
val in0 = IO(Input(UInt(4.W)))
val in1 = IO(Input(UInt(4.W)))
val out = IO(Output(UInt(32.W)))

val u_add = Module(new AddBeta)()

val foo = Wire(UInt(32.W))

val add10 = Cat(in0, 10.U)
u_add("in0") := add10
u_add("in1") := Cat(Seq(5.U, 1.U))

foo := u_add("out1")
out := u_add("out") + 9.U
}

0 comments on commit 3292ae8

Please sign in to comment.