Line 99... |
Line 99... |
// And, finally, for a final flair --- offer to interrupt the CPU after
|
// And, finally, for a final flair --- offer to interrupt the CPU after
|
// our trigger has gone off. This line is equivalent to the scope
|
// our trigger has gone off. This line is equivalent to the scope
|
// being stopped. It is not maskable here.
|
// being stopped. It is not maskable here.
|
output wire o_interrupt;
|
output wire o_interrupt;
|
|
|
|
// For timing's sake, let's remove ourselves from the bus a touch
|
|
reg r_wb_stb, r_wb_addr, r_wb_we;
|
|
reg [31:0] r_wb_data;
|
|
always @(posedge i_clk)
|
|
begin
|
|
r_wb_stb <= i_wb_stb;
|
|
r_wb_we <= i_wb_we;
|
|
r_wb_addr<= i_wb_addr;
|
|
r_wb_data<= i_wb_data;
|
|
end
|
|
|
reg [(LGMEM-1):0] raddr;
|
reg [(LGMEM-1):0] raddr;
|
reg [(BUSW-1):0] mem[0:((1<<LGMEM)-1)];
|
reg [(BUSW-1):0] mem[0:((1<<LGMEM)-1)];
|
|
|
// Our status/config register
|
// Our status/config register
|
wire bw_reset_request, bw_manual_trigger,
|
wire bw_reset_request, bw_manual_trigger,
|
bw_disable_trigger, bw_reset_complete;
|
bw_disable_trigger, bw_reset_complete;
|
reg [22:0] br_config;
|
reg [22:0] br_config;
|
wire [19:0] bw_holdoff;
|
wire [19:0] bw_holdoff;
|
initial br_config = ((1<<(LGMEM-1))-4);
|
initial br_config = ((1<<(LGMEM-1))-4);
|
always @(posedge i_wb_clk)
|
always @(posedge i_wb_clk)
|
if ((i_wb_stb)&&(~i_wb_addr))
|
if ((r_wb_stb)&&(~r_wb_addr))
|
begin
|
begin
|
if (i_wb_we)
|
if (r_wb_we)
|
br_config <= { i_wb_data[31],
|
br_config <= { r_wb_data[31],
|
(i_wb_data[27]),
|
(r_wb_data[27]),
|
i_wb_data[26],
|
r_wb_data[26],
|
i_wb_data[19:0] };
|
r_wb_data[19:0] };
|
end else if (bw_reset_complete)
|
end else if (bw_reset_complete)
|
br_config[22] <= 1'b1;
|
br_config[22] <= 1'b1;
|
assign bw_reset_request = (~br_config[22]);
|
assign bw_reset_request = (~br_config[22]);
|
assign bw_manual_trigger = (br_config[21]);
|
assign bw_manual_trigger = (br_config[21]);
|
assign bw_disable_trigger = (br_config[20]);
|
assign bw_disable_trigger = (br_config[20]);
|
Line 271... |
Line 282... |
assign bw_triggered = r_oflags[1];
|
assign bw_triggered = r_oflags[1];
|
assign bw_primed = r_oflags[0];
|
assign bw_primed = r_oflags[0];
|
end endgenerate
|
end endgenerate
|
|
|
// Reads use the bus clock
|
// Reads use the bus clock
|
reg br_wb_ack, r_wb_ack; // takes one clock to read
|
reg br_wb_ack, r_wb_ack, s_wb_ack; // takes two clock to read
|
wire bw_cyc_stb, bus_read_fifo;
|
reg s_wb_addr, q_wb_addr;
|
assign bw_cyc_stb = (i_wb_stb);
|
reg bw_cyc_stb, bus_read_fifo, bus_write_fifo;
|
assign bus_read_fifo = (i_wb_stb)&&(i_wb_addr)&&(~i_wb_we);
|
always @(posedge i_clk)
|
|
bw_cyc_stb = (r_wb_stb);
|
|
always @(posedge i_clk)
|
|
bus_read_fifo <= (r_wb_stb)&&(r_wb_addr)&&(~r_wb_we);
|
|
always @(posedge i_clk)
|
|
bus_write_fifo <= (r_wb_stb)&&(r_wb_addr)&&(r_wb_we);
|
initial br_wb_ack = 1'b0;
|
initial br_wb_ack = 1'b0;
|
always @(posedge i_wb_clk)
|
always @(posedge i_wb_clk)
|
begin // CE depends upon 5 inputs, output on 7 (ignoring add&carries)
|
begin // CE depends upon 5 inputs, output on 7 (ignoring add&carries)
|
if ((bw_reset_request)
|
if ((bw_reset_request)||(bus_write_fifo))
|
||((bw_cyc_stb)&&(i_wb_addr)&&(i_wb_we)))
|
|
raddr <= 0;
|
raddr <= 0;
|
else if ((bus_read_fifo)&&(bw_stopped))
|
else if ((bus_read_fifo)&&(bw_stopped))
|
raddr <= raddr + {{(LGMEM-1){1'b0}},1'b1}; // Data read, when stopped
|
raddr <= raddr + {{(LGMEM-1){1'b0}},1'b1}; // Data read, when stopped
|
|
|
r_wb_ack <= i_wb_stb;
|
r_wb_ack <= r_wb_stb;
|
br_wb_ack <= r_wb_ack;
|
s_wb_ack <= r_wb_ack;
|
|
br_wb_ack <= s_wb_ack;
|
end
|
end
|
|
|
reg [(LGMEM-1):0] nxt_addr;
|
reg [(LGMEM-1):0] nxt_addr;
|
always @(posedge i_wb_clk) // 2 adds, then 5 inputs
|
always @(posedge i_wb_clk) // 2 adds, then 5 inputs
|
if (bus_read_fifo)
|
if (bus_read_fifo)
|
Line 301... |
Line 317... |
|
|
reg [31:0] nxt_mem;
|
reg [31:0] nxt_mem;
|
always @(posedge i_wb_clk)
|
always @(posedge i_wb_clk)
|
nxt_mem <= mem[nxt_addr];
|
nxt_mem <= mem[nxt_addr];
|
|
|
reg r_wb_addr;
|
|
always @(posedge i_clk)
|
always @(posedge i_clk)
|
r_wb_addr <= i_wb_addr;
|
s_wb_addr <= r_wb_addr;
|
|
always @(posedge i_clk)
|
|
q_wb_addr <= s_wb_addr;
|
|
|
wire [4:0] bw_lgmem;
|
wire [4:0] bw_lgmem;
|
assign bw_lgmem = LGMEM;
|
assign bw_lgmem = LGMEM;
|
always @(posedge i_wb_clk)
|
always @(posedge i_wb_clk)
|
if (~r_wb_addr) // Control register read
|
if (~q_wb_addr) // Control register read
|
o_wb_data <= { bw_reset_request,
|
o_wb_data <= { bw_reset_request,
|
bw_stopped,
|
bw_stopped,
|
bw_triggered,
|
bw_triggered,
|
bw_primed,
|
bw_primed,
|
bw_manual_trigger,
|
bw_manual_trigger,
|
Line 324... |
Line 341... |
o_wb_data <= i_data;
|
o_wb_data <= i_data;
|
else // if (i_wb_addr) // Read from FIFO memory
|
else // if (i_wb_addr) // Read from FIFO memory
|
o_wb_data <= nxt_mem; // mem[raddr+waddr];
|
o_wb_data <= nxt_mem; // mem[raddr+waddr];
|
|
|
assign o_wb_stall = 1'b0;
|
assign o_wb_stall = 1'b0;
|
assign o_wb_ack = (br_wb_ack);
|
assign o_wb_ack = (s_wb_ack);
|
|
|
reg br_level_interrupt;
|
reg br_level_interrupt;
|
initial br_level_interrupt = 1'b0;
|
initial br_level_interrupt = 1'b0;
|
assign o_interrupt = (bw_stopped)&&(~bw_disable_trigger)
|
assign o_interrupt = (bw_stopped)&&(~bw_disable_trigger)
|
&&(~br_level_interrupt);
|
&&(~br_level_interrupt);
|