0 / 0 / 0
Регистрация: 23.03.2013
Сообщений: 16
|
|
1 | |
Система синхронной последовательной связи09.06.2015, 18:50. Показов 801. Ответов 2
Метки нет (Все метки)
Помогите пожалуйста!
В передатчике и приемнике есть 4 суб-компоненты, которые соединяютsa модулем FSM: счетчик, регистр сдвига, FIFO, бит четности. Пожалуйста, проверьте, в частности, rx_fifo tx_fifo, rx_count, tx_count. Cамая большая проблема c FSM. Пока что выкладываю только модули приемника. ------------------------------------------------------------------- ------------------------ RX-------------------------------------- -------------shift_reg ------------------------------------------------------------------- Код
library ieee; use ieee.std_logic_1164.all; use ieee.numeric_std.all; entity rx_shift is generic(N:integer:=7); port(rst:in std_logic; -- rx_in : in std_logic; rx_data: out std_logic_vector(N-1 downto 0); rx_ck:in std_logic; uload, shift: in std_logic); -- rx_enable: in std_logic; -- rx_empty: out std_logic); end rx_shift; architecture rx_shift_arch of rx_shift is signal shift_reg : std_logic_vector(N-1 downto 0); begin process (rst, rx_ck) begin if (rst = '0') then shift_reg <= (others => '0'); elsif (rising_edge(rx_ck)) then if (uload = '1') then rx_data <= shift_reg; elsif (shift = '1') then shift_reg(N-1 downto 1) <= shift_reg(N-2 downto 0); shift_reg(0) <= '0'; end if; end if; end process; end architecture; -------------counter ------------------------------------------------------------------- Код
library ieee; use ieee.std_logic_1164.all; use ieee.numeric_std.all; use ieee.std_logic_unsigned.all; entity rx_count is generic(N:integer:=7); port(rst:in std_logic; -- rx_in : in std_logic; rx_ck:in std_logic; uload: in std_logic; rx_enable: in std_logic); -- rx_empty: out std_logic); end rx_count; architecture rx_cnt_arch of rx_count is signal rx_cnt :std_logic_vector(3 downto 0); signal rx_pust :std_logic; begin process (rst,rx_ck) begin if (rst = '0') then rx_cnt <= (others => '0'); rx_pust <= '1'; elsif (rising_edge(rx_ck)) then if (uload = '1') then rx_pust <= '1'; end if; if (rx_enable = '1') then rx_cnt <= rx_cnt + 1; end if; end if; end process; rx_out <= rx_cnt; ---- ???????? end architecture; -------------FIFO ------------------------------------------------------------------- Код
library ieee; use ieee.std_logic_1164.all; use ieee.numeric_std.all; use ieee.std_logic_unsigned.all; entity rx_fifo is generic(N:integer:=7); port(rst:in std_logic; rx_in : in std_logic_vector(N-1 downto 0); rx_data :out std_logic_vector(N-1 downto 0); rx_ck:in std_logic; uload: in std_logic); -- rx_enable: in std_logic; -- rx_empty: out std_logic); end rx_fifo; architecture rx_fifo_arch of rx_fifo is signal next_state, state: std_logic_vector(N-1 downto 0); begin process (rx_ck,rst) begin if (rst='0') then next_state <= (others => '0'); elsif (rising_edge(rx_ck)) then state <= rx_in; if (uload='1') then rx_data <= state; end if; end if; end process; process (state) begin next_state <= state; if(uload='1') then rx_data <= next_state; end if; end process; --- out ????? end rx_fifo_arch; -------------Parity Bit ------------------------------------------------------------------- Код
library ieee; use ieee.std_logic_1164.all; use ieee.numeric_std.all; use ieee.std_logic_unsigned.all; entity rx_pb is generic(N: integer:=7); port(rst:in std_logic; -- rx_in : in std_logic_vector(N-1 downto 0); rx_data :out std_logic_vector(N-1 downto 0); rx_ck:in std_logic; rx_parity: in std_logic); -- uload: in std_logic); --- rx_enable: in std_logic; -- rx_empty: out std_logic); end rx_pb; architecture rx_pb_arch of rx_pb is signal parity_out: std_logic; begin process (rx_ck,rst) begin if (rst='0') then parity_out <= '1'; elsif (rising_edge(rx_ck)) then if (rx_parity='0') then parity_out <= not parity_out; end if; end if; end process; rx_data(0) <= parity_out; end rx_pb_arch; -------------FSM ------------------------------------------------------------------- Код
library ieee; use ieee.std_logic_1164.all; use ieee.numeric_std.all; entity rx_fsm is generic(N:integer:=7); port( clk_fsm : in std_logic; rst_fsm : in std_logic; rx : in std_logic; par_en : in std_logic; rx_ready : out std_logic; rx_data_fsm : out std_logic_vector(7 downto 0) ); end rx_fsm; architecture rx_arch of rx_fsm is constant IDLE : std_logic := '1'; constant SB : std_logic := '1'; constant PARITY_EN : std_logic := '1'; type state is (idle,data,parity,stop); signal rx_fsm : state; -- signal rx_clk_en : std_logic; signal rx_en : std_logic; signal rx_par_bit : std_logic; -- signal rx_data_deb : std_logic; -- signal rx_data_tmp : std_logic_vector(7 downto 0); ----------------- -- signal rx_data_cnt : std_logic_vector(2 downto 0); ---------------------- component rx_shift is generic(N:integer:=7); port(rst:in std_logic; -- rx_in : in std_logic; rx_data: out std_logic_vector(N-1 downto 0); rx_ck:in std_logic; uload, shift: in std_logic); -- rx_enable: in std_logic; -- rx_empty: out std_logic); end component; component rx_fifo is generic(N:integer:=7); port(rst:in std_logic; rx_in : in std_logic_vector(N-1 downto 0); rx_data :out std_logic_vector(N-1 downto 0); rx_ck:in std_logic; uload: in std_logic); -- rx_enable: in std_logic; -- rx_empty: out std_logic); end component; component rx_count is generic(N:integer:=7); port(rst:in std_logic; -- rx_in : in std_logic; rx_ck:in std_logic; uload: in std_logic; rx_enable: in std_logic); -- rx_empty: out std_logic); end component; component rx_pb is generic(N:integer:=7); port(rst:in std_logic; -- rx_in : in std_logic_vector(N-1 downto 0); rx_data :out std_logic_vector(N-1 downto 0); rx_ck:in std_logic; rx_parity: in std_logic; uload: in std_logic); --- rx_enable: in std_logic; -- rx_empty: out std_logic); end component; begin D1: rx_shift port map ( rst => rst_fsm, rx_data => rx_data_fsm, rx_ck => clk_fsm, uload => shift => ); D2: rx_fifo port map ( rst => rst_fsm, rx_in => rx, rx_data => rx_data_fsm, rx_ck => clk_fsm, uload => ); D3: rx_count port map ( rst => rst_fsm, rx_ck => clk_fsm, uload => rx_enable => rx_en ); D4: rx_pb port map ( rst => rst_fsm, rx_data => rx_par_bit, --- rx_data_fsm ????????????????? rx_ck => clk_fsm, rx_parity => par_en, uload => ); RX_a: process(clk) begin if clk'event and clk = '1' then rx_ready <= '0'; case rx_fsm is when idle => if rx_data_deb = SB then ----------???????????? rx_fsm <= data; end if; rx_par_bit <= '0'; -- rx_data_cnt <= (others=>'0'); when data => if par_en = PARITY_EN then rx_fsm <= parity; else rx_ready <= '1'; rx_fsm <= idle; end if; rx_en <= '1'; when parity => rx_fsm <= idle; if rx_par_bit = rx then rx_ready <= '1'; end if; when others => null; end case; if rst = RST_LVL then rx_fsm <= idle; rx_ready <= '0'; rx_data <= (others=>'0'); -- rx_data_tmp <= (others=>'0'); -- rx_data_cnt <= (others=>'0'); end if; end if; end process; end rx_arch;
0
|
09.06.2015, 18:50 | |
Ответы с готовыми решениями:
2
D-триггер с синхронной предустановкой Спутниковая система связи и допплеровский эффект Цифровая система связи в Simulink Задача на кинематические связи. Система блоков |
0 / 0 / 0
Регистрация: 23.03.2013
Сообщений: 16
|
|
09.06.2015, 23:11 [ТС] | 3 |
В counter i FIFO нужно сигнал на выход послать, а не совпадают размеры - то std_logic_vector i std_logic
+ modul FSM вообще походу не правильно написала и не знаю как к каким сигналам приписать, соотнести с сигналами из компонентов Добавлено через 2 часа 32 минуты Суть в том что rx_in в FIFO i Counter должен быть типа std_logic, хотя параллельно с тем данные как тогда написать: и в ФИФО тоже - как на выход послать?? ====================================================================== Добавлено через 1 минуту а в FSM в целом по моему не так написан((( + уверена что лево привязала переменные с port(); FSM до переменных port(); компнентов
0
|
09.06.2015, 23:11 | |
09.06.2015, 23:11 | |
Помогаю со студенческими работами здесь
3
Система передачи данных. Дуплексный канал связи Метод синхронной фильтрации Отличие BackgroundWorker от асинхронной (синхронной) многопоточности ПО для синхронной замены текста на сайте и в SharePoint Как реализовать метод синхронной фильтрации сигнала Помощь: Работа синхронной машины в режиме генератора! Искать еще темы с ответами Или воспользуйтесь поиском по форуму: |