How to declare an output with multiple zeros in VHDL

BugShotGG picture BugShotGG · Jan 24, 2012 · Viewed 62.7k times · Source

Hello i am trying to find a way to replace this command: Bus_S <= "0000000000000000000000000000000" & Ne; with something more convenient. Counting zeros one by one is not very sophisticated. The program is about an SLT unit for an ALU in mips. The SLT gets only 1 bit(MSB of an ADDSU32) and has an output of 32 bits all zeros but the first bit that depends on the Ne=MSB of ADDSU32. (plz ignore ALUop for the time being)

entity SLT_32x is
   Port ( Ne : in  STD_LOGIC;
         ALUop : in STD_LOGIC_VECTOR (1 downto 0);
         Bus_S : out  STD_LOGIC_VECTOR (31 downto 0));
end SLT_32x;

architecture Behavioral of SLT_32x is
begin
  Bus_S <= "0000000000000000000000000000000" & Ne; 
end Behavioral;

Is there a way to use (30 downto 0)='0' or something like that? Thanks.

Answer

Philippe picture Philippe · Jan 24, 2012

Try this: bus_S <= (0 => Ne, others => '0') It means: set bit 0 to Ne, and set the other bits to '0'.