Forum Discussion
Altera_Forum
Honored Contributor
16 years agomeaning of instruction
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::conf...
Altera_Forum
Honored Contributor
16 years ago'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).