Syntax error near "when"

Status
Not open for further replies.

mo.khairy.mo

Member level 2
Joined
Dec 17, 2008
Messages
47
Helped
1
Reputation
2
Reaction score
0
Trophy points
1,286
Location
Egypt
Activity points
1,548
hi all
what's the error in this vhdl code

Code:
when (opcode = addu) =>
	   I0 : int_2s_add_sub
      PORT MAP (
         clk           => clk,
	 enable      => '1',
         rst           => rst,
         opa         => opa,
         opb         => opb,
         M	       => '0',
         OVF 	       => flags(5),
         opc 	       => opc
      );


if i need to port map some components depend on conditions how can i do it?


thanks in advance
 

use block statement . depending on the "guarded " condition assignment will take place
 

Hi,

Use the generate statement instead of your when:

g0: if (opcode = addu) generate
I0 : int_2s_add_sub
PORT MAP (
clk => clk,
enable => '1',
rst => rst,
opa => opa,
opb => opb,
M => '0',
OVF => flags(5),
opc => opc
);
end generate;
 
thanks all
@balavinayagam
could u please support me with an example
@devas
i try what u suggest and i have the following error
"generate condition is not constant"
how can i fix it ?!
 

Hi,

That's a problem. The generate condition must be static, i.e. it cannot include signals. I was forgotten this. I do not know if you can change the condition so it becomes static. Maybe the block suggestion will work but I have never used block statements so I have no idea.

Success, Devas
 
Hi,

please could u explain what do u mean with static?!
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…