@@ -13,7 +13,7 @@ class MainSpec extends AnyFreeSpec with Matchers with ChiselSim {
1313// "Main should execute LUI correctly" in {
1414// simulate(new Main()) { dut =>
1515// val bytes = Files.readAllBytes(Paths.get("./programs/fib-loop.bin"))
16-
16+
1717// val instructions = bytes.grouped(4).map { instrBytes =>
1818// val paddedBytes = instrBytes.padTo(4, 0.toByte)
1919// val signedInt = ByteBuffer.wrap(paddedBytes).order(java.nio.ByteOrder.BIG_ENDIAN).getInt()
@@ -44,21 +44,24 @@ class MainSpec extends AnyFreeSpec with Matchers with ChiselSim {
4444 dut.io.debug_write.poke(true .B )
4545
4646 dut.io.debug_write_address.poke(0 .U )
47- dut.io.debug_write_data.poke(0b00000000000000000100_00010_0110111L .U ) // LUI
47+ dut.io.debug_write_data.poke(0x00004137 .U )
4848 dut.clock.step(1 )
4949
5050 dut.io.debug_write_address.poke(1 .U )
51- dut.io.debug_write_data.poke(0b000000001000_00001_000_00001_0010011L .U ) // ADDI
51+ dut.io.debug_write_data.poke(0x00408093 .U )
5252 dut.clock.step(1 )
5353
5454 dut.io.debug_write_address.poke(2 .U )
55- dut.io.debug_write_data.poke(0b000000000000_00010_010_00000_0100011L .U ) // SW
55+ dut.io.debug_write_data.poke(0x00110113 .U )
5656 dut.clock.step(1 )
5757
5858 dut.io.debug_write_address.poke(3 .U )
59- dut.io.debug_write_data.poke(0b11111111100111111111_00000_1101111L .U ) // JAL
59+ dut.io.debug_write_data.poke(0x00008023 .U )
60+ dut.clock.step(1 )
61+
62+ dut.io.debug_write_address.poke(4 .U )
63+ dut.io.debug_write_data.poke(0xff1ff06f .U )
6064 dut.clock.step(1 )
61-
6265
6366 // dut.io.debug_write_address.poke(0.U)
6467 // dut.io.debug_write_data.poke(0b000000000111_00000_000_00001_0010011.U) // ADDI
@@ -71,12 +74,12 @@ class MainSpec extends AnyFreeSpec with Matchers with ChiselSim {
7174 // dut.io.debug_write_address.poke(2.U)
7275 // dut.io.debug_write_data.poke(0b000000000000_00000_010_00010_0000011.U) // LW
7376 // dut.clock.step(1)
74-
77+
7578 dut.io.debug_write.poke(false .B )
7679 dut.clock.step(1 )
7780
7881 dut.io.execute.poke(true .B )
7982 dut.clock.step(24 )
8083 }
81- }
82- }
84+ }
85+ }
0 commit comments