summaryrefslogtreecommitdiff
path: root/src/test/scala/examples
diff options
context:
space:
mode:
authorJack Koenig2019-08-13 15:06:58 +0530
committerGitHub2019-08-13 15:06:58 +0530
commit24dddea6dccea5a570cece78324a5db624c7303a (patch)
treeb03fa616d0b8796548604a3d2b564fd17cf4e2d8 /src/test/scala/examples
parentfddb5943b1d36925a5435d327c3312572e98ca58 (diff)
Add support for asynchronous reset (#1011)
Adds new AsyncReset and "abstract" Reset types. Reset is inferred in FIRRTL to be either AsyncReset or Bool. The "reset type" of a register is set by the type of its reset signal: val asyncReset: AsyncReset = IO(Input(AsyncReset())) val syncReset: Bool = IO(Input(Bool())) val abstractReset: Reset = IO(Input(Reset())) val asyncReg = withReset(asyncReset) { RegInit(0.U) } val syncReg = withReset(syncReset) { RegInit(0.U) } val inferredReg = withReset(abstractReset) { RegInit(0.U) } AsyncReset can be cast to and from Bool. Whereas synchronous reset is equivalent to a mux in front of a flip-flop and thus can be driven by logic, asynchronous reset requires that the reset value is a constant. This is checked in FIRRTL. Inference of the concrete type of a Reset occurs based on the type the Reset's drivers. This inference is very simple, it is simple forward propagation of the type, but it allows for writing blocks and modules that are agnostic to the reset type. In particular, the implicit `reset` value in MultiIOModule and thus Module is now concretely an instance of Reset and thus will be inferred in FIRRTL.
Diffstat (limited to 'src/test/scala/examples')
-rw-r--r--src/test/scala/examples/SimpleVendingMachine.scala2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/test/scala/examples/SimpleVendingMachine.scala b/src/test/scala/examples/SimpleVendingMachine.scala
index 4bb6027a..2021ece8 100644
--- a/src/test/scala/examples/SimpleVendingMachine.scala
+++ b/src/test/scala/examples/SimpleVendingMachine.scala
@@ -52,7 +52,7 @@ class VerilogVendingMachine extends BlackBox {
// Because this is a blackbox, we must explicity add clock and reset
val io = IO(new SimpleVendingMachineIO {
val clock = Input(Clock())
- val reset = Input(Bool())
+ val reset = Input(Reset())
})
}