source: firmware/FTM/ftu_control/FTM_ftu_rs485_receiver.vhd@ 13811

Last change on this file since 13811 was 10175, checked in by weitzel, 14 years ago
first version of FTM_ftu_control, not yet tested
File size: 1.9 KB
Line 
1--
2-- VHDL Architecture FACT_FAD_lib.rs485_receiver.beha
3--
4-- Created:
5-- by - Benjamin Krumm.UNKNOWN (EEPC8)
6-- at - 12:16:57 11.06.2010
7--
8-- using Mentor Graphics HDL Designer(TM) 2009.2 (Build 10)
9--
10--
11-- modified for FTU and FTM design by Q. Weitzel, 13 September 2010
12-- timeout replaced by reset by Q. Weitzel, 04 February 2011
13--
14
15LIBRARY ieee;
16USE ieee.std_logic_1164.all;
17USE ieee.std_logic_arith.all;
18
19library ftm_definitions;
20USE ftm_definitions.ftm_constants.all;
21
22ENTITY FTM_ftu_rs485_receiver IS
23 generic(
24 RX_BYTES : integer := FTU_RS485_BLOCK_WIDTH / 8; -- no. of bytes to receive
25 RX_WIDTH : integer := FTU_RS485_BLOCK_WIDTH
26 );
27 port(
28 rec_clk : in std_logic;
29 rec_reset : in std_logic;
30 --rx_busy : in std_logic;
31 rec_din : in std_logic_vector(7 downto 0);
32 rec_den : in std_logic;
33 rec_dout : out std_logic_vector(RX_WIDTH - 1 downto 0) := (others => '0');
34 rec_valid : out std_logic := '0'
35 );
36END ENTITY FTM_ftu_rs485_receiver;
37
38ARCHITECTURE beha OF FTM_ftu_rs485_receiver IS
39
40 signal rxcnt : integer range 0 to RX_BYTES := 0;
41 signal rxsr : std_logic_vector(3 downto 0) := (others => '0');
42
43BEGIN
44
45 rx_data_proc : process(rec_clk)
46 begin
47 if rising_edge(rec_clk) then
48 rxsr <= rxsr(2 downto 0) & rec_den;
49 if (rec_reset = '1') then
50 rec_dout <= (others => '0');
51 rxcnt <= 0;
52 rec_valid <= '0';
53 else
54 if (rxsr(3 downto 2) = "01") then -- identify rising edge
55 rec_dout((rxcnt*rec_din'length + rec_din'length - 1) downto (rxcnt*rec_din'length)) <= rec_din;
56 rxcnt <= rxcnt + 1;
57 if (rxcnt < RX_BYTES - 1) then
58 rec_valid <= '0';
59 else
60 rxcnt <= 0;
61 rec_valid <= '1';
62 end if;
63 end if;
64 end if;
65 end if;
66 end process rx_data_proc;
67
68END ARCHITECTURE beha;
Note: See TracBrowser for help on using the repository browser.