이 구조 카운터는 다음과 같이 계산해야합니다. 0 ... 9 0 ... 9 0..3 그리고 다시 ... 내 문제는 gtk 웨이브에 문제가 있다고 생각합니다. 카운터 2에서만! 나는 이 VHDL 코드에 무슨 문제가 있습니까?
circuit.. http://www.cromo-pharma.it/circuito.jpg
이 ---------component instantiations-----------
signal sR2, sE2, sR1 : std_logic;
signal s2, s3, s8 : std_logic;
signal s0sec, s1sec, s2sec : std_logic;
signal c1out, c2out : std_logic_vector (3 downto 0);
signal dec1out, dec2out : std_logic_vector(15 downto 0);
begin
i2: counter1 port map (clk => clk, reset => sR1, count1 => c1out);
i3: counter2 port map (clk => clk, reset => sR2, en2 => sE2, count2 => c2out);
i5: deco port map (binary_in => c1out, decoder_out => dec1out);
i6: deco port map (binary_in => c2out, decoder_out => dec2out);
sR1 <= ((s8 and (s0sec or s1sec)) or (s2sec and s2)) or reset;
sR2 <= (s2 and s2sec);
sE2 <= s8;
s2 <= dec1out(2); --_a _b c _d 0010
s3 <= dec1out(3); --_a _b c d 0011
s8 <= dec1out(8); -- a _b _c _d 1000
s0sec <= dec2out(0); -- _a _b _c _d 0000
s1sec <= dec2out(1); -- _a _b _c d 0001
s2sec <= dec2out(2); -- _a _b c _d 0010
i4: data_out <= c1out;
---------------end----------------
--decoder--
architecture dec of deco is
begin
decoder_out <= "1000000000000000" when binary_in="1111" else
"0100000000000000" when binary_in="1110" else
"0010000000000000" when binary_in="1101" else
"0001000000000000" when binary_in="1100" else
"0000100000000000" when binary_in="1011" else
"0000010000000000" when binary_in="1010" else
"0000001000000000" when binary_in="1001" else
"0000000100000000" when binary_in="1000" else
"0000000010000000" when binary_in="0111" else
"0000000001000000" when binary_in="0110" else
"0000000000100000" when binary_in="0101" else
"0000000000010000" when binary_in="0100" else
"0000000000001000" when binary_in="0011" else
"0000000000000100" when binary_in="0010" else
"0000000000000010" when binary_in="0001" else
"0000000000000001" when binary_in="0000" else
"XXXXXXXXXXXXXXXX";
end architecture dec;
--counter with enable--
entity counter2 is
port ( clk : in std_logic;
reset : in std_logic;
count2 : out std_logic_vector (3 downto 0);
en2 : in std_logic
);
end entity counter2;
architecture RTL of counter2 is
begin
process (clk, reset, en2) is -- processo di verifica
variable cnt : unsigned(3 downto 0);
begin
if reset = '1' then cnt := (others => '0');
elsif rising_edge(clk) and en2='1' then
if en2 = '1' then cnt := cnt + 1;
end if;
end if;
count2 <= std_logic_vector(cnt);
end process;
--standard counter--
entity counter1 is
port ( clk : in std_logic;
reset : in std_logic;
count1 : out std_logic_vector (3 downto 0)
);
end entity counter1;
architecture RTL of counter1 is
begin
process (clk, reset) is -- processo di verifica
variable cnt : unsigned(3 downto 0);
begin
if reset = '1' then cnt := (others => '0');
elsif rising_edge(clk) then cnt := cnt + 1;
end if;
count1 <= std_logic_vector(cnt);
end process;
sR1, sR2, sE2를 지정할 때 표현식을 두 번 확인 했습니까? 그들은 쉽게 이해할 수 없기 때문에 몇 가지 주석을 추가하거나 간단한 코드를 작성하는 것이 좋습니다. – Philippe
무엇이 문제입니까? 그것이 잘못된 행동으로 보입니까? 파형의 그림이나 신호 값 시퀀스를 게시하고 다른 점을 지적 할 수 있습니까? –
@MartinThompson 안녕하세요! 대답 해줘서 고마워. 카운터 1에 대한 모든 연결은 잘 작동합니다 (R1 신호 제외). counter2에 대한 모든 연결은 gtkwave에서 빨간색 값 ("U")으로 반환됩니다. 나는 왜 그런지 이해하지 못한다. 이것이 도움이되지 않는다면 나는 파형으로부터 스크린을 넣을 것입니다! 감사. –