1 |
52 |
zero_gravi |
-- #################################################################################################
|
2 |
53 |
zero_gravi |
-- # << NEORV32 - CPU Co-Processor: Single-Prec. Floating Point Unit (RISC-V "Zfinx" Extension) >> #
|
3 |
52 |
zero_gravi |
-- # ********************************************************************************************* #
|
4 |
|
|
-- # #
|
5 |
|
|
-- # !!! WORK-IN-PROGRESS !!! #
|
6 |
|
|
-- # !!! THIS UNIT IS NOT FUNCTIONAL YET !!! #
|
7 |
|
|
-- # #
|
8 |
|
|
-- # ********************************************************************************************* #
|
9 |
53 |
zero_gravi |
-- # The Zfinx floating-point extension uses the integer register file (x) for all FP operations. #
|
10 |
|
|
-- # See the official RISC-V specs (https://github.com/riscv/riscv-zfinx) for more information. #
|
11 |
52 |
zero_gravi |
-- # ********************************************************************************************* #
|
12 |
53 |
zero_gravi |
-- # !! Enabling the Zfinx extension does not has an effect on the CPU. If F is enabled, there !! #
|
13 |
|
|
-- # !! will be no traps when trying to execute floating-point instructions, since the main !! #
|
14 |
|
|
-- # !! CPU control unit allready provides all necessary Zfinx-extension infrastructure. !! #
|
15 |
|
|
-- # !! However, all Zfinx instructions will always return zero. !! #
|
16 |
|
|
-- # ********************************************************************************************* #
|
17 |
52 |
zero_gravi |
-- # BSD 3-Clause License #
|
18 |
|
|
-- # #
|
19 |
|
|
-- # Copyright (c) 2021, Stephan Nolting. All rights reserved. #
|
20 |
|
|
-- # #
|
21 |
|
|
-- # Redistribution and use in source and binary forms, with or without modification, are #
|
22 |
|
|
-- # permitted provided that the following conditions are met: #
|
23 |
|
|
-- # #
|
24 |
|
|
-- # 1. Redistributions of source code must retain the above copyright notice, this list of #
|
25 |
|
|
-- # conditions and the following disclaimer. #
|
26 |
|
|
-- # #
|
27 |
|
|
-- # 2. Redistributions in binary form must reproduce the above copyright notice, this list of #
|
28 |
|
|
-- # conditions and the following disclaimer in the documentation and/or other materials #
|
29 |
|
|
-- # provided with the distribution. #
|
30 |
|
|
-- # #
|
31 |
|
|
-- # 3. Neither the name of the copyright holder nor the names of its contributors may be used to #
|
32 |
|
|
-- # endorse or promote products derived from this software without specific prior written #
|
33 |
|
|
-- # permission. #
|
34 |
|
|
-- # #
|
35 |
|
|
-- # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS #
|
36 |
|
|
-- # OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF #
|
37 |
|
|
-- # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE #
|
38 |
|
|
-- # COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, #
|
39 |
|
|
-- # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE #
|
40 |
|
|
-- # GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED #
|
41 |
|
|
-- # AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING #
|
42 |
|
|
-- # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED #
|
43 |
|
|
-- # OF THE POSSIBILITY OF SUCH DAMAGE. #
|
44 |
|
|
-- # ********************************************************************************************* #
|
45 |
|
|
-- # The NEORV32 Processor - https://github.com/stnolting/neorv32 (c) Stephan Nolting #
|
46 |
|
|
-- #################################################################################################
|
47 |
|
|
|
48 |
|
|
library ieee;
|
49 |
|
|
use ieee.std_logic_1164.all;
|
50 |
|
|
use ieee.numeric_std.all;
|
51 |
|
|
|
52 |
|
|
library neorv32;
|
53 |
|
|
use neorv32.neorv32_package.all;
|
54 |
|
|
|
55 |
|
|
entity neorv32_cpu_cp_fpu is
|
56 |
|
|
port (
|
57 |
|
|
-- global control --
|
58 |
53 |
zero_gravi |
clk_i : in std_ulogic; -- global clock, rising edge
|
59 |
|
|
rstn_i : in std_ulogic; -- global reset, low-active, async
|
60 |
|
|
ctrl_i : in std_ulogic_vector(ctrl_width_c-1 downto 0); -- main control bus
|
61 |
|
|
start_i : in std_ulogic; -- trigger operation
|
62 |
52 |
zero_gravi |
-- data input --
|
63 |
53 |
zero_gravi |
frm_i : in std_ulogic_vector(2 downto 0); -- rounding mode
|
64 |
|
|
rs1_i : in std_ulogic_vector(data_width_c-1 downto 0); -- rf source 1
|
65 |
|
|
rs2_i : in std_ulogic_vector(data_width_c-1 downto 0); -- rf source 2
|
66 |
52 |
zero_gravi |
-- result and status --
|
67 |
53 |
zero_gravi |
res_o : out std_ulogic_vector(data_width_c-1 downto 0); -- operation result
|
68 |
|
|
fflags_o : out std_ulogic_vector(4 downto 0); -- exception flags
|
69 |
|
|
valid_o : out std_ulogic -- data output valid
|
70 |
52 |
zero_gravi |
);
|
71 |
|
|
end neorv32_cpu_cp_fpu;
|
72 |
|
|
|
73 |
|
|
architecture neorv32_cpu_cp_fpu_rtl of neorv32_cpu_cp_fpu is
|
74 |
|
|
|
75 |
|
|
begin
|
76 |
|
|
|
77 |
|
|
-- There is nothing to see here yet -------------------------------------------------------
|
78 |
|
|
-- -------------------------------------------------------------------------------------------
|
79 |
53 |
zero_gravi |
res_o <= (others => '0');
|
80 |
52 |
zero_gravi |
fflags_o <= (others => '0');
|
81 |
|
|
valid_o <= start_i;
|
82 |
|
|
|
83 |
|
|
|
84 |
|
|
end neorv32_cpu_cp_fpu_rtl;
|