1
|
------------------------------------------
|
2
|
-- PREP Benchmark Circuit #1: Data Path
|
3
|
--
|
4
|
-- Copyright 1993, Data I/O Corporation.
|
5
|
--
|
6
|
-- Copyright 1993, Metamor, Inc.
|
7
|
--
|
8
|
package typedef is
|
9
|
subtype byte is bit_vector (7 downto 0);
|
10
|
end;
|
11
|
|
12
|
use work.typedef.all;
|
13
|
|
14
|
entity data_path is
|
15
|
port (clk,rst,s_1 : in boolean;
|
16
|
s0, s1 : in bit;
|
17
|
d0, d1, d2, d3 : in byte;
|
18
|
q : out byte);
|
19
|
end data_path;
|
20
|
|
21
|
architecture behavior of data_path is
|
22
|
signal reg,shft : byte;
|
23
|
signal sel: bit_vector(1 downto 0);
|
24
|
begin
|
25
|
process (clk,rst)
|
26
|
begin
|
27
|
if rst then -- async reset
|
28
|
reg <= x"00";
|
29
|
shft <= x"00";
|
30
|
elsif clk and clk'event then -- define a clock
|
31
|
sel <= s0 & s1;
|
32
|
case sel is -- mux function
|
33
|
when b"00" => reg <= d0;
|
34
|
when b"10" => reg <= d1;
|
35
|
when b"01" => reg <= d2;
|
36
|
when b"11" => reg <= d3;
|
37
|
end case;
|
38
|
if s_1 then -- conditional shift
|
39
|
shft <= shft(6 downto 0) & shft (7);
|
40
|
end if;
|
41
|
end if;
|
42
|
end process;
|
43
|
q <= shft;
|
44
|
end behavior;
|