conditional on a don't care

Joined
Jul 23, 2009
Messages
9
Reaction score
0
Hi,

I have a when-else conditional assignment which contains some don't care values Code is simplified as bellow;

en2 <= '1' when SIG = "010-" else
'1' when SIG ="---1" else
'0';

However, in simulation, en2 only goes high if SIG actually equals "010-" or "---1" as opposed to considering the "-" values as don't cares, the same is true for using "X".

I'm using isim from Xilinx, could anyone tell me if this is a isim thing specifically or if there's another way of coding such that the simulator treats these as real don't care states?

I can imagine that the code would synthesis fine to behave as i wish but am obviously concerned that the simulator doesn't translate it as such?

Much thanks
 
Joined
Mar 10, 2008
Messages
348
Reaction score
0
Hi Janeruth

if you create a truthtable for SIG (with 16 entries) will you find that "010-" or "---1" covers all cases.

Jeppe
 
Joined
Jan 29, 2009
Messages
152
Reaction score
0
I think you should use the std_match function, like (untested code)
Code:
en2 <= '1' when std_match(SIG, "010-") else
'1' when std_match(SIG, "---1") else
0;
 
Joined
Jun 5, 2007
Messages
51
Reaction score
0
Re:

Instead, you can the following boolean equation

En2 <= ( Sig(3) and sig(2) and sig(1) ) or sig(0);
 
Joined
Jul 23, 2009
Messages
9
Reaction score
0
Thanks all,

Am still surprised at the simulator but turns out the std_match function works perfectly and most neatly for this.

Unfortunately, I have a similar issue elsewhere, where I am using with-select instead of when-else. I can't use the std_match in that case and will have to go with a more complicated condition
 
Last edited:

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,564
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top