mercredi 1 avril 2015

VHDL if statements in process driving multiple outputs per if statement

I have a weird question which sounds self explanatory in vhdl, but the code does not output to an oscilloscope even though the logic seems okay. I need to drive 0's and 1's for each bit in the vector below, and I need to do this with combinations of sliderswitches. I am using the Digilent Nexys 3.


My problem is that when I run this code or any code that has more than 3 outputs per if statement, one of the outputs does not output to logic '1' when given the right combination.


I gave my code below, which seems extremely simple. Can someone tell me why I can only output 3 things per if statement? I need to be able to output 20 or more signals per if statement.


I have tried everything I can think of, from using bit_vector, to using different syntax. Any help on why I can only get 3 outputs at most would be greatly appreciated.



Library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
use work.all ;


entity pulse_gen_toVGA is port (
clk_50,sw0,sw1,sw2,sw3 : in std_logic ;
rst : in std_logic;
output : out std_logic_vector(3 downto 0));


end pulse_gen_toVGA;

architecture top of pulse_gen_toVGA is


begin



process(sw0,sw1,sw2,sw3)
begin

if (sw0='0' and sw1='0' and sw2='0' and sw3='0') then
null;
end if;

if(sw0='1') then
output<="0001";
elsif(sw1='1') then
output<="0010";
elsif(sw2='1') then
output<="0100";
elsif(sw3='1') then
output<="1000";
end if;


end process;

end top ;

Aucun commentaire:

Enregistrer un commentaire