diff options
| author | Jim Lawson | 2016-07-20 14:49:35 -0700 |
|---|---|---|
| committer | Jim Lawson | 2016-07-20 14:49:35 -0700 |
| commit | 2dce378deda1cc33833eb378c89a1c5415817bae (patch) | |
| tree | e3bc5361030d63e017d065491e9e7e4cf788fe3c /src/test/scala/chiselTests/Stack.scala | |
| parent | 28e80311f172ae4d1d477e8bb47ca3719c9a8fc5 (diff) | |
Distinguish between ?Int.Lit and ?Int.width
Diffstat (limited to 'src/test/scala/chiselTests/Stack.scala')
| -rw-r--r-- | src/test/scala/chiselTests/Stack.scala | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/test/scala/chiselTests/Stack.scala b/src/test/scala/chiselTests/Stack.scala index 683c5224..440228c9 100644 --- a/src/test/scala/chiselTests/Stack.scala +++ b/src/test/scala/chiselTests/Stack.scala @@ -12,8 +12,8 @@ class ChiselStack(val depth: Int) extends Module { val push = Input(Bool()) val pop = Input(Bool()) val en = Input(Bool()) - val dataIn = Input(UInt(32)) - val dataOut = Output(UInt(32)) + val dataIn = Input(UInt.width(32)) + val dataOut = Output(UInt.width(32)) }) val stack_mem = Mem(depth, UInt(width = 32)) @@ -21,14 +21,14 @@ class ChiselStack(val depth: Int) extends Module { val out = Reg(init = UInt(0, width = 32)) when (io.en) { - when(io.push && (sp < UInt(depth))) { + when(io.push && (sp < UInt.Lit(depth))) { stack_mem(sp) := io.dataIn - sp := sp +% UInt(1) - } .elsewhen(io.pop && (sp > UInt(0))) { - sp := sp -% UInt(1) + sp := sp +% UInt.Lit(1) + } .elsewhen(io.pop && (sp > UInt.Lit(0))) { + sp := sp -% UInt.Lit(1) } - when (sp > UInt(0)) { - out := stack_mem(sp -% UInt(1)) + when (sp > UInt.Lit(0)) { + out := stack_mem(sp -% UInt.Lit(1)) } } io.dataOut := out |
