Replies: 5 comments 4 replies
-
Attach is the RTL code of pipeline_exmem design, which have finished simulation and fixed syntax error. `default_nettype wire
module exmem_pipeline #(
parameter N = 10
)(
input clk,
input rst, // active high (from WB)
input stb, // command strobe -request
input we, // 1: write, 0: read
input [3:0] sel, // byte-enable
input [31:0] dat_i, // data in
input [31:0] addr, // address in
output ack, // ready
output [31:0] dat_o // data out
);
// FIFO for shifting WB request
reg [67:0] req_fifo[N-1:0];
reg [N-1:0] we_fifo;
reg [N-1:0] valid_fifo;
reg ack;
// Wishbone INPUT request
wire [67:0] req_in;
// BRAM byte enable
wire [3:0] byte_en;
`define SEL_POS 3:0
`define DAT_POS 35:4
`define ADR_POS 67:36
`define N 10
// Initalize FIFO, and perform Shift FIFO
always @(posedge clk or posedge rst) begin
if (rst) begin
valid_fifo <= `N'b0;
we_fifo <= `N'b0;
end
else begin
valid_fifo <= {stb, valid_fifo[N-1:1]};
we_fifo <= {we, we_fifo[N-1:1]};
end
end
assign req_in = {addr, dat_i, sel};
// Put Wishbone input request into FIFO
always @(posedge clk) begin
req_fifo[N-1] <= req_in;
end
// Shift the FIFO
integer i;
// Unroll to N-2, since the FIFO[N-1] has been assign to input request
always @(posedge clk) begin
for (i = 0; i < N-2; i = i + 1) begin
req_fifo[i] <= req_fifo[i + 1];
end
end
// ACK signal is generated 1T after valid_fifo[0] = 1,
// because BRAM read access takes 1T module bram
always @(posedge clk or posedge rst) begin
if (rst) begin
ack <= 0;
end
else begin
ack <= valid_fifo[0];
end
end
assign byte_en = req_fifo[0][`SEL_POS] & {4{we_fifo[0]}};
bram user_bram (
.CLK (clk),
.WE0 (byte_en),
.EN0 (valid_fifo[0]),
.Di0 (req_fifo[0][`DAT_POS]),
.Do0 (dat_o),
.A0 (req_fifo[0][`ADR_POS])
);
endmodule |
Beta Was this translation helpful? Give feedback.
-
The dataset for matmul, qsort, and fir are initialized and preloaded into user memory. It needs to change the linker commands script. Those who have made it work, please share it for others to reference. |
Beta Was this translation helpful? Give feedback.
-
Encourage two teams collaboratively work on final project.
|
Beta Was this translation helpful? Give feedback.
-
Debugging Procedure for data moved to user memory.
Good luck and share your findings. |
Beta Was this translation helpful? Give feedback.
-
@long385552 you may need to check if the data is copied from spiflash and written to user memory in start-up code. |
Beta Was this translation helpful? Give feedback.
-
We will use this thread of discussion for final project issues
Refer to the attached, I have put few notes about final project.
final-project-note.pptx
In order not to have memory data access become a bottleneck, pipeline memory is needed. I have draft a exmem_pipeline specification to replace Lab4-1 exmem design. A sample design strucure is attachd here (Note: I simply write the code for the purpose to express the design structure, there is no syntax check nor simulation verification.
https://github.com/bol-edu/caravel-soc_fpga-lab/blob/main/lab-wlos_baseline/exmem_pipeline.v
Beta Was this translation helpful? Give feedback.
All reactions