The SHIFT_DATA_LEFT procedure call is used to shift input data (std_logic or std_logic_vector) to the left by a specified number of bits. For std_logic type inputs, left shifting is typically used for serial to parallel conversion and NUM_BITS is set to 1. Internally, the shifting is performed by using a framework shift register. When the optional shift_enable parameter is asserted to logic '1', the input data will be padded on the right side by zeros and the shifted data will be available after 1 clock cycle on the state_reg_rec(M).shift_left register.
The SHIFT_DATA_LEFT procedure call is most often used in conjunction with either the CONFIGURE_COUNTER or TRANSITION procedure call inside the same state of a state machine. This is because shifting procedures are incapable of counting the total number of bits shifted and cannot schedule a state machine transition on their own. When a shifter is used in conjunction with a counter, the counter value.done signal is used as the shift_enable and the counter schedules a state machine once the desired number of bits are shifted.
The data width of shift_left register is set by data_width parameter inside the config_file and any input data placed on data_in must be less than or equal to data_width bits minus NUM_BITS. This is because left shifted data will grow larger than the input data by NUM_BITS due to padding zeros on the right. In order to be flexible, the SHIFT_DATA_LEFT is procedure call is overloaded to perform some operations that are somewhat related to shifting but do not cause the initial bit width to grow to the left. If the option parameter is set to 'rotate', the data_in the bits will be rotated to the left by NUM_BITS. If the BIT_OPTION parameter is set to reverse_bits, then the SHIFT_DATA_LEFT procedure will perform a bit reversal of data_in instead of a shift.
SHIFT_DATA_LEFT( input_vector, 8, next_state_rec, state_reg_rec );
SHIFT_DATA_LEFT( input_vector, 8, next_state_rec, state_reg_rec, rotate );
[in] | data_in | [1] input data to be shifted |
[in] | NUM_BITS/BIT_OPTION | [2] number of elements to shift the input data or (reverse_bits|zero_pad|sign_extend) |
[out] | next_state_rec | [3] |
[in] | state_reg_rec | [4] |
[in] | shift_enable | [5] enable signal for the shifter |
[in] | shift_option/START_INDEX | [6] Option to enable or rotate data_in (optional) (<std_logic>|rotate) |
[in] | state_reg_rec(M).shift_left | : [1] [std_logic_vector] registered shifted data |
Voice and Hotkey Commands:
[in] | data_in | [1] "data <std_logic_vector>" |
[in] | NUM_BITS/BIT_OPTION | [2] "count <integer>" or "shift <integer>" |
[out] | next_state_rec | [3] |
[in] | state_reg_rec | [4] |
[in] | shift_enable | [5] "enable (<std_logic> )" |
[in] | shift_option/START_INDEX | [6] "option rotate" |
[in] | state_reg_rec(M).shift_left | : [1] [std_logic_vector] "left shift" |
SHIFT_DATA_LEFT( srr.fifo_data, 4, next_state_rec, state_reg_rec );
Voice Command | HotKey Sequence |
---|---|
"shift data left" | sdl |
"shift eight" | shift 8 |
Procedures | |
SHIFT_DATA_LEFT( data_in: std_logic_vector NUM_BITS: natural signal next_state_rec: out NSR state_reg_rec: in SRR shift_enable: std_logic ' 1 ' shift_option: SHIFT_TYPE NORMAL_SHIFT ) | |
SHIFT_DATA_LEFT( data_in: std_logic_vector NUM_BITS: natural signal next_state_rec: out NSR_ARRAY state_reg_rec: in SRR_ARRAY shift_enable: std_logic ' 1 ' shift_option: SHIFT_TYPE NORMAL_SHIFT ) | |
overloaded for rotate array interface. Optional enable or SHIFT_TYPE |