1 |
17 |
leonardoar |
--! @file
|
2 |
|
|
--! @brief DataPath http://en.wikipedia.org/wiki/Datapath
|
3 |
|
|
|
4 |
|
|
--! Use standard library and import the packages (std_logic_1164,std_logic_unsigned,std_logic_arith)
|
5 |
|
|
library IEEE;
|
6 |
|
|
use ieee.std_logic_1164.all;
|
7 |
|
|
use ieee.std_logic_unsigned.all;
|
8 |
|
|
use ieee.std_logic_arith.all;
|
9 |
|
|
|
10 |
|
|
--! Use CPU Definitions package
|
11 |
|
|
use work.pkgOpenCPU32.all;
|
12 |
|
|
|
13 |
|
|
--! A datapath is a collection of functional units, such as arithmetic logic units or multipliers, that perform data processing operations.\n
|
14 |
|
|
--! Most central processing units consist of a datapath and a control unit, with a large part of the control unit dedicated to
|
15 |
|
|
--! regulating the interaction between the datapath and main memory.
|
16 |
|
|
|
17 |
|
|
--! The purpose of datapaths is to provide routes for data to travel between functional units.
|
18 |
|
|
entity DataPath is
|
19 |
|
|
generic (n : integer := nBits - 1); --! Generic value (Used to easily change the size of the Alu on the package)
|
20 |
|
|
Port ( inputMm : in STD_LOGIC_VECTOR (n downto 0); --! Input of Datapath from main memory
|
21 |
|
|
inputImm : in STD_LOGIC_VECTOR (n downto 0); --! Input of Datapath from imediate value (instructions...)
|
22 |
|
|
clk : in STD_LOGIC; --! Clock signal
|
23 |
|
|
outEn : in typeEnDis; --! Enable/Disable datapath output
|
24 |
|
|
aluOp : in aluOps; --! Alu operations
|
25 |
|
|
muxSel : in STD_LOGIC_VECTOR (2 downto 0); --! Select inputs from dataPath(Memory,Imediate,RegisterFile,Alu)
|
26 |
|
|
regFileWriteAddr : in generalRegisters; --! General register write address
|
27 |
|
|
regFileWriteEn : in STD_LOGIC; --! RegisterFile write enable signal
|
28 |
|
|
regFileReadAddrA : in generalRegisters; --! General register read address (PortA)
|
29 |
|
|
regFileReadAddrB : in generalRegisters; --! General register read address (PortB)
|
30 |
|
|
regFileEnA : in STD_LOGIC; --! Enable RegisterFile PortA
|
31 |
|
|
regFileEnB : in STD_LOGIC; --! Enable RegisterFile PortB
|
32 |
|
|
outputDp : out STD_LOGIC_VECTOR (n downto 0); --! DataPath Output
|
33 |
|
|
dpFlags : out STD_LOGIC_VECTOR (n downto 0)); --! Alu Flags
|
34 |
|
|
end DataPath;
|
35 |
|
|
|
36 |
|
|
--! @brief DataPath http://en.wikipedia.org/wiki/Datapath
|
37 |
|
|
--! @details This description will also show how to instantiate components(Alu, RegisterFile, Multiplexer) on your design
|
38 |
|
|
architecture Behavioral of DataPath is
|
39 |
|
|
|
40 |
|
|
begin
|
41 |
|
|
|
42 |
|
|
|
43 |
|
|
end Behavioral;
|
44 |
|
|
|