-
Notifications
You must be signed in to change notification settings - Fork 0
/
if_id.vhd
50 lines (43 loc) · 1.4 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
39
40
41
42
43
44
45
46
47
48
49
----------------------------------------------------------------------------------
-- Engineer: Zirgon
-- Project: DataKonst2
-- Created: 2013-10-29
--
-- Description:
-- Pipeline register between Instruction Fetch and Instruction Decode stages
----------------------------------------------------------------------------------
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
library WORK;
use WORK.MIPS_CONSTANT_PKG.ALL;
entity if_id is
port(
-- Signals
pc_in : in STD_LOGIC_VECTOR(PC_WIDTH-1 downto 0);
pc_out : out STD_LOGIC_VECTOR(PC_WIDTH-1 downto 0);
inst_in : in STD_LOGIC_VECTOR(INST_WIDTH-1 downto 0);
inst_out : out STD_LOGIC_VECTOR(INST_WIDTH-1 downto 0);
-- Pipeline signals
clk : in STD_LOGIC;
reset : in STD_LOGIC;
enable : in STD_LOGIC
);
end if_id;
architecture Behavioral of if_id is
begin
process(clk, reset, enable, pc_in, inst_in)
begin
if rising_edge(clk) then
if reset = '1' then
-- Signals
pc_out <= (others => '0');
--inst_out <= (others => '0');
elsif enable = '1' then
-- Signals
pc_out <= pc_in;
--inst_out <= inst_in;
end if;
end if;
end process;
inst_out <= (others =>'0') when reset = '1' else inst_in;
end Behavioral;