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

Subversion Repositories modbus

[/] [modbus/] [trunk/] [enlace/] [lrc.vhd] - Blame information for rev 4

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 3 guanucolui
----------------------------------------------------------------------------------
2
-- Company: 
3
-- Engineer: 
4
-- 
5
-- Create Date:    09:41:27 03/30/2010 
6
-- Design Name: 
7
-- Module Name:    lrc - Behavioral 
8
-- Project Name: 
9
-- Target Devices: 
10
-- Tool versions: 
11
-- Description: 
12
--
13
-- Dependencies: 
14
--
15
-- Revision: 
16
-- Revision 0.01 - File Created
17
-- Additional Comments: 
18
--
19
----------------------------------------------------------------------------------
20
library IEEE;
21
use IEEE.STD_LOGIC_1164.ALL;
22
use IEEE.STD_LOGIC_ARITH.ALL;
23
use IEEE.STD_LOGIC_UNSIGNED.ALL;
24
 
25
---- Uncomment the following library declaration if instantiating
26
---- any Xilinx primitives in this code.
27
--library UNISIM;
28
--use UNISIM.VComponents.all;
29
 
30
entity lrc is
31
        port(
32
                        clk             :in std_logic;
33
                        reset   :in std_logic;
34
                        trama   :in std_logic;
35
                        dato_ok :in std_logic;
36
                        dato            :in std_logic_vector(7 downto 0);
37
                        lrc_ok  :out std_logic);
38
end lrc;
39
 
40
architecture Behavioral of lrc is
41
 
42
signal acumulador : std_logic_vector(7 downto 0);
43
begin
44
 
45
SUMADOR:process (clk,reset)
46
begin
47
   if reset='1' then
48
         acumulador <= (others=>'0');
49
   elsif clk ='1' and clk'event then
50
                if trama = '1' then
51
                        if dato_ok='1'then --tener presente que data_ok debe permanecer SOLO 1 clk
52
                                acumulador <= acumulador + dato;
53
                        end if;
54
                elsif acumulador = "00000000" then
55
                        lrc_ok <= '1';
56
                else
57
                        lrc_ok <= '0';
58
                end if;
59
   end if;
60
end process SUMADOR;
61
 
62
end Behavioral;
63
 

powered by: WebSVN 2.1.0

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