クロック入力と出力が5つのLEDシーケンスをとるVHDLシーケンスを作成する必要がありますsee picture std_logic_vectorを使用すると、各ベクトル出力を1つのLEDに接続できますこのシーケンスを作成するために注文するか、std_logic_vectorの使用を解釈しないのですか?VHDLクロックシーケンスQ3
私が使用しているコードは、私は、波形シミュレートしている
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
use ieee.numeric_std.all; -- i have used this package as my CLK-CNT signal counts in integer format rather than binary and i am performing an ADD sum of the CLK_CNT
entity REG_LED is
PORT(CLK: IN std_logic; -- CLK input
LEDS: Out std_logic_vector (4 downto 0)); -- initialise output
End REG_LED;
ARCHITECTURE behavioral OF REG_LED IS
SIGNAL CLK_CNT: integer range 0 to 9:= 0; -- initailise comparison signal used for counting clock pulses.
-- This signal will be used by the program to recognise where in the sequnce the program is and thus determine the next state required for the sequence.
BEGIN
CLK_Process: PROCESS (CLK) -- begin the CLK_CNT Process
BEGIN
if rising_edge(CLK) Then
if CLK_CNT = 8 then
CLK_CNT <= 0; -- this resets the clock pulse count to 0
else
CLK_CNT <= CLK_CNT + 1 ; -- used to count each clock pulse upto the reset
End if;
-- this process has been kept seperate to the LED output process in order to isolate the event from the output process and limit the possiblities of errors
END IF;
END PROCESS ;
LED_PROCESS: Process (CLK_CNT) -- LED Outputs based on Temp count
BEGIN -- begin the output sequence
Case CLK_CNT is
-- i use a case statement to compare the value of the CLK_CNT signal and produce the required LEDS output
-- this ensures the
When 0 =>
LEDS <= "11111"; -- S0 when clock count is 0
When 1 =>
LEDS <= "00001"; -- S1 when clock count is 1
When 2 =>
LEDS <= "00001"; -- S2 when clock count is 2
When 3 =>
LEDS <= "11111"; -- S3 when clock count is 3
When 4 =>
LEDS <= "00000"; -- S4 when clock count is 4
When 5 =>
LEDS <= "11111"; -- S5 when clock count is 5
When 6 =>
LEDS <= "00100"; -- S6 when clock count is 6
When 7 =>
LEDS <= "01010"; -- S7 when clock count is 7
When 8 =>
LEDS <= "10001"; -- S8 when clock count is 8 this is the final clock count state
When others =>
LEDS <= "11111"; -- Restart Sequence
End Case;
End Process;
END behavioral;
であり、それは配列で必要とされるが、この出力は5個の異なるLEDを駆動するためにbeusedことができ、またはそれはわずか5になるように5出力を生成します1つのポートの出力であるビットワード? VHDLに新しいので、助けていただければ幸いです
ポートの各ビットに1つのLEDを接続すると、5個のLEDが駆動されます。 –