lustrec-tests/vhdl_json/vhdl_files/valencia/prep_latch_gen.vhd @ a0f656ac
1 |
|
---|---|
2 |
package typedef is |
3 |
subtype byte is bit_vector (7 downto 0); |
4 |
end; |
5 |
use work.typedef; |
6 |
entity data_path is |
7 |
port (clk, rst, s_1: in boolean; s0, s1: in bit; d0, d1, d2, d3: in byte; |
8 |
q: out byte); |
9 |
end; |
10 |
architecture behavior of data_path is |
11 |
signal reg,shft : byte; |
12 |
signal sel : bit_vector (1 downto 0); |
13 |
begin
|
14 |
process (clk,rst) is |
15 |
begin
|
16 |
if (rst) then |
17 |
reg <= x"00"; |
18 |
shft <= x"00"; |
19 |
elsif ((clk and clk'event)) then |
20 |
sel <= (s0 & s1); |
21 |
case sel is |
22 |
when b"00" => reg <= d0; |
23 |
when b"10" => reg <= d1; |
24 |
when b"01" => reg <= d2; |
25 |
when b"11" => reg <= d3; |
26 |
end case; |
27 |
if (s_1) then |
28 |
shft <= (shft(6 downto 0) & shft(7)); |
29 |
end if; |
30 |
end if; |
31 |
end process; |
32 |
q <= shft; |
33 |
end; |