-
Notifications
You must be signed in to change notification settings - Fork 0
/
IF_ID.vhd
38 lines (34 loc) · 1.04 KB
/
IF_ID.vhd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
library ieee ;
use ieee.std_logic_1164.all ;
use ieee.numeric_std.all ;
entity IF_ID is
port (
Clock : in std_logic;
-- stall in data hazard
IFIDStall : in std_logic;
-- flush in control hazard
IFIDFlush : in std_logic;
-- PCIn: PC+4
PCIn : in std_logic_vector(31 downto 0) ;
InstructionIn : in std_logic_vector(31 downto 0) ;
PCOut : out std_logic_vector(31 downto 0) ;
InstructionOut : out std_logic_vector(31 downto 0)
) ;
end IF_ID ;
architecture Behavior of IF_ID is
begin
IF_ID : process( Clock, IFIDStall, IFIDFlush )
begin
if falling_edge(Clock) then
if IFIDStall = '1' then -- hold output
NULL;
elsif IFIDFlush = '1' then -- set output to 0.
PCOut <= PCIn;
InstructionOut <= (others => '0');
else
PCOut <= PCIn;
InstructionOut <= InstructionIn;
end if ;
end if ;
end process ; -- IF_ID
end architecture ;