-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathpc.vhd
More file actions
executable file
·55 lines (39 loc) · 1.01 KB
/
pc.vhd
File metadata and controls
executable file
·55 lines (39 loc) · 1.01 KB
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
50
51
52
53
54
55
----------------------------------------------------------------------------------
-- program counter implementation
----------------------------------------------------------------------------------
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity pc is
port(extend:in std_logic_vector(15 downto 0);
PL:in std_logic;
PI:in std_logic;
Clk : in std_logic;
pc_out:out std_logic_vector(15 downto 0);
reset:in std_logic
);
end pc;
architecture Behavioral of pc is
--signal pc_val,pc_val2:std_logic_vector(15 downto 0):="0000000000110111";
begin
--
--sync_stuff: process(reset,PI,PL)
--begin
--
--if rising_edge(CLK)then
process(reset,PI,PL)
variable pc_val:std_logic_vector(15 downto 0);
begin
if(reset='1') then
pc_val:=x"ffff";
pc_out<=pc_val;
elsif(PL='1') then
pc_val:=pc_val + extend;
pc_out<=pc_val;
--else if p0=1 then increment pc;
elsif(PI='1') then
pc_val:=pc_val+1;
pc_out<=pc_val;
end if;
end process;
end Behavioral;