| Форум РадиоКот https://radiokot.ru/forum/ |
|
| РОН: переключение контекста VHDL (Quartus) https://radiokot.ru/forum/viewtopic.php?f=60&t=81152 |
Страница 1 из 1 |
| Автор: | serg130191 [ Сб ноя 24, 2012 15:39:16 ] |
| Заголовок сообщения: | РОН: переключение контекста VHDL (Quartus) |
Написал, регистр общего назначения для АЛУ, потом дописал переключение контекста при прерывании: при переходе входного сигнала INTA в высокое состояние - значение регистров сохраняется в дополнительном регистре (reg_buff), при спаде сигнала - наоборот, данные из буферного регистра записываются в РОНы. Код РОН: Код: LIBRARY ieee; USE ieee.std_logic_1164.ALL; USE ieee.numeric_std.all; ENTITY ron IS PORT ( clk : IN std_logic; INTA : IN std_logic; DATA_IN : IN std_logic_vector (11 DOWNTO 0); ADR_REG1 : IN std_logic_vector (3 DOWNTO 0); ADR_REG2 : IN std_logic_vector (3 DOWNTO 0); WE : IN std_logic; DATA_OUT1 : OUT std_logic_vector (11 DOWNTO 0); DATA_OUT2 : OUT std_logic_vector (11 DOWNTO 0) ); END ron; ARCHITECTURE arh OF ron IS type registr is array (0 to 15) of std_logic_vector(11 downto 0); signal reg : registr; signal reg_buff : registr; BEGIN PROCESS(clk) BEGIN IF (clk'event AND clk = '1') THEN IF (WE = '1') THEN reg(to_integer(unsigned(ADR_REG2)))<=DATA_IN; ELSE DATA_OUT1<=reg(to_integer(unsigned(ADR_REG1))); DATA_OUT2<=reg(to_integer(unsigned(ADR_REG2))); END IF; END IF; if(rising_edge(INTA)) then reg_buff<=reg; end if; if(FALLING_EDGE(INTA)) then reg<=reg_buff; end if; END PROCESS; END arh; Но к моему сожалению переключение не работает, Quartus выдаёт след. ошибки: Что можно с этим сделать? Error (10820): Netlist error at ron.vhd(36): can't infer register for reg[15][0] because its behavior depends on the edges of multiple distinct clocks Error (10820): Netlist error at ron.vhd(36): can't infer register for reg[15][1] because its behavior depends on the edges of multiple distinct clocks Error (10820): Netlist error at ron.vhd(36): can't infer register for reg[15][2] because its behavior depends on the edges of multiple distinct clocks Error (10820): Netlist error at ron.vhd(36): can't infer register for reg[15][3] because its behavior depends on the edges of multiple distinct clocks Error (10820): Netlist error at ron.vhd(36): can't infer register for reg[15][4] because its behavior depends on the edges of multiple distinct clocks Error (10820): Netlist error at ron.vhd(36): can't infer register for reg[15][5] because its behavior depends on the edges of multiple distinct clocks Error (10820): Netlist error at ron.vhd(36): can't infer register for reg[15][6] because its behavior depends on the edges of multiple distinct clocks Error (10820): Netlist error at ron.vhd(36): can't infer register for reg[15][7] because its behavior depends on the edges of multiple distinct clocks Error (10820): Netlist error at ron.vhd(36): can't infer register for reg[15][8] because its behavior depends on the edges of multiple distinct clocks Error (10820): Netlist error at ron.vhd(36): can't infer register for reg[15][9] because its behavior depends on the edges of multiple distinct clocks Error (10820): Netlist error at ron.vhd(36): can't infer register for reg[15][10] because its behavior depends on the edges of multiple distinct clocks Error (10820): Netlist error at ron.vhd(36): can't infer register for reg[15][11] because its behavior depends on the edges of multiple distinct clocks Error (10820): Netlist error at ron.vhd(36): can't infer register for reg[14][0] because its behavior depends on the edges of multiple distinct clocks Error (10820): Netlist error at ron.vhd(36): can't infer register for reg[14][1] because its behavior depends on the edges of multiple distinct clocks Error (10820): Netlist error at ron.vhd(36): can't infer register for reg[14][2] because its behavior depends on the edges of multiple distinct clocks Error (10820): Netlist error at ron.vhd(36): can't infer register for reg[14][3] because its behavior depends on the edges of multiple distinct clocks Error (10820): Netlist error at ron.vhd(36): can't infer register for reg[14][4] because its behavior depends on the edges of multiple distinct clocks Error (10820): Netlist error at ron.vhd(36): can't infer register for reg[14][5] because its behavior depends on the edges of multiple distinct clocks Error (10820): Netlist error at ron.vhd(36): can't infer register for reg[14][6] because its behavior depends on the edges of multiple distinct clocks |
|
| Автор: | Meteor [ Сб ноя 24, 2012 16:07:43 ] |
| Заголовок сообщения: | Re: РОН: переключение контекста VHDL (Quartus) |
Первое, что бросилось - два разных фронта Цитата: PROCESS(clk) BEGIN IF (clk'event AND clk = '1') THEN Тут реакция на тактовый сигнал. Цитата: if(rising_edge(INTA)) then А тут на фронт. В процессе Вы не указали что INTA является "отслеживаемым", только CLK. На вашем бы месте я сделал так. Назначил буфер variable inta_v:std_logic_vector(1 downto 0); Далее описал реакцию. inta_v(1):=inta_v(0); inta_v(0):=INTA; if(inta_v="01")then Вот тут реакция на событие. |
|
| Автор: | serg130191 [ Сб ноя 24, 2012 16:41:56 ] |
| Заголовок сообщения: | Re: РОН: переключение контекста VHDL (Quartus) |
Meteor, да полностью с вами согласен, но приведённая вами реакция на событие не подойдёт для моего случая, т.к. я забыл упомянуть, что сигнал INTA "висит" на протяжении всего прерывания. Попробую задать переменную которая будет хранить предыдущее значение сигнала INTA, а затем сравнивать его с текущим. |
|
| Автор: | uldemir [ Сб ноя 24, 2012 19:14:25 ] |
| Заголовок сообщения: | Re: РОН: переключение контекста VHDL (Quartus) |
А кто мешает ввести еще один сигнал, с помощью которого контролировать перепады INTA? |
|
| Страница 1 из 1 | Часовой пояс: UTC + 3 часа |
| Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group http://www.phpbb.com/ |
|


