Not in VHDL it doesn't. I did warn you that automatic
translation would fail. in VHDL a string of 2 characters
is precisely that, an array of two CHARACTERS, and only in
your hardware mindset is that exactly the same as 16 bits.
You'll need either an overloaded equality test operator
or a type conversion function. This would work, if
I understand your intent correctly:
function to_std_logic_vector (s: string)
return std_logic_vector
is
variable v: std_logic_vector (1 to 8*s'length+7);
begin
for i in s'range loop
v(8*i to 8*i+7) :=
std_logic_vector(to_unsigned(s(i)'pos, 8));
end loop;
return v;
end;
Now you could do
if to_std_logic_vector(a) = x"1234" then ...
And perhaps, if you really need convenient comparison,
function "=" (L: string, R: std_logic_vector) return boolean is
begin
return to_std_logic_vector(L) = R;
end;
and then you can do
if a = x"1234" then ...
Good luck. VHDL is not Verilog.
--
Jonathan Bromley, Consultant
DOULOS - Developing Design Know-how
VHDL * Verilog * SystemC * e * Perl * Tcl/Tk * Project Services
Doulos Ltd., 22 Market Place, Ringwood, BH24 1AW, UK
(e-mail address removed)://
www.MYCOMPANY.com
The contents of this message may contain personal views which
are not the views of Doulos Ltd., unless specifically stated.