From dc115285674a3fe9a665f8f581d6e163e725657b Mon Sep 17 00:00:00 2001 From: Yehowshua Immanuel Date: Mon, 25 Sep 2023 20:21:23 -0400 Subject: [PATCH] sim now working --- src/Top.bsv | 35 ++++++++++++++++++----------------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/src/Top.bsv b/src/Top.bsv index 9ff6cd3..a7faa70 100644 --- a/src/Top.bsv +++ b/src/Top.bsv @@ -55,22 +55,23 @@ module mkTop(ITop); endmethod endmodule -// module mkSim(Empty); -// (actionvalue -// Reg#(UInt#(3)) count(); -// mkReg#(0) the_count(count); -// addRules(rules -// rule count (True); -// count <= unpack({1'b1, (pack(count))[2:1]}); -// ($display)(count); -// endrule: count -// rule end_sim (count == 6); -// ($finish)(); -// endrule: end_sim -// endrules); -// return(interface Empty -// endinterface: Empty); -// endactionvalue); -// endmodule: mkSim +module mkSim(Empty); + + // Define a 3-bit register named count + Reg#(UInt#(3)) count <- mkReg(0); + + // Rule to update and display the count + rule tick (True); + count <= unpack({1'b1, (pack(count))[2:1]}); + ($display)(count); + endrule + + // Rule to finish the simulation when count reaches 6 + rule end_sim (count == 6); + ($finish)(); + endrule + +endmodule + endpackage \ No newline at end of file