Skip to content

Commit 5894443

Browse files
committed
test/orfs/mock-array: verilator config test, disabled by default
Signed-off-by: Øyvind Harboe <[email protected]>
1 parent caaf65a commit 5894443

File tree

2 files changed

+43
-1
lines changed

2 files changed

+43
-1
lines changed

test/orfs/mock-array/BUILD

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
load("@bazel-orfs//:openroad.bzl", "orfs_run")
2-
load("@bazel-orfs//toolchains/scala:chisel.bzl", "chisel_binary")
2+
load("@bazel-orfs//toolchains/scala:chisel.bzl", "chisel_binary", "chisel_test")
33
load("//test/orfs/asap7:asap7.bzl", "ASAP7_REMOVE_CELLS")
44
load(":mock-array.bzl", "config", "element", "mock_array", "verilog")
55

@@ -139,3 +139,12 @@ orfs_run(
139139
"Element_4x4",
140140
]
141141
]
142+
143+
# Used to validate Verilator dependency; verilator is used for
144+
# simulation of MockArray.
145+
chisel_test(
146+
name = "TinyAdder_test",
147+
srcs = ["src/test/scala/TinyAdderTest.scala"],
148+
tags = ["manual"],
149+
deps = [],
150+
)
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import chisel3._
2+
import java.io.File
3+
4+
import chisel3._
5+
import chisel3.experimental.BundleLiterals._
6+
import chisel3.simulator.scalatest.ChiselSim
7+
import org.scalatest.freespec.AnyFreeSpec
8+
import org.scalatest.matchers.must.Matchers
9+
10+
class TinyAdder extends Module {
11+
val io = IO(new Bundle {
12+
val a = Input(UInt(8.W))
13+
val b = Input(UInt(8.W))
14+
val out = Output(UInt(8.W))
15+
})
16+
io.out := io.a + io.b
17+
}
18+
19+
class TinyAdderTests extends AnyFreeSpec with Matchers with ChiselSim {
20+
"add" in {
21+
simulate(new TinyAdder()) { dut =>
22+
dut.reset.poke(true.B)
23+
dut.clock.step()
24+
dut.reset.poke(false.B)
25+
dut.clock.step()
26+
27+
dut.io.a.poke(30.U)
28+
dut.io.b.poke(12.U)
29+
dut.clock.step()
30+
dut.io.out.expect(42.U)
31+
}
32+
}
33+
}

0 commit comments

Comments
 (0)