-
Notifications
You must be signed in to change notification settings - Fork 0
/
shiftReg.vhd
64 lines (58 loc) · 2.01 KB
/
shiftReg.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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
--------------------------------------------------------------------------------
-- Company: Mircea Dabacan
-- Engineer:
--
-- Create Date: 17:35:37 08/27/06
-- Design Name:
-- Module Name: BlockRam - Behavioral
-- Project Name:
-- Target Device:
-- Tool versions:
-- Description:
--
-- Dependencies: Inputs one on the data bus input and outputs 6 bytes on the
-- output bus. The input bytes are shifted into the ShiftReg6 vector.
-- After shifting 6 bytes into the shift register the output
-- stream is ready.
--
-- Revision:
-- Revision 0.01 - (MirceaD) File Created
-- 0.02 - (TudorC) Made the shift register synchronous on the clock input
-- Additional Comments:
--
--------------------------------------------------------------------------------
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity ShiftReg is
Port ( ck : in std_logic; -- sys clk: 50Mhz
busIn : in std_logic_vector(7 downto 0);-- data bus input
Wr : in std_logic; -- write cycle
CompSel : in std_logic; -- component select
Stream6Bytes : out std_logic_vector(47 downto 0)
);
end ShiftReg;
architecture Behavioral of ShiftReg is
signal ShiftReg6: std_logic_vector(47 downto 0);
begin
-- Shift register 6 bytes
ShiftReg: process(ck, Wr) is
begin
if ck'event and ck = '1' then
if Wr = '1' and CompSel = '1' then -- write cycle and component selected
--busIn byte is put onto the last position of the shift register
--and the contents of ShiftReg6 is shifted left 8 bits.
ShiftReg6(7 downto 0) <= busIn;
ShiftReg6(15 downto 8) <= ShiftReg6(7 downto 0);
ShiftReg6(23 downto 16) <= ShiftReg6(15 downto 8);
ShiftReg6(31 downto 24) <= ShiftReg6(23 downto 16);
ShiftReg6(39 downto 32) <= ShiftReg6(31 downto 24);
ShiftReg6(47 downto 40) <= ShiftReg6(39 downto 32);
else
null;
end if;
end if;
end process;
Stream6Bytes <= ShiftReg6;
end Behavioral;