OpenCores
URL https://opencores.org/ocsvn/modbus/modbus/trunk

Subversion Repositories modbus

[/] [modbus/] [trunk/] [enlace/] [shift9_LR.vhd] - Blame information for rev 3

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 3 guanucolui
--------------------------------------------------------------------------------
2
-- Company: University of Vigo
3
-- Engineer:  L. Jacobo Alvarez Ruiz de Ojeda
4
--
5
-- Create Date:    17:58:19 10/17/06
6
-- Design Name:    
7
-- Module Name:    shift9_LR - Behavioral
8
-- Project Name:   
9
-- Target Device:  
10
-- Tool versions:  
11
-- Description: 9 bits shift register with parallel load of the 8 least significant bits, independent load
12
-- for the 9th bit, shift_enable control signal and right shifting (through LSB output).
13
--
14
-- Dependencies:
15
-- 
16
-- Revision:
17
-- Revision 0.01 - File Created
18
-- Additional Comments:
19
-- 
20
--------------------------------------------------------------------------------
21
library IEEE;
22
use IEEE.STD_LOGIC_1164.ALL;
23
use IEEE.STD_LOGIC_ARITH.ALL;
24
use IEEE.STD_LOGIC_UNSIGNED.ALL;
25
 
26
---- Uncomment the following library declaration if instantiating
27
---- any Xilinx primitives in this code.
28
--library UNISIM;
29
--use UNISIM.VComponents.all;
30
 
31
entity shift9_LR is
32
    Port ( clk : in std_logic;
33
           reset : in std_logic;
34
           load_8_lsb_bits : in std_logic;
35
                          load_msb_bit : in std_logic;
36
           data_in : in std_logic_vector(7 downto 0);
37
                          msb_in: in std_logic;
38
           shift_enable : in std_logic;
39
                          q_shift: out std_logic_vector(8 downto 0);
40
           lsb_out : out std_logic
41
                          );
42
end shift9_LR;
43
 
44
architecture Behavioral of shift9_LR is
45
 
46
signal q_shift_aux: std_logic_vector (8 downto 0);
47
 
48
begin
49
 
50
-- Signal assignment
51
q_shift <= q_shift_aux;
52
 
53
process (clk, reset, load_8_lsb_bits, load_msb_bit, shift_enable, q_shift_aux)
54
begin
55
   if reset ='1' then
56
      q_shift_aux <= "000000000";
57
   elsif clk'event and clk='1' then
58
                if shift_enable = '0' then
59
 
60
                        if load_8_lsb_bits = '1' then
61
                q_shift_aux (7 downto 0) <= data_in;
62
                        end if;
63
 
64
                        if load_msb_bit = '1' then
65
                q_shift_aux (8) <= msb_in;
66
                        end if;
67
 
68
                else
69
                        q_shift_aux <= '0' & q_shift_aux (8 downto 1);
70
      end if;
71
   end if;
72
lsb_out <= q_shift_aux (0);
73
 
74
end process;
75
 
76
end Behavioral;

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.