Skip to content

Commit 55f024d

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

File tree

2 files changed

+44
-1
lines changed

2 files changed

+44
-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/aptos/TinyAdderTests.scala"],
148+
tags = ["manual"],
149+
deps = [],
150+
)
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
import chisel3._
2+
import chisel3.simulator.svsim._
3+
import java.io.File
4+
5+
import chisel3._
6+
import chisel3.experimental.BundleLiterals._
7+
import chisel3.simulator.scalatest.ChiselSim
8+
import org.scalatest.freespec.AnyFreeSpec
9+
import org.scalatest.matchers.must.Matchers
10+
11+
class TinyAdder extends Module {
12+
val io = IO(new Bundle {
13+
val a = Input(UInt(8.W))
14+
val b = Input(UInt(8.W))
15+
val out = Output(UInt(8.W))
16+
})
17+
io.out := io.a + io.b
18+
}
19+
20+
class TinyAdderTests extends AnyFreeSpec with Matchers with ChiselSim {
21+
"add" in {
22+
simulate(new TinyAdder()) { dut =>
23+
dut.reset.poke(true.B)
24+
dut.clock.step()
25+
dut.reset.poke(false.B)
26+
dut.clock.step()
27+
28+
dut.a.poke(30.U)
29+
dut.b.poke(12.U)
30+
dut.clock.step()
31+
dut.out.expect(42.U)
32+
}
33+
}
34+
}

0 commit comments

Comments
 (0)