Project

General

Profile

Download (1.07 KB) Statistics
| Branch: | Tag: | Revision:
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
        else
41
          shft <= reg;
42
        end if;
43
      end if;
44
    end process;
45
    q <= shft;
46
end behavior;
(18-18/22)