|
16 | 16 | module cve2_decoder #(
|
17 | 17 | parameter bit RV32E = 0,
|
18 | 18 | parameter cve2_pkg::rv32m_e RV32M = cve2_pkg::RV32MFast,
|
19 |
| - parameter cve2_pkg::rv32b_e RV32B = cve2_pkg::RV32BNone |
| 19 | + parameter cve2_pkg::rv32b_e RV32B = cve2_pkg::RV32BNone, |
| 20 | + parameter bit XInterface = 1'b0 |
20 | 21 | ) (
|
21 | 22 | input logic clk_i,
|
22 | 23 | input logic rst_ni,
|
@@ -50,46 +51,50 @@ module cve2_decoder #(
|
50 | 51 | output logic [31:0] zimm_rs1_type_o,
|
51 | 52 |
|
52 | 53 | // register file
|
53 |
| - output cve2_pkg::rf_wd_sel_e rf_wdata_sel_o, // RF write data selection |
54 |
| - output logic rf_we_o, // write enable for regfile |
55 |
| - output logic [4:0] rf_raddr_a_o, |
56 |
| - output logic [4:0] rf_raddr_b_o, |
57 |
| - output logic [4:0] rf_waddr_o, |
58 |
| - output logic rf_ren_a_o, // Instruction reads from RF addr A |
59 |
| - output logic rf_ren_b_o, // Instruction reads from RF addr B |
| 54 | + output logic [XInterface:0] rf_wdata_sel_o, // RF write data selection |
| 55 | + output logic rf_we_o, // write enable for regfile |
| 56 | + output logic [4:0] rf_raddr_a_o, |
| 57 | + output logic [4:0] rf_raddr_b_o, |
| 58 | + output logic [4:0] rf_waddr_o, |
| 59 | + output logic rf_ren_a_o, // Instruction reads from RF addr A |
| 60 | + output logic rf_ren_b_o, // Instruction reads from RF addr B |
60 | 61 |
|
61 | 62 | // ALU
|
62 |
| - output cve2_pkg::alu_op_e alu_operator_o, // ALU operation selection |
63 |
| - output cve2_pkg::op_a_sel_e alu_op_a_mux_sel_o, // operand a selection: reg value, PC, |
64 |
| - // immediate or zero |
65 |
| - output cve2_pkg::op_b_sel_e alu_op_b_mux_sel_o, // operand b selection: reg value or |
66 |
| - // immediate |
67 |
| - output logic alu_multicycle_o, // ternary bitmanip instruction |
| 63 | + output cve2_pkg::alu_op_e alu_operator_o, // ALU operation selection |
| 64 | + output cve2_pkg::op_a_sel_e alu_op_a_mux_sel_o, // operand a selection: reg value, PC, |
| 65 | + // immediate or zero |
| 66 | + output cve2_pkg::op_b_sel_e alu_op_b_mux_sel_o, // operand b selection: reg value or |
| 67 | + // immediate |
| 68 | + output logic alu_multicycle_o, // ternary bitmanip instruction |
68 | 69 |
|
69 | 70 | // MULT & DIV
|
70 |
| - output logic mult_en_o, // perform integer multiplication |
71 |
| - output logic div_en_o, // perform integer division or remainder |
72 |
| - output logic mult_sel_o, // as above but static, for data muxes |
73 |
| - output logic div_sel_o, // as above but static, for data muxes |
| 71 | + output logic mult_en_o, // perform integer multiplication |
| 72 | + output logic div_en_o, // perform integer division or remainder |
| 73 | + output logic mult_sel_o, // as above but static, for data muxes |
| 74 | + output logic div_sel_o, // as above but static, for data muxes |
74 | 75 |
|
75 |
| - output cve2_pkg::md_op_e multdiv_operator_o, |
76 |
| - output logic [1:0] multdiv_signed_mode_o, |
| 76 | + output cve2_pkg::md_op_e multdiv_operator_o, |
| 77 | + output logic [1:0] multdiv_signed_mode_o, |
77 | 78 |
|
78 | 79 | // CSRs
|
79 |
| - output logic csr_access_o, // access to CSR |
80 |
| - output cve2_pkg::csr_op_e csr_op_o, // operation to perform on CSR |
| 80 | + output logic csr_access_o, // access to CSR |
| 81 | + output cve2_pkg::csr_op_e csr_op_o, // operation to perform on CSR |
81 | 82 |
|
82 | 83 | // LSU
|
83 |
| - output logic data_req_o, // start transaction to data memory |
84 |
| - output logic data_we_o, // write enable |
85 |
| - output logic [1:0] data_type_o, // size of transaction: byte, half |
86 |
| - // word or word |
87 |
| - output logic data_sign_extension_o, // sign extension for data read from |
| 84 | + output logic data_req_o, // start transaction to data memory |
| 85 | + output logic data_we_o, // write enable |
| 86 | + output logic [1:0] data_type_o, // size of transaction: byte, half |
| 87 | + // word or word |
| 88 | + output logic data_sign_extension_o, // sign extension for data read from |
88 | 89 | // memory
|
89 | 90 |
|
| 91 | + // Core-V eXtension interface (CV-X-IF) |
| 92 | + input cve2_pkg::readregflags_t x_issue_resp_register_read_i, |
| 93 | + input cve2_pkg::writeregflags_t x_issue_resp_writeback_i, |
| 94 | + |
90 | 95 | // jump/branches
|
91 |
| - output logic jump_in_dec_o, // jump is being calculated in ALU |
92 |
| - output logic branch_in_dec_o |
| 96 | + output logic jump_in_dec_o, // jump is being calculated in ALU |
| 97 | + output logic branch_in_dec_o |
93 | 98 | );
|
94 | 99 |
|
95 | 100 | import cve2_pkg::*;
|
@@ -205,7 +210,7 @@ module cve2_decoder #(
|
205 | 210 | multdiv_operator_o = MD_OP_MULL;
|
206 | 211 | multdiv_signed_mode_o = 2'b00;
|
207 | 212 |
|
208 |
| - rf_wdata_sel_o = RF_WD_EX; |
| 213 | + rf_wdata_sel_o = $bits(rf_wdata_sel_o)'({RF_WD_EX}); |
209 | 214 | rf_we = 1'b0;
|
210 | 215 | rf_ren_a_o = 1'b0;
|
211 | 216 | rf_ren_b_o = 1'b0;
|
@@ -612,7 +617,7 @@ module cve2_decoder #(
|
612 | 617 | end else begin
|
613 | 618 | // instruction to read/modify CSR
|
614 | 619 | csr_access_o = 1'b1;
|
615 |
| - rf_wdata_sel_o = RF_WD_CSR; |
| 620 | + rf_wdata_sel_o = $bits(rf_wdata_sel_o)'({RF_WD_CSR}); |
616 | 621 | rf_we = 1'b1;
|
617 | 622 |
|
618 | 623 | if (~instr[14]) begin
|
@@ -653,6 +658,13 @@ module cve2_decoder #(
|
653 | 658 | jump_set_o = 1'b0;
|
654 | 659 | branch_in_dec_o = 1'b0;
|
655 | 660 | csr_access_o = 1'b0;
|
| 661 | + // CV-X-IF |
| 662 | + if(XInterface) begin |
| 663 | + rf_ren_a_o = x_issue_resp_register_read_i[0]; |
| 664 | + rf_ren_b_o = x_issue_resp_register_read_i[1]; |
| 665 | + rf_we = x_issue_resp_writeback_i; |
| 666 | + rf_wdata_sel_o = $bits(rf_wdata_sel_o)'({RF_WD_COPROC}); |
| 667 | + end |
656 | 668 | end
|
657 | 669 | end
|
658 | 670 |
|
|
0 commit comments