【发布时间】:2018-12-11 10:21:58
【问题描述】:
这是我的代码的样子...(我知道它不能编译,它只是伪代码。)
signal lowBound : std_logic_vector(15 downto 0);
signal highBound : std_logic_vector(15 downto 0);
signal result_01 : std_logic_vector(15 downto 0);
signal result_02 : std_logic_vector(15 downto 0);
signal result_03 : std_logic_vector(15 downto 0);
...
p_state_machine: process(RESET, CLK)
if (RESET = '1') then
...
elsif (rising_edge(CLK_I)) then
case currentState is
when ...
...
when OUTPUT =>
-- check if results are within interval bounds
-- option 1
if ((result_01 > lowBound) AND (result_02 > lowBound) AND (result_03 > lowBound) AND ...) then
...
end if;
-- option 2
if ((result_01 > lowBound) then
if ((result_02 > lowBound) then
if ((result_03 > lowBound) then
...
end if;
end if;
end if;
end case;
end if;
end process;
如您所见,我有一个状态机,希望在最后一个状态“输出”中输出结果 1-3,但前提是它们在给定的间隔范围内。所以现在我有 6 个条件需要检查。如果全部为真,我输出结果 1-3;如果至少有一个是假的,我想设置一个错误标志。
我正在使用 25MHz 的 Xilinx 开发板,但我希望拥有一个能够处理更高频率的稳健设计。
所以现在我的问题...检查结果 1-3 是否在给定范围内的最佳方法是什么? 1. 我知道有多种选择,但哪一种是最好的,尤其是在考虑时机时? 2. 我的代码中的选项 1 和 2 是否转换为相同的硬件,还是有区别? 3. 因为我处理的是 16 位向量,所以在状态机之外的单独(并行)进程中检查这些条件对我来说更好吗? (我想有 6 个嵌套的 16 位比较可能会导致时间问题!?)
我对 VHDL 相当陌生(刚毕业),非常感谢您的帮助。谢谢:)
【问题讨论】:
标签: if-statement vhdl fpga timing synthesis