Skip to content

Commit aa9196f

Browse files
Fixed initial condition for the start of the decoding cycle
1 parent 1af0816 commit aa9196f

File tree

2 files changed

+14
-16
lines changed

2 files changed

+14
-16
lines changed
-4.14 KB
Binary file not shown.

rtl/fisc_core/microcode.sv

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,10 @@ module Microcode(
3333

3434
task debug(bit[15:0] value);
3535
debug_en_reg <= 1;
36-
dbg1_reg = value[3:0];
37-
dbg2_reg = value[7:4];
38-
dbg3_reg = value[11:8];
39-
dbg4_reg = value[15:12];
36+
dbg1_reg <= value[3:0];
37+
dbg2_reg <= value[7:4];
38+
dbg3_reg <= value[11:8];
39+
dbg4_reg <= value[15:12];
4040
endtask
4141

4242
reg [`FUNC_WIDTH + `CTRL_WIDTH:0] microcode_ctrl_reg = 1;
@@ -59,8 +59,7 @@ module Microcode(
5959

6060
enum logic[2:0] {
6161
ST_WAITING,
62-
ST_DECODING_WAIT1,
63-
ST_DECODING_WAIT2,
62+
ST_DECODING_ROM_WAIT,
6463
ST_DECODING1,
6564
ST_DECODING2,
6665
ST_DONE
@@ -96,16 +95,16 @@ module Microcode(
9695
microcode_ctrl_reg = code_rom_q;
9796
microcode_state = microcode_eos ? ST_DONE : ST_DECODING2;
9897
code_ip <= seg_rom_q + 1'b1;
99-
debug(code_rom_q);
10098
end
10199
ST_DECODING2:
102100
begin
103101
microcode_ctrl_reg = code_rom_q;
104102
microcode_state = microcode_eos ? ST_DONE : microcode_state;
105103
code_ip <= code_ip + 1'b1;
106-
debug(code_rom_q);
107104
end
108105
endcase
106+
107+
debug(microcode_ctrl_reg);
109108
endtask
110109

111110
task microcode_finish;
@@ -128,16 +127,15 @@ module Microcode(
128127
end
129128
else
130129
begin
131-
if(sos && microcode_state == ST_WAITING)
132-
microcode_state = ST_DECODING_WAIT1;
133-
134130
case(microcode_state)
135131
ST_WAITING:
136-
microcode_idle(); /* Stay idle */
137-
ST_DECODING_WAIT1:
138-
microcode_state = ST_DECODING_WAIT2; /* Wait for microcode segment data to propagate out of the ROM */
139-
ST_DECODING_WAIT2:
140-
microcode_state = ST_DECODING1; /* Wait for microcode control data to propagate out of the ROM */
132+
begin
133+
microcode_idle(); /* Stay idle */
134+
if(sos)
135+
microcode_state = ST_DECODING_ROM_WAIT;
136+
end
137+
ST_DECODING_ROM_WAIT:
138+
microcode_state = ST_DECODING1; /* Wait for microcode segment and control data to propagate out of the ROM */
141139
ST_DECODING1, ST_DECODING2:
142140
microcode_decode(); /* Decode instruction */
143141
ST_DONE:

0 commit comments

Comments
 (0)