-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathIO.vhd
More file actions
42 lines (35 loc) · 1.09 KB
/
IO.vhd
File metadata and controls
42 lines (35 loc) · 1.09 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
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
entity IO is
Port ( clk : in STD_LOGIC;
rst : in STD_LOGIC;
en_load : in STD_LOGIC;
load_a : in STD_LOGIC;
load_b : in STD_LOGIC;
dataBus : in STD_LOGIC_VECTOR(7 downto 0);
Z_a : out STD_LOGIC_VECTOR(7 downto 0);
Z_b : out STD_LOGIC_VECTOR(7 downto 0));
end IO;
--Two registers for IO
architecture Behavioral of IO is
signal reg_a : STD_LOGIC_VECTOR(7 downto 0) := (others => '0');
signal reg_b : STD_LOGIC_VECTOR(7 downto 0) := (others => '0');
begin
process(clk, rst, en_load, load_a, load_b, dataBus)
begin
if(rst = '1') then
reg_a <= (others => '0');
reg_b <= (others => '0');
elsif(rising_edge(clk)) then
if(en_load = '1') then
if(load_a = '1') then
reg_a <= dataBus;
elsif(load_b = '1') then
reg_b <= dataBus;
end if;
end if;
end if;
end process;
Z_a <= reg_a;
Z_b <= reg_b;
end Behavioral;