Skip to content

Commit

Permalink
Merge pull request #39 from wpmed92/fix-csr
Browse files Browse the repository at this point in the history
Count cycle on every tick
  • Loading branch information
wpmed92 authored Jan 2, 2023
2 parents 72e7cdd + b429d2e commit 38d7bfd
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion chip/rtl/csr_rf.v
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@ module csr_rf(
reg [31:0] _csr_val;

always @(posedge clk) begin
cycle_counter <= cycle_counter + 1;

if (state == `REG_FILE_READ) begin
cycle_counter <= cycle_counter + 1;

if (en_csr) begin
case (csr_adr)
Expand Down
2 changes: 1 addition & 1 deletion test/csr.regs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
r0=0
r1=2
r2=24
r2=121
r3=0
r4=0
r5=0
Expand Down

0 comments on commit 38d7bfd

Please sign in to comment.