以下是在总线上发送串行数据。COUNT 在时钟的上升沿递增。在不同的过程中,如果同步信号为高,则索引 COUNT 是什么。为什么像 23 - COUNT 这样的索引值被标记为非法
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
entity XYZ is
port( reset : in std_logic;
clock : in std_logic;
DATA_IN : in std_logic;
SYNC_SIG : in std_logic;
DATA_OUT : out std_logic_vector(23 downto 0));
end XYZ;
architecture rtl of XYZ is
signal COUNT : integer range 0 to 45 := 0;
begin
COUNTER: process(RESET, CLOCK)
BEGIN
If reset = '1' then
COUNT <= 0;
elsif rising_edge(clock) then
COUNT <= COUNT + 1;
if COUNT = 45 then
COUNT <= 0;
end if;
end if;
end process counter;
INC: process(SYNC_SIG, COUNT)
begin
if (SYNC_SIG = '1') then
DATA_OUT(23 - COUNT) <= DATA_IN;
end if;
end process INC;
end rtl;