-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPC.vhd
More file actions
40 lines (32 loc) · 726 Bytes
/
PC.vhd
File metadata and controls
40 lines (32 loc) · 726 Bytes
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
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.NUMERIC_STD.ALL;
entity PC is
Port ( clk : in STD_LOGIC;
inc : in STD_LOGIC;
rst : in STD_LOGIC;
PCOut : out STD_LOGIC_VECTOR (2 downto 0);
PCIn : in STD_LOGIC_VECTOR (2 downto 0);
jmp : in STD_LOGIC);
end PC;
architecture Behavioral of PC is
signal PCVal : unsigned(2 downto 0);
begin
process (clk)
begin
if rising_edge(clk) then
if rst = '1' then
PCVal <= "000";
else
if jmp = '1' then
PCVal <= unsigned(PCIn);
else
if inc = '1' then
PCVal <= PCVal + 1;
end if;
end if;
end if;
end if;
end process;
PCOut <= std_logic_vector(PCVal);
end Behavioral;