Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Components in if-else statement

34 views
Skip to first unread message

tushar sharma

unread,
May 10, 2022, 2:33:22 PM5/10/22
to
I am trying to make a cube computation circuit using Vedic Algorithms.
The code is as follows:
--------------MAIN FILE-------------------
library IEEE;
use IEEE.std_logic_1164.all;
use IEEE.std_logic_unsigned.ALL;
entity major_8_bit is

port(
N: in std_logic_vector(7 downto 0);
Result: out std_logic_vector(23 downto 0));


end major_8_bit;

architecture RTL of major_8_bit is

component compare
port( N: in std_logic_vector(7 downto 0);
enable: out std_logic);
end component;


component cubeComputation8bit_YES
port(
N: in std_logic_vector(7 downto 0);
Result: out std_logic_vector(23 downto 0));
end component;

component cubeComputation8bit_NO
port(
N: in std_logic_vector(7 downto 0);
Result: out std_logic_vector(24 downto 0));
--to concatenate the carry bit generated from 24bit BA at the 24th index (starting from 1)
end component;
--signals
signal R: std_logic_vector( 7 downto 0);
signal R2: std_logic_vector (7 downto 0):="00001111";
signal ResultNo: std_logic_vector( 24 downto 0);
signal EnableSignal: std_logic;
begin
R <= 100000000 - N;
--enable <= EnableSignal;

Comp: compare port map( N, EnableSignal);


YesCase: if(EnableSignal = '1') generate -- YES CASE
CP1: cubeComputation8bit_YES port map (N,Result);
end generate YesCase;
NoCase: if(EnableSignal = '0') generate
CP2: cubeComputation8bit_NO port map(N=>N,Result=> ResultNo);
end generate NoCase;
end;
*********************
There is no syntax error being reported, but the code is not simulating because of the components used in the if-else statement (Saw this method on stackoverflow)
The two components cubeComputation8bit_Yes and cubeComputation8bit_NO are working correctly independently. But not when put together this way.

Any help will be highly appreciated.
Regards.

Nicolas Matringe

unread,
May 16, 2022, 4:10:40 PM5/16/22
to
On 5/10/22 18:33, tushar sharma wrote:
> I am trying to make a cube computation circuit using Vedic Algorithms.
> The code is as follows:
[...]
> *********************
> There is no syntax error being reported, but the code is not simulating because of the components used in the if-else statement (Saw this method on stackoverflow)
> The two components cubeComputation8bit_Yes and cubeComputation8bit_NO are working correctly independently. But not when put together this way.

You can not use the "if <...> generate" with a signal. It doesn't make
any sense.
Your code doesn't make much sense either. It looks like you're using
VHDL as a programming language, which it is definitely not.

Nicolas
0 new messages