summaryrefslogtreecommitdiff
path: root/src/test/scala/cookbook/FSM.scala
diff options
context:
space:
mode:
authorJack Koenig2022-01-10 16:32:51 -0800
committerGitHub2022-01-10 16:32:51 -0800
commit2b48fd15a7711dcd44334fbbc538667a102a581a (patch)
tree4b4766347c3943d65c13e5de2d139b14821eec61 /src/test/scala/cookbook/FSM.scala
parent92e77a97af986629766ac9038f0ebc8ab9a48fa1 (diff)
parentbff8dc0738adafa1176f6959a33ad86f6373c558 (diff)
Merge pull request #2246 from chipsalliance/scalafmt
Add scalafmt configuration and apply it.
Diffstat (limited to 'src/test/scala/cookbook/FSM.scala')
-rw-r--r--src/test/scala/cookbook/FSM.scala19
1 files changed, 10 insertions, 9 deletions
diff --git a/src/test/scala/cookbook/FSM.scala b/src/test/scala/cookbook/FSM.scala
index 0c1173ec..66f3063f 100644
--- a/src/test/scala/cookbook/FSM.scala
+++ b/src/test/scala/cookbook/FSM.scala
@@ -26,21 +26,21 @@ class DetectTwoOnes extends Module {
io.out := (state === State.sTwo1s)
- switch (state) {
- is (State.sNone) {
- when (io.in) {
+ switch(state) {
+ is(State.sNone) {
+ when(io.in) {
state := State.sOne1
}
}
- is (State.sOne1) {
- when (io.in) {
+ is(State.sOne1) {
+ when(io.in) {
state := State.sTwo1s
- } .otherwise {
+ }.otherwise {
state := State.sNone
}
}
- is (State.sTwo1s) {
- when (!io.in) {
+ is(State.sTwo1s) {
+ when(!io.in) {
state := State.sNone
}
}
@@ -53,7 +53,8 @@ class DetectTwoOnesTester extends CookbookTester(10) {
// Inputs and expected results
val inputs: Vec[Bool] = VecInit(false.B, true.B, false.B, true.B, true.B, true.B, false.B, true.B, true.B, false.B)
- val expected: Vec[Bool] = VecInit(false.B, false.B, false.B, false.B, false.B, true.B, true.B, false.B, false.B, true.B)
+ val expected: Vec[Bool] =
+ VecInit(false.B, false.B, false.B, false.B, false.B, true.B, true.B, false.B, false.B, true.B)
dut.io.in := inputs(cycle)
assert(dut.io.out === expected(cycle))