diff options
| author | Richard Lin | 2016-11-21 13:44:26 -0800 |
|---|---|---|
| committer | GitHub | 2016-11-21 13:44:26 -0800 |
| commit | 3b4755716a74d4711efa3ce6799742479e17e80b (patch) | |
| tree | 56652eaa478d5dfd8cddfbe2795c0123d39d230d /src/test/scala/chiselTests/Stack.scala | |
| parent | cd6eb41275381a4399a8a88c886110d276bb805c (diff) | |
| parent | 81e5d00d18a5ba9ae33c10219a270148002fc672 (diff) | |
Merge pull request #372 from ucb-bar/onetrueliteral
Standardize the One True Way of specifying literals
Diffstat (limited to 'src/test/scala/chiselTests/Stack.scala')
| -rw-r--r-- | src/test/scala/chiselTests/Stack.scala | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/src/test/scala/chiselTests/Stack.scala b/src/test/scala/chiselTests/Stack.scala index a72af928..58a05937 100644 --- a/src/test/scala/chiselTests/Stack.scala +++ b/src/test/scala/chiselTests/Stack.scala @@ -12,23 +12,23 @@ class ChiselStack(val depth: Int) extends Module { val push = Input(Bool()) val pop = Input(Bool()) val en = Input(Bool()) - val dataIn = Input(UInt.width(32)) - val dataOut = Output(UInt.width(32)) + val dataIn = Input(UInt(32.W)) + val dataOut = Output(UInt(32.W)) }) - val stack_mem = Mem(depth, UInt.width(32)) - val sp = Reg(init = UInt(0, width = log2Up(depth + 1))) - val out = Reg(init = UInt(0, width = 32)) + val stack_mem = Mem(depth, UInt(32.W)) + val sp = Reg(init = 0.U(log2Up(depth+1).W)) + val out = Reg(init = 0.U(32.W)) when (io.en) { - when(io.push && (sp < UInt(depth))) { + when(io.push && (sp < depth.asUInt)) { stack_mem(sp) := io.dataIn - sp := sp +% UInt(1) - } .elsewhen(io.pop && (sp > UInt(0))) { - sp := sp -% UInt(1) + sp := sp +% 1.U + } .elsewhen(io.pop && (sp > 0.U)) { + sp := sp -% 1.U } - when (sp > UInt(0)) { - out := stack_mem(sp -% UInt(1)) + when (sp > 0.U) { + out := stack_mem(sp -% 1.U) } } io.dataOut := out |
