alikaradag
Newbie level 6
- Joined
- Nov 9, 2014
- Messages
- 11
- Helped
- 1
- Reputation
- 2
- Reaction score
- 0
- Trophy points
- 1
- Activity points
- 122
Hi all,
Am a new member here and hope to learn a lot from this esteemed website.
I have a vhdl code that compiles fine. The only issue is am not sure about the shape of the wave form because my Web Edition Quartus doesn't allow me to do so. Can any one help me to see the waveform shape for my code please?
the code is
Am a new member here and hope to learn a lot from this esteemed website.
I have a vhdl code that compiles fine. The only issue is am not sure about the shape of the wave form because my Web Edition Quartus doesn't allow me to do so. Can any one help me to see the waveform shape for my code please?
the code is
Code VHDL - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 library IEEE; use IEEE.STD_LOGIC_1164.all; use IEEE.STD_LOGIC_unsigned.all; entity traffic_light is port (clk: in STD_LOGIC; clr: in STD_LOGIC; lights: out STD_LOGIC_VECTOR (5 downto 0)); end traffic_light; architecture traffic_light of traffic_light is type state_type is (s0, s1, s2, s3); signal state: state_type; signal count: STD_LOGIC_VECTOR(3 downto 0); constant SEC6: STD_LOGIC_VECTOR(4 downto 0) := "11001" ; constant SEC1: STD_LOGIC_VECTOR(4 downto 0) := "00100"; begin process (clk, clr) begin if clr = '1' then state <= s0; count <= X"0"; elsif clk'event and clk = '1' then case state is when s0 => if count < SEC6 then state <= s0; count <= count + 1; else state <= s1; count <= X"0"; end if ; when s1 => if count < SEC1 then state <= s1; count <= count + 1; else state <= s2; count <= count + 1; end if ; when s2 => if count < SEC6 then state <= s2; count <= count + 1; else state <= s3; count <= X"0"; end if; when s3 => if count < SEC1 then state <= s3; count <= X"0"; else state <= s0; count <= X"0"; end if ; when others => state <= s0; end case; end if; end process ; C2: process (state) begin case state is when s0 => lights <= "100001"; when s1 => lights <= "010001"; when s2 => lights <= "001100"; when s3 => lights <= "001010"; when others => lights <= "100001"; end case; end process; end traffic_light; library ieee; use ieee.std_logic_1164.all; entity traffic_light_top is port ( clk : in STD_LOGIC; btn : in STD_LOGIC_VECTOR(3 downto 3); ld : out STD_LOGIC_VECTOR(7 downto 2)); end traffic_light_top; architecture traffic_light_top_arc of traffic_light_top is component clkdiv is port ( mclk : in STD_LOGIC; clr : in STD_LOGIC; clk3 : out STD_LOGIC ); end component ; component traffic is port (clk: in STD_LOGIC; clr: in STD_LOGIC; lights: out STD_LOGIC_VECTOR(5 downto 0)); end component; signal clr, clk3: STD_LOGIC; begin clr <= btn(3); U1: clkdiv port map ( mclk => clk, clr => clr, clk3 => clk3 ); U2: traffic port map ( clk=>clk3, clr=>clr, lights=>ld ); end traffic_light_top_arc;
Last edited by a moderator: