@@ -62,7 +62,7 @@ architecture neorv32_cpu_alu_rtl of neorv32_cpu_alu is
6262 -- comparator --
6363 signal cmp_rs1 : std_ulogic_vector (XLEN downto 0 );
6464 signal cmp_rs2 : std_ulogic_vector (XLEN downto 0 );
65- signal cmp : std_ulogic_vector (1 downto 0 ); -- comparator status
65+ signal cmp : std_ulogic_vector (1 downto 0 );
6666
6767 -- operands --
6868 signal opa, opb : std_ulogic_vector (XLEN- 1 downto 0 );
@@ -74,22 +74,18 @@ architecture neorv32_cpu_alu_rtl of neorv32_cpu_alu is
7474
7575 -- co-processor interface --
7676 type cp_data_t is array (0 to 6 ) of std_ulogic_vector (XLEN- 1 downto 0 );
77- signal cp_result : cp_data_t; -- co-processor result
78- signal cp_valid : std_ulogic_vector (6 downto 0 ); -- co-processor done
79- signal cp_shamt : std_ulogic_vector (index_size_f(XLEN)- 1 downto 0 ); -- shift amount
77+ signal cp_result : cp_data_t;
78+ signal cp_valid : std_ulogic_vector (6 downto 0 );
79+ signal cp_shamt : std_ulogic_vector (index_size_f(XLEN)- 1 downto 0 );
8080
81- -- CSR proxy --
82- signal fpu_csr_en, cfu_csr_en : std_ulogic ;
83- signal fpu_csr_we, cfu_csr_we : std_ulogic ;
84- signal fpu_csr_rd, cfu_csr_rd : std_ulogic_vector (XLEN- 1 downto 0 );
81+ -- FPU proxy --
82+ signal fpu_csr_en, fpu_csr_we : std_ulogic ;
83+ signal fpu_csr_rd : std_ulogic_vector (XLEN- 1 downto 0 );
8584
8685 -- CFU proxy --
8786 signal cfu_active, cfu_done, cfu_busy : std_ulogic ;
8887 signal cfu_res : std_ulogic_vector (XLEN- 1 downto 0 );
8988
90- -- CSR read-backs --
91- signal csr_rdata_fpu, csr_rdata_cfu : std_ulogic_vector (XLEN- 1 downto 0 );
92-
9389begin
9490
9591 -- Comparator Unit (for conditional branches) ---------------------------------------------
@@ -150,10 +146,6 @@ begin
150146 -- > "cp_result" data has to be always zero unless the specific co-processor has been actually triggered
151147 cp_res <= cp_result(0 ) or cp_result(1 ) or cp_result(2 ) or cp_result(3 ) or cp_result(4 ) or cp_result(5 ) or cp_result(6 );
152148
153- -- co-processor CSR read-back --
154- -- > "csr_rdata_*" data has to be always zero unless the specific co-processor is actually being accessed
155- csr_o <= csr_rdata_fpu or csr_rdata_cfu;
156-
157149 -- shift amount --
158150 cp_shamt <= opb(cp_shamt'left downto 0 );
159151
@@ -270,19 +262,19 @@ begin
270262 );
271263
272264 -- CSR proxy --
273- fpu_csr_en <= '1' when (ctrl_i.csr_addr(11 downto 2 ) = csr_fflags_c(11 downto 2 )) else '0' ;
274- fpu_csr_we <= fpu_csr_en and ctrl_i.csr_we;
275- csr_rdata_fpu <= fpu_csr_rd when (fpu_csr_en = '1' ) else (others => '0' );
265+ fpu_csr_en <= '1' when (ctrl_i.csr_addr(11 downto 2 ) = csr_fflags_c(11 downto 2 )) else '0' ;
266+ fpu_csr_we <= fpu_csr_en and ctrl_i.csr_we;
267+ csr_o <= fpu_csr_rd when (fpu_csr_en = '1' ) else (others => '0' );
276268 end generate ;
277269
278270 neorv32_cpu_cp_fpu_inst_false:
279271 if not RISCV_ISA_Zfinx generate
280- fpu_csr_en <= '0' ;
281- fpu_csr_we <= '0' ;
282- fpu_csr_rd <= (others => '0' );
283- csr_rdata_fpu <= (others => '0' );
284- cp_result(3 ) <= (others => '0' );
285- cp_valid(3 ) <= '0' ;
272+ fpu_csr_en <= '0' ;
273+ fpu_csr_we <= '0' ;
274+ fpu_csr_rd <= (others => '0' );
275+ csr_o <= (others => '0' );
276+ cp_result(3 ) <= (others => '0' );
277+ cp_valid(3 ) <= '0' ;
286278 end generate ;
287279
288280
@@ -293,33 +285,23 @@ begin
293285 neorv32_cpu_cp_cfu_inst: entity neorv32.neorv32_cpu_cp_cfu
294286 port map (
295287 -- global control --
296- clk_i => clk_i, -- global clock, rising edge
297- rstn_i => rstn_i, -- global reset, low-active, async
288+ clk_i => clk_i, -- global clock, rising edge
289+ rstn_i => rstn_i, -- global reset, low-active, async
298290 -- operation control --
299- start_i => ctrl_i.alu_cp_cfu, -- operation trigger/strobe
300- active_i => cfu_active, -- operation in progress, CPU is waiting for CFU
301- -- CSR interface --
302- csr_we_i => cfu_csr_we, -- write enable
303- csr_addr_i => ctrl_i.csr_addr(1 downto 0 ), -- address
304- csr_wdata_i => ctrl_i.csr_wdata, -- write data
305- csr_rdata_o => cfu_csr_rd, -- read data
291+ start_i => ctrl_i.alu_cp_cfu, -- operation trigger/strobe
292+ active_i => cfu_active, -- operation in progress, CPU is waiting for CFU
306293 -- operands --
307- rtype_i => ctrl_i.ir_opcode(5 ), -- instruction type (R3-type or R4-type)
308- funct3_i => ctrl_i.ir_funct3, -- "funct3" bit-field from custom instruction word
309- funct7_i => ctrl_i.ir_funct12(11 downto 5 ), -- "funct7" bit-field from custom instruction word
310- rs1_i => rs1_i, -- rf source 1
311- rs2_i => rs2_i, -- rf source 2
312- rs3_i => rs3_i, -- rf source 3
294+ rtype_i => ctrl_i.ir_opcode(5 ), -- instruction type (R3-type or R4-type)
295+ funct3_i => ctrl_i.ir_funct3, -- "funct3" bit-field from custom instruction word
296+ funct7_i => ctrl_i.ir_funct12(11 downto 5 ), -- "funct7" bit-field from custom instruction word
297+ rs1_i => rs1_i, -- rf source 1
298+ rs2_i => rs2_i, -- rf source 2
299+ rs3_i => rs3_i, -- rf source 3
313300 -- result and status --
314- result_o => cfu_res, -- operation result
315- valid_o => cfu_done -- result valid, operation done; set one cycle before result_o is valid
301+ result_o => cfu_res, -- operation result
302+ valid_o => cfu_done -- result valid, operation done; set one cycle before result_o is valid
316303 );
317304
318- -- CSR proxy --
319- cfu_csr_en <= '1' when (ctrl_i.csr_addr(11 downto 2 ) = csr_cfureg0_c(11 downto 2 )) else '0' ;
320- cfu_csr_we <= cfu_csr_en and ctrl_i.csr_we;
321- csr_rdata_cfu <= cfu_csr_rd when (cfu_csr_en = '1' ) else (others => '0' );
322-
323305 -- response proxy --
324306 cfu_arbiter: process (rstn_i, clk_i)
325307 begin
@@ -346,16 +328,12 @@ begin
346328
347329 neorv32_cpu_cp_cfu_inst_false:
348330 if not RISCV_ISA_Zxcfu generate
349- cfu_csr_en <= '0' ;
350- cfu_csr_we <= '0' ;
351- cfu_done <= '0' ;
352- cfu_res <= (others => '0' );
353- cfu_csr_rd <= (others => '0' );
354- csr_rdata_cfu <= (others => '0' );
355- cfu_busy <= '0' ;
356- cfu_active <= '0' ;
357- cp_result(4 ) <= (others => '0' );
358- cp_valid(4 ) <= '0' ;
331+ cfu_done <= '0' ;
332+ cfu_res <= (others => '0' );
333+ cfu_busy <= '0' ;
334+ cfu_active <= '0' ;
335+ cp_result(4 ) <= (others => '0' );
336+ cp_valid(4 ) <= '0' ;
359337 end generate ;
360338
361339
0 commit comments