Programmable Devices
CPLDs, FPGAs, SoC FPGAs, Configuration, and Transceivers
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.
21616 Discussions

meaning of a pacKage

Altera_Forum
Honored Contributor II
1,106 Views

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
0 Kudos
1 Reply
Altera_Forum
Honored Contributor II
416 Views

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.
0 Kudos
Reply