Line 1864... |
Line 1864... |
`ifdef DEBUG_SCOPE
|
`ifdef DEBUG_SCOPE
|
// CLRPIP: If clear_pipeline, produce address ... can be 28 bits
|
// CLRPIP: If clear_pipeline, produce address ... can be 28 bits
|
// DATWR: If write value, produce 4-bits of register ID, 27 bits of value
|
// DATWR: If write value, produce 4-bits of register ID, 27 bits of value
|
// STALL: If neither, produce pipeline stall information
|
// STALL: If neither, produce pipeline stall information
|
// ADDR: If bus is valid, no ack, return the bus address
|
// ADDR: If bus is valid, no ack, return the bus address
|
|
wire this_write;
|
|
assign this_write = ((mem_valid)||((~clear_pipeline)&&(~alu_illegal)
|
|
&&(((alu_wr)&&(alu_valid))
|
|
||(div_valid)||(fpu_valid))));
|
|
reg last_write;
|
|
always @(posedge i_clk)
|
|
last_write <= this_write;
|
|
|
|
reg [4:0] last_wreg;
|
|
always @(posedge i_clk)
|
|
last_wreg <= wr_reg_id;
|
|
|
|
reg halt_primed;
|
|
initial halt_primed = 0;
|
|
always @(posedge i_clk)
|
|
if (master_ce)
|
|
halt_primed <= 1'b1;
|
|
else if (debug_trigger)
|
|
halt_primed <= 1'b0;
|
|
|
|
reg [6:0] halt_count;
|
|
initial halt_count = 0;
|
|
always @(posedge i_clk)
|
|
if ((i_rst)||(!i_halt)||(r_halted)||(!halt_primed))
|
|
halt_count <= 0;
|
|
else if (!(&halt_count))
|
|
halt_count <= halt_count + 1'b1;
|
|
|
|
reg [9:0] mem_counter;
|
|
initial mem_counter = 0;
|
|
always @(posedge i_clk)
|
|
if ((i_rst)||(!halt_primed)||(!mem_busy))
|
|
mem_counter <= 0;
|
|
else if (!(&mem_counter))
|
|
mem_counter <= mem_counter + 1'b1;
|
|
|
|
reg [15:0] long_trigger;
|
|
always @(posedge i_clk)
|
|
long_trigger[15:1] <= long_trigger[14:0];
|
|
always @(posedge i_clk)
|
|
long_trigger[0] <= ((last_write)&&(last_wreg == wr_reg_id))
|
|
||(&halt_count)||(&mem_counter);
|
|
|
reg debug_trigger;
|
reg debug_trigger;
|
initial debug_trigger = 1'b0;
|
initial debug_trigger = 1'b0;
|
always @(posedge i_clk)
|
always @(posedge i_clk)
|
debug_trigger <= (!i_halt)&&(o_break);
|
debug_trigger <= (!i_halt)&&(o_break)||(long_trigger == 16'hffff);
|
|
|
wire [31:0] debug_flags;
|
wire [31:0] debug_flags;
|
assign debug_flags = { debug_trigger, 3'b101,
|
assign debug_flags = { debug_trigger, 3'b101,
|
master_ce, i_halt, o_break, sleep,
|
master_ce, i_halt, o_break, sleep,
|
gie, ibus_err_flag, trap, ill_err_i,
|
gie, ibus_err_flag, trap, ill_err_i,
|
Line 1879... |
Line 1922... |
dcdvalid, dcd_stalled, op_ce, opvalid,
|
dcdvalid, dcd_stalled, op_ce, opvalid,
|
op_pipe, alu_ce, alu_busy, alu_wr,
|
op_pipe, alu_ce, alu_busy, alu_wr,
|
alu_illegal, alF_wr, mem_ce, mem_we,
|
alu_illegal, alF_wr, mem_ce, mem_we,
|
mem_busy, mem_pipe_stalled, (new_pc), (dcd_early_branch) };
|
mem_busy, mem_pipe_stalled, (new_pc), (dcd_early_branch) };
|
|
|
|
wire [25:0] bus_debug;
|
|
assign bus_debug = { debug_trigger,
|
|
mem_ce, mem_we, mem_busy, mem_pipe_stalled,
|
|
o_wb_gbl_cyc, o_wb_gbl_stb, o_wb_lcl_cyc, o_wb_lcl_stb,
|
|
o_wb_we, i_wb_ack, i_wb_stall, i_wb_err,
|
|
pf_cyc, pf_stb, pf_ack, pf_stall,
|
|
pf_err,
|
|
mem_cyc_gbl, mem_stb_gbl, mem_cyc_lcl, mem_stb_lcl,
|
|
mem_we, mem_ack, mem_stall, mem_err
|
|
};
|
|
|
always @(posedge i_clk)
|
always @(posedge i_clk)
|
begin
|
begin
|
if ((i_halt)||(!master_ce)||(debug_trigger)||(o_break))
|
if ((i_halt)||(!master_ce)||(debug_trigger)||(o_break))
|
o_debug <= debug_flags;
|
o_debug <= debug_flags;
|
else if ((mem_valid)||((~clear_pipeline)&&(~alu_illegal)
|
else if ((mem_valid)||((~clear_pipeline)&&(~alu_illegal)
|
Line 1894... |
Line 1948... |
else if ((o_wb_gbl_stb)|(o_wb_lcl_stb))
|
else if ((o_wb_gbl_stb)|(o_wb_lcl_stb))
|
o_debug <= {debug_trigger, 2'b11, o_wb_gbl_stb, o_wb_we,
|
o_debug <= {debug_trigger, 2'b11, o_wb_gbl_stb, o_wb_we,
|
(o_wb_we)?o_wb_data[26:0] : o_wb_addr[26:0] };
|
(o_wb_we)?o_wb_data[26:0] : o_wb_addr[26:0] };
|
else
|
else
|
o_debug <= debug_flags;
|
o_debug <= debug_flags;
|
|
// o_debug[25:0] <= bus_debug;
|
end
|
end
|
`endif
|
`endif
|
|
|
endmodule
|
endmodule
|
|
|
No newline at end of file
|
No newline at end of file
|