Functions
WRITE_SHARED_REGISTER

Overview

The WRITE_SHARED_REGISTER procedure call enables an application module to write data to a shared_register inside the framework module. In order to write data, the caller identifies the desired shared register by a REGISTER_ID which is the first parameter of the WRITE_SHARED_REGISTER procedure call. The second parameter, data_in, is the data to be written to the shared_register. By default, this data is placed on the rightmost bits of state_reg_rec(M).shared_reg after one clock cycle. However, the caller can specify an optional integer offset value in order to target specific range of bits of state_reg_rec(M).shared_reg to place the data.

For example, if an application module wishes to write a 16-bit value to a shared register, by default, that data would appear on state_reg_rec(M).shared_reg(15 downto 0) after one clock cycle. However, if an offset value of 8 was specified, the input data would appear on state_reg_rec(M).shared_reg(23 downto 8). Using and offset value of 8 would allow another application module to safely write to state_reg_rec(M).shared_reg(7 downto 0) with no conflicts. Thus, data can be shared amongst multiple application modules simply by calling WRITE_SHARED_REGISTER while referencing the same REGISTER_ID.

In addition to sharing data amongst multiple application modules, a single application module has the capability of utilizing any number of shared registers for its own private purposes. The typical use case for a single application module using multiple shared registers would be to perform data multiplexing. Convenient data multiplexing can be done by making multiple WRITE_SHARED_REGISTER procedure calls on different resource indexes, (M), which correspond to a logical ordering of REGISTER_IDs. The WRITE_SHARED_REGISTER procedure calls are used buffer each piece of data on a different shared_register. Subsequently, that data can be selected and read on state_reg_rec(M).shared_reg by using the READ_SHARED_REGISTER procedure call and a counter to cycle through the available REGISTER_IDs.

Register ID

The REGISTER_ID is typically integer valued. This means that the shared register REGISTER_ID can be identified by either a small integer literal, 0, 1, 2, ect., or a module resource value. Writing to a shared register with the same REGISTER_ID allows data to be written to the same shared register regardless of the application module or resource index the WRITE_SHARED_REGISTER procedure call is made from.

Consider the following procedure calls:

RESOURCE_SELECT( sys_clk, next_state_rec, state_reg_rec );
WRITE_SHARED_REGISTER( 0, "0011", next_state_rec, state_reg_rec );
RESOURCE_SELECT( sys_clk, next_state_rec(1), state_reg_rec(1) );
WRITE_SHARED_REGISTER( 0, "111111", next_state_rec(1), state_reg_rec(1), 4 );

The first WRITE_SHARED_REGISTER call writes 4 bits, "0011",to a shared register identified by REGISTER_ID 0 from resource 0. The second WRITE_SHARED_REGISTER call writes 6 bits, "111111", from resource 1 to the same shared register and offsets the data 4 bits to the left.

After one clock cycle, the registered value of "1111110011" can be read on both state_reg_rec(0).shared_reg(9 downto 0) and state_reg_rec(1).shared_reg(9 downto 0).

Usage Example

Todo:
Add Example Usage

Example API Call(s):

WRITE_SHARED_REGISTER( this_module, read_only, next_state_rec, state_reg_rec );
WRITE_SHARED_REGISTER( some_module, some_data(3 downto 0) , next_state_rec, state_reg_rec, 4 );

Call Data [ 5 parameters (4 mandatory) ]

Parameters
[in]REGISTER_ID[1] simple index number starting from 0
[in]data_in[2] data to be placed on the shared register or read_only
[out]next_state_rec[3]
[in]state_reg_rec[4]
[in]offset*[5] (optional) integer offset to more 'downto' range to higher bits

Return Data

Parameters
[in]state_reg_rec(M).shared_reg: [1] [std_logic_vector]shared control data returned from the framework

Command Reference

Voice and Hotkey Commands:

See also
Shared Register Commands

Command Parameter Mapping

Parameters
[in]REGISTER_ID[1] [integer] "index <integer>"
[in]data_in[2] [std_logic_vector] "data (<std_logic_vector>|"read only")"
[out]next_state_rec[3]
[in]state_reg_rec[4]
[in]offset*[5] [integer] "offset <integer>"

Command Return Data

Parameters
[in]state_reg_rec(M).shared_reg: [1] [std_logic_vector] "shared register"

Voice/HotKey Command Sequence

SHARED_REGISTER( example_module, input_vector, next_state_rec, state_reg_rec, 10 );

Voice Command HotKey Sequence
"write shared register" sr
"data input vector" data input_vector
"offset ten" offset 10

Notes and Warnings

Note
1) The use of different REGISTER_IDs allows for 'clustering' of application modules, where different groups of application modules share registers that is not shared by other groups.
2) The REGISTER_ID parameter is overloaded for integer and std_logic_vector types, while data_in is overloaded for std_logic, std_logic_vector, std_logic_vector_array, and integers types.
3) Internally 'OR'ing or 'AND'ing data into the shared register prevents any synthesis error that would occur if there were multiple writers to the same range of bits of the shared register.
4) The default value of the of shared register (either all '1's or '0's) is set by the config file parameter default_shared_register_polarity.

See also
READ_SHARED_REGISTER
WRITE_FIFO_DATA
READ_FIFO_DATA

Procedures

  WRITE_SHARED_REGISTER(
REGISTER_ID: in integer
data_in: std_logic_vector
signal next_state_rec: out NSR
state_reg_rec: in SRR
offset: natural range 0 to NUM_CONTROL_BITS- 1 0
)
  WRITE_SHARED_REGISTER(
REGISTER_ID: in integer
data_in: std_logic_vector
signal next_state_rec: out NSR_ARRAY
state_reg_rec: in SRR_ARRAY
offset: natural range 0 to NUM_CONTROL_BITS- 1 0
)
 0verloaded for array next_state_rec and state_reg_rec. REGISTER_ID overloaded for types integer, std_logic_vector.