Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
12 years ago

how to have the right comparison result with quartus

Hi

I have write a vhdl module of comparison, with quartus, I have add it

to the architecture with SopcBuilder, and call it from nios.

In nios I don't have right result, I don't know why??

have any one any idea about???!!

this is the part of my code:

process (a)

variable x,y : integer:=0;

begin

x := (conv_integer(a));

if x > 0 then y := 1;

elsif x < 0 then y := 0;

else y := 0;

end if;

b <= conv_std_logic_vector(y,32);

end process;

in the console of nios I have arbitrary zeros and ones.

2 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    are you using std_logic_signed or std_logic_unsigned? (neither of these are part of the VHDL standard btw).

    In your code, Y will be 1 when A > 0, or 0 when A <= 0. If you are using std_logic_unsigned, Y will always be 1, unless A is 0.