-
Chiplab LSU
Chiplab的lsu要简单些,因为用的是memory interface,不需要处理dcache,也不需要通过AXI控制内存,因为这些都包装在别的模块。 module lsu_s1( input clk, input resetn, input valid, input [`LSOC1K_LSU_CODE_BIT-1:0]lsu_op, input [`GRLEN-1:0] base, input [`GRLEN-1:0] offset, input [`GRLEN-1:0] wdata, input tlb_req, input data_exception, input [`GRLEN-1:0]data_badvaddr, input tlb_finish, //memory interface output data_req, output [`GRLEN-1:0] data_addr, output data_wr, `ifdef LA64 output [ 7:0] data_wstrb, `elsif LA32 output [ 3:0] data_wstrb,...
-
LSU里读写内存有stall一个cycle结果回不来怎么办?
以前写的都是用block ram,一个cycle读写都能完成,所以没遇到这个问题。 现在要是用cache,cache miss以后需要很多个周期。取指时还好解决,取不到就ifu就不往下进行。 而LSU在读写内存时一个cycle回不来,就要stall在那,流水线也要暂停等结果。 chiplab里是结果返回后设置lsu_res_valid。data_data_ok是cached memory interface给出的读成功的信号。 lsu_s2.v assign lsu_res_valid = data_data_ok || data_exception || res_valid || prefetch || !valid || (lsu_op == `LSOC1K_LSU_IDLE); 在ex2_stage里,lsu指令的完成可以让change=1。最终设置ex2_allow_in让流水线动起来。 //result wire port0_change; wire port0_alu_change = (ex2_port0_src == `EX_ALU0 ) && ex2_alu0_valid; wire port0_lsu_change = (ex2_port0_src == `EX_LSU ) && lsu_res_valid; wire port0_bru_change =...
-
各个阶段的pc是要放一个模块里,还是各个模块用dff分别存?
chiplab里是这样一排的流水线寄存器一起传给下一个stage。 input is_port0_valid, input [`GRLEN-1:0] is_port0_pc, input [31:0] is_port0_inst, input [`LSOC1K_DECODE_RES_BIT-1:0] is_port0_op, input [`GRLEN-3:0] is_port0_br_target, input is_port0_br_taken, input is_port0_exception, input [5 :0] is_port0_exccode, input is_port0_rf_wen, input [4:0] is_port0_rf_target, input [`LSOC1K_PRU_HINT:0] is_port0_hint, OpenSPARC T1里的做法是不同的模块管理相关的信号和各个stage的流水线寄存器。 比如sparc_ifu_fdp是ifu的data path,里面存着pc的各阶段的寄存器,需要的时候也是从这里像各个模块发出。 // D stage PC and nPC dff_s #(49) pcd_reg(.din (pc_s), .q (pc_d), .clk (clk), .se(se),...