我试图用“VHDL”编写一些非常简单的东西。但我已经坚持了几个小时,我无法找到一种方法让它发挥作用。
我试图找到一种方法在不同的过程中使用相同的信号或将它们组合成一个过程。 在不同的过程中使用信号是不可能的,如果我将它们组合成一个过程,我会收到错误“与标准触发器不匹配”。我希望这里有人可以帮助我,并说我如何解决这个问题。
示例代码;
process(scan_ready,rc5_ready)
variable welkescan : std_logic_vector(1 downto 0);
begin
if (scan_ready' event and scan_ready = '0') and not((rc5_ready' event and rc5_ready = '0')) then
welkescan := "01";
visualisatiegebruikt <= "0001";
visualisatiecode <= scan_code;
elsif (rc5_ready' event and rc5_ready = '0') and not((scan_ready' event and scan_ready = '0')) then
welkescan := "10";
visualisatiegebruikt <= "0010";
visualisatiecode <= scan_con;
else
welkescan := "00";
end if;
if ((welkescan = "01" and scan_code = "01110010") or (welkescan = "10" and scan_code = "00100001")) and (pwm_on /= "11111100") then
pwm_on <= pwm_on + 28;
visualisatiepwm <= visualisatiepwm + "0001";
elsif ((welkescan = "01" and scan_code = "01110101") or (welkescan = "10" and scan_code = "00100000")) and (pwm_on /= "00000000") then
pwm_on <= pwm_on - 28;
visualisatiepwm <= visualisatiepwm - "0001";
end if;
end process;
我还尝试了代码示例:
process(scan_ready)
begin
if scan_ready' event and scan_ready = '0' then
visualisatie <= "0001"; -- 1 op display => toetsenbord
scanwaarde(3 downto 0) <= scan_code(3 downto 0);
scanwaarde(7 downto 4) <= scan_code(7 downto 4);
if scan_code = "01110010" and pwmaansturen /= "11111100" then
pwmaansturen <= pwmaansturen + 28;
visualisatiepwm <= visualisatie + "0001";
elsif scan_code = "01110101" and pwmaansturen /= "00000000" then
pwmaansturen <= pwmaansturen - 28;
visualisatiepwm <= visualisatie - "0001";
elsif scan_code = "01110100" then
pwmaansturen <= "11111100";
visualisatiepwm <= "1001";
elsif scan_code = "01101011" then
pwmaansturen <= "00000000";
visualisatiepwm <= "0000";
end if;
end if;
end process;
process(rc5_ready)
begin
if rc5_ready' event and rc5_ready = '0' then
visualisatie <= "0010"; -- 2 op display => afstandsbediening
scanwaarde(3 downto 0) <= scan_con(3 downto 0);
scanwaarde(7 downto 4) <= scan_con(7 downto 4);
if scan_con = "00100001" and pwmaansturen /= "11111100" then
pwmaansturen <= pwmaansturen + 28;
visualisatiepwm <= visualisatie + "0001";
elsif scan_con = "00100000" and pwmaansturen /= "00000000" then
pwmaansturen <= pwmaansturen - 28;
visualisatiepwm <= visualisatie - "0001";
elsif scan_con = "00010110" then
pwmaansturen <= "11111100";
visualisatiepwm <= "1001";
elsif scan_con = "00010111" then
pwmaansturen <= "00000000";
visualisatiepwm <= "0000";
end if;
end if;
end process;
我希望有人可以帮助我。 问候。
答案 0 :(得分:1)
此代码有多个问题。
首先,所有这些代码都不可综合。使用用于仿真的硬件描述语言,对于真实的硬件描述和综合,要求设计人员使用多种编码模式,以便工具可以将其转换为网表和门。
不可合成代码的主要原因:
not(clock'event ...)
。其他提示和问题:
scan_ready
和rc5_ready
两个时钟信号?