Nios® V/II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® V/II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++
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.

meaning of instruction

Altera_Forum
Honored Contributor II
1,008 Views

i want to know the meaning of this instruction?what does it return? 

return type_dwt_ctrl_signal(to_unsigned(type_dwt_ctrl_signal_enum'pos(x), cst_dwt_ctrl_sig_bus_width));:confused::confused::confused:
0 Kudos
1 Reply
Altera_Forum
Honored Contributor II
337 Views

'pos(x) returns an integer which is the position of x in the enumeration type of TYPE_DWT_CTRL_SIG NAL_ENUM. (as ax example if TYPE_DWT_CTRL_SIG NAL_ENUM is (yes,no,maybe) then TYPE_DWT_CTRL_SIG NAL_ENUM'POS(no) is 1). 

to_unsigned() converts that integer to a bit vector using an unsigned format, with CST_DWT_CTRL_SIG_BUS_WIDTH bits. The resulting vector is sent to the TYPE_DWT_CTRL_SIGNAL. 

 

Please note that that kind of code should only be used for simulation. Using 'POS on enum types is unreliable with synthesis (if supported by the synthesizer).
0 Kudos
Reply