1 --------------------------------
2 ----------shift registers -----
3 --------------------------------
5 use ieee.std_logic_1164.all;
7 entity shift_register is
12 port ( clk : in std_logic;
16 d : in std_logic_vector(dsize - 1 downto 0);
17 q : out std_logic_vector(dsize - 1 downto 0)
21 architecture rtl of shift_register is
32 d : in std_logic_vector (dsize - 1 downto 0);
33 q : out std_logic_vector (dsize - 1 downto 0)
37 signal dff_we_n : std_logic;
38 signal q_out : std_logic_vector(dsize - 1 downto 0);
39 signal df_in : std_logic_vector(dsize - 1 downto 0);
44 dff_we_n <= ce_n and we_n;
45 dff_inst : d_flip_flop generic map (dsize)
46 port map (clk, rst_n, '1', dff_we_n, df_in, q_out);
48 clk_p : process (clk, we_n, ce_n, d)
52 elsif (ce_n = '0') then
53 df_in (dsize - 1 downto dsize - shift) <= (others => '0');
54 df_in (dsize - shift - 1 downto 0) <=
55 q_out(dsize - 1 downto shift);
61 -------------------------------
62 -- LS373 transparent D-latch---
63 -------------------------------
65 use ieee.std_logic_1164.all;
71 port ( c : in std_logic;
72 we_n : in std_logic;
\r
73 oc_n : in std_logic;
\r
74 d : in std_logic_vector(dsize - 1 downto 0);
75 q : out std_logic_vector(dsize - 1 downto 0)
79 architecture rtl of ls373 is
81 component d_flip_flop
\r
83 dsize : integer := 8
\r
87 res_n : in std_logic;
\r
88 set_n : in std_logic;
\r
89 we_n : in std_logic;
\r
90 d : in std_logic_vector (dsize - 1 downto 0);
\r
91 q : out std_logic_vector (dsize - 1 downto 0)
\r
95 component tri_state_buffer
101 d : in std_logic_vector (dsize - 1 downto 0);
102 q : out std_logic_vector (dsize - 1 downto 0)
106 signal q_out : std_logic_vector (dsize - 1 downto 0);
109 out_reg_inst : d_flip_flop generic map (dsize)
\r
110 port map (c, '1', '1', we_n, d, q_out);
\r
111 tsb_inst : tri_state_buffer generic map (dsize)
112 port map (oc_n, q_out, q);