Functions
SHIFT_DATA_RIGHT

Overview

The SHIFT_DATA_RIGHT procedure call is used to shift input data (std_logic or std_logic_vector) to the right by a specified number of bits. For std_logic_vector type inputs, right shifting is typically used for parallel to serial 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 left side by zeros and the shifted data will be available after 1 clock cycle on the state_reg_rec(M).shift_right register.

The SHIFT_DATA_RIGHT 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_right 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. Due to the fact that the shift_right} register has a fixed data width of data_width number of bits, the optional integer START_INDEX can be used to specify the left most bit index to place data_in before a right shift takes place. In order to be flexible, the SHIFT_DATA_RIGHT is procedure call is overloaded to perform some operations that are somewhat related to shifting but do not cause the initial bit width to shrink to the right. If the option parameter is set to 'rotate', the data_in the bits will be rotated to the right by NUM_BITS. If the BIT_OPTION parameter is set to reverse_bits, then the SHIFT_DATA_RIGHT procedure will perform a bit reversal of data_in instead of a shift.

It should be noted that right shifting to perform parallel to serial conversion is slightly more involved than left shifting to perform serial to parallel conversion. This is due to the fact that the parallel data must be captured on one clock cycle, and on subsequent clock cycles the shifted data must be used as the input data. The operation typically involves two calls to SHIFT_DATA_RIGHT in two separate state machine states. The first call is used to zero_pad or sign_extend the input data with a START_INDEX to place the leftmost bit, then a second call to actually perform the right shifting.

Usage Example

Todo:
Add Example Usage

Example API Call(s):

SHIFT_DATA_RIGHT( input_vector, 8, next_state_rec, state_reg_rec );
SHIFT_DATA_RIGHT( input_vector, 8, next_state_rec, state_reg_rec, rotate );

Call Data [ 6 parameters (4 mandatory) ]

Parameters
[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)

Return Data

Parameters
[in]state_reg_rec(M).shift_right: [1] [std_logic_vector] registered shifted data

Command Reference

Voice and Hotkey Commands:

See also
Shift Data Right Command

Command Parameter Mapping

Parameters
[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"

Command Return Data

Parameters
[in]state_reg_rec(M).shift_right: [1] [std_logic_vector] "right shift"

Voice/HotKey Command Sequence

SHIFT_DATA_RIGHT( srr.fifo_data, 4, next_state_rec, state_reg_rec );

Voice Command HotKey Sequence
"shift data right" sdr
"shift eight" shift 8
Note
1) The caller of SHIFT_DATA_RIGHT is required to extract the range of bits that it is expecting from a subset of shift_right(data_width -1 downto 0).
2) When BIT_OPTION is specified instead of NUM_BITS, the SHIFT_DATA_RIGHT procedure does not perform a shift, instead the shift_right register will reflect the requested bit operation.

See also
RESET_RIGHT_SHIFTER
SHIFT_DATA_LEFT

Procedures

  SHIFT_DATA_RIGHT(
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_RIGHT(
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