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