A
Alex Young
Guest
Hi all,
Having only recently started using vhdl I am wondering if there are any
recomendations for how to use types within designs?
It seems that the most generic type is std_logic(_vector). Is it generally a
good idea to use this type to pass data around between modules/entities?
( Argh what is the correct name for these? I am used to Verilog!)
In particular how would you handle the design of something like an ALU. It
would seem to make sense to give it signed/unsigned types. Should I pass
std_logic values and then type convert to signed within the architecture of
the ALU?
A similar question relating to boolean values. It seems that using booleans
will give cleaner code. i.e.
zero_flag := alu_out = 0;
as opposed to
if alu_out = 0 then
zero_flag := '1';
else
zero_flag := '0';
end if;
I guess that this will have problems with uninitialised values though. Again
what would be considered best practice?
Thanks for your help,
--
Alex Young
Having only recently started using vhdl I am wondering if there are any
recomendations for how to use types within designs?
It seems that the most generic type is std_logic(_vector). Is it generally a
good idea to use this type to pass data around between modules/entities?
( Argh what is the correct name for these? I am used to Verilog!)
In particular how would you handle the design of something like an ALU. It
would seem to make sense to give it signed/unsigned types. Should I pass
std_logic values and then type convert to signed within the architecture of
the ALU?
A similar question relating to boolean values. It seems that using booleans
will give cleaner code. i.e.
zero_flag := alu_out = 0;
as opposed to
if alu_out = 0 then
zero_flag := '1';
else
zero_flag := '0';
end if;
I guess that this will have problems with uninitialised values though. Again
what would be considered best practice?
Thanks for your help,
--
Alex Young