fix halt rtl logic
This commit is contained in:
@@ -58,23 +58,28 @@ module cpu_top (
|
||||
assign result = result_src ? dsram_rdata_i : alu_result;
|
||||
|
||||
logic ebreak_latch;
|
||||
logic halted_latch;
|
||||
logic load_stall;
|
||||
logic load_stall_cycle;
|
||||
logic load_stall_ff;
|
||||
|
||||
assign load_stall_ff = (load_stall & ~load_stall_cycle);
|
||||
|
||||
assign stall_core = ebreak_latch | halted_o | ~en_i | load_stall_ff;
|
||||
assign stall_core = halted_latch | ebreak_latch | ~en_i | load_stall_ff;
|
||||
|
||||
always_ff @(posedge clk_i) begin
|
||||
if (rst_i) begin
|
||||
halted_o <= 1'b0;
|
||||
halted_latch <= 1'b0;
|
||||
load_stall_cycle <= 1'b0;
|
||||
end else if (ebreak_latch) halted_o <= 1'b1;
|
||||
else if (load_stall & ~load_stall_cycle) begin
|
||||
load_stall_cycle <= 1'b1;
|
||||
end else if (load_stall & load_stall_cycle) begin
|
||||
load_stall_cycle <= 1'b0;
|
||||
end else begin
|
||||
halted_o <= ebreak_latch & ~halted_latch;
|
||||
if (ebreak_latch) halted_latch <= 1'b1;
|
||||
if (load_stall & ~load_stall_cycle) begin
|
||||
load_stall_cycle <= 1'b1;
|
||||
end else if (load_stall & load_stall_cycle) begin
|
||||
load_stall_cycle <= 1'b0;
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user