Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
softusb: added access to Navre's PC via CSR
This is for debugging. Removed reading back the reset status via CSR,
since it seems not very useful and we don't have to decode the address
this way.
  • Loading branch information
wpwrak committed Mar 2, 2012
1 parent f1a0886 commit ff72330
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 7 deletions.
13 changes: 10 additions & 3 deletions cores/softusb/rtl/softusb.v
Expand Up @@ -76,8 +76,11 @@ softusb_timer timer(
.io_do(io_dr_timer)
);

wire [pmem_width-1:0] dbg_pc;

softusb_hostif #(
.csr_addr(csr_addr)
.csr_addr(csr_addr),
.pmem_width(pmem_width)
) hostif (
.sys_clk(sys_clk),
.sys_rst(sys_rst),
Expand All @@ -93,7 +96,9 @@ softusb_hostif #(
.irq(irq),

.io_we(io_we),
.io_a(io_a)
.io_a(io_a),

.dbg_pc(dbg_pc)
);

softusb_sie sie(
Expand Down Expand Up @@ -178,7 +183,9 @@ softusb_navre #(
.io_we(io_we),
.io_a(io_a),
.io_do(io_dw),
.io_di(io_dr_sie|io_dr_timer)
.io_di(io_dr_sie|io_dr_timer),

.dbg_pc(dbg_pc)
);

endmodule
9 changes: 6 additions & 3 deletions cores/softusb/rtl/softusb_hostif.v
Expand Up @@ -16,7 +16,8 @@
*/

module softusb_hostif #(
parameter csr_addr = 4'h0
parameter csr_addr = 4'h0,
parameter pmem_width = 12
) (
input sys_clk,
input sys_rst,
Expand All @@ -32,7 +33,9 @@ module softusb_hostif #(
output irq,

input io_we,
input [5:0] io_a
input [5:0] io_a,

input [pmem_width-1:0] dbg_pc
);

wire csr_selected = csr_a[13:10] == csr_addr;
Expand All @@ -48,7 +51,7 @@ always @(posedge sys_clk) begin
if(csr_selected) begin
if(csr_we)
usb_rst0 <= csr_di[0];
csr_do <= usb_rst0;
csr_do <= { dbg_pc, 1'b0 };
end
end
end
Expand Down
5 changes: 4 additions & 1 deletion cores/softusb/rtl/softusb_navre.v
Expand Up @@ -35,7 +35,9 @@ module softusb_navre #(
output reg io_we,
output [5:0] io_a,
output [7:0] io_do,
input [7:0] io_di
input [7:0] io_di,

output reg [pmem_width-1:0] dbg_pc
);

/* Register file */
Expand Down Expand Up @@ -195,6 +197,7 @@ always @(posedge clk) begin
PC_SEL_Z: PC <= pZ - 1;
endcase
end
dbg_pc <= PC;
end
reg pmem_selz;
assign pmem_a = rst ?
Expand Down

0 comments on commit ff72330

Please sign in to comment.