Forum Discussion
Altera_Forum
Honored Contributor
16 years agomeaning of a pacKage
1)i dont understand the meaning of this package:
package body dwt2dpkg is
function dwt2dctrlvector(x : in type_dwt2d_ctrl_signal_enum) return type_dwt2d_ctrl_signal is
begin
return type_dwt2d_ctrl_signal(to_unsigned(type_dwt2d_ctrl_signal_enum'pos(x), cst_dwt2d_ctrl_sig_bus_width));
end;
end dwt2dpkg;:confused::eek:
2)i dont understand the utility of this code:
type type_dwt2d_state is (
ts2d_ready,
ts2d_init_horiz,
ts2d_start_horiz,
ts2d_continue_horiz,
ts2d_init_vert,
ts2d_start_vert,
ts2d_continue_vert,
ts2d_next_level,
ts2d_terminate
);:confused::confused:
can any one explain it to me. Thinks
1 Reply
- Altera_Forum
Honored Contributor
Package is a support vhdl program that is not meant to be a module like other design module but to insert any constants, functions in a neat way. It is optional. Most people use one package per project to insert their constants and functions. Others go as far as one package per module...too excessive.
type my_states is (s0, s1,s2....etc); signal state : my_states; means you create your own type, meaning a replacement for vhdl own types like std_logic etc. in order to help readability. For example it is convenient to use s0,s1,s2 than explicit binary value. The compiler then is free to encode the states.