-
Notifications
You must be signed in to change notification settings - Fork 20
Expand file tree
/
Copy pathpc.vhd
More file actions
35 lines (27 loc) · 743 Bytes
/
pc.vhd
File metadata and controls
35 lines (27 loc) · 743 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
------------------------------------------------------
-- Program Counter component
--
-- Points to address of next instruction to run and returns
-- that address in current_address.
------------------------------------------------------
library IEEE;
use IEEE.std_logic_1164.all;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity pc is
port(
ck: in std_logic;
address_to_load: in std_logic_vector(31 downto 0);
current_address: out std_logic_vector(31 downto 0)
);
end pc;
architecture beh of pc is
signal address: std_logic_vector(31 downto 0):= "00000000000000000000000000000000";
begin
process(ck)
begin
current_address <= address;
if ck='0' and ck'event then
address <= address_to_load;
end if;
end process;
end beh;