-
Notifications
You must be signed in to change notification settings - Fork 0
/
flags.vhd
48 lines (45 loc) · 1.36 KB
/
flags.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
library IEEE;
use IEEE.std_logic_1164.all;
entity flags is
port(
cin : IN std_logic;
zin : IN std_logic;
clk : IN std_logic;
c_set : IN std_logic;
c_reset : IN std_logic;
z_set : IN std_logic;
z_reset : IN std_logic;
sr_load : IN std_logic;
cout : OUT std_logic;
zout : OUT std_logic
);
end flags;
architecture rtl of flags is
signal cout_signal, zout_signal : std_logic := '0';
begin
process(clk, c_set, c_reset, z_set, z_reset, sr_load) is
begin
if (rising_edge(clk)) then
if (sr_load = '1') then
cout_signal <= cout_signal;
zout_signal <= zout_signal;
end if;
if (c_set = '1') then
cout_signal <= '1';
zout_signal <= zout_signal;
elsif (c_reset = '1') then
cout_signal <= '0';
zout_signal <= zout_signal;
end if;
if (z_set = '1') then
cout_signal <= cout_signal;
zout_signal <= '1';
elsif (z_reset = '1') then
cout_signal <= cout_signal;
zout_signal <= '0';
end if;
end if;
end process;
cout <= cout_signal;
zout <= zout_signal;
end rtl;