-
inst memory interface里的inst_cancel信号
这个信号过了很久就忘了干什么用的了。 等以后自己写cache了就能换掉这些icache dcache的memory interface了。 188 // when branch taken, inst_cancel need to be signal 189 // so that the new target instruction can be fetched instead of the one previously requested 190 assign inst_cancel = br_taken; 当跳转发生的时候signal inst_cancel,就是下面这样,取指令的时间更久了。 但如果去掉这句,不signal inst_cancel,就是下面这样。 取指令时间没有变,但取出来的指令并不是跳转以后的新地址处的指令,而是跳转指令顺序下一条的指令。 还是之前发处的取值指令。 obj/main.elf: file format elf32-loongarch obj/main.elf Disassembly of section...
-
branch指令里的jirl
jirl主要就是把pc+4的值存到rd寄存器里,而且寻址也不是pc+offs,而是[rj]+offs。 在实现上,就相当于branch指令和ALU指令的结合。 既需要跳转,又需要算出地址并写回到rd指定的寄存器里。 526 wire rddata_sel_alu_res_m_l; 527 wire rddata_sel_lsu_res_m_l; 528 wire rddata_sel_bru_res_m_l; 529 530 assign rddata_sel_alu_res_m_l = (lsu_ecl_rdata_valid_m | bru_wen_m); // default is alu resulst if no other module claims it 531 assign rddata_sel_lsu_res_m_l = ~lsu_ecl_rdata_valid_m; 532 assign rddata_sel_bru_res_m_l = ~bru_wen_m; 533 534 dp_mux3ds #(`GRLEN) rd_data_mux(.dout (rd_data_m), 535 .in0 (alu_ecl_res_m),...
-
branch logic
exu/rtl/sparc_exu.v sparc_exu_ecl ecl( .so (short_so0), .si (short_scan0_1), .rst_tri_en (mux_drive_disable), .byp_ecl_wrccr_data_w(byp_irf_rd_data_w[7:0]), .alu_ecl_adder_out_31_e(exu_ifu_brpc_e[31]), .byp_ecl_rd_data_3lsb_m(exu_tlu_wsr_data_m[2:0]), .alu_ecl_adder_out_7_0_e(exu_ifu_brpc_e[7:0]), ... sparc_exu_alu alu( .byp_alu_rs3_data_e(exu_lsu_rs3_data_e[63:0]), .so (scan0_2), .si (scan0_1), .ifu_lsu_casa_e (ecl_alu_casa_e), /*AUTOINST*/ // Outputs .alu_byp_rd_data_e (alu_byp_rd_data_e[63:0]), .exu_ifu_brpc_e (exu_ifu_brpc_e[47:0]), .exu_lsu_ldst_va_e (exu_lsu_ldst_va_e[47:0]), .exu_lsu_early_va_e(exu_lsu_early_va_e[10:3]), .exu_mmu_early_va_e(exu_mmu_early_va_e[7:0]), .alu_ecl_add_n64_e (alu_ecl_add_n64_e), .alu_ecl_add_n32_e (alu_ecl_add_n32_e), .alu_ecl_log_n64_e (alu_ecl_log_n64_e), .alu_ecl_log_n32_e (alu_ecl_log_n32_e), ... exu_ifu_brpc_e是exu给ifu的branch地址,可以看到这部分是在_e得出的。 从文档里也看到branch address的计算也是复用了ALU,应该就是ALU里的exu_ifu_brpc_e。 而在sparc_ifu.v里却有这个 // Branch Logic...