On Tuesday, January 28, 2020 at 10:10:39 PM UTC-5,
[email protected] wrote:
I didn’t paste all of the code but there is another array of ADC data: type ADC_REG_TYPE is array (0 to 20) of std_logic_vector(31 downto 0). In order to assign this ADC data to my stream array I take it I would have to repackage it like: Signal
adc_data : PACKET_REG_TYPE(0 to 83).
Then I could assign the whole thing at once:
stream_1_tx_int(11 to 94) <= adc_data;
Yes, but since ADC data is an array of 32 bit things, you would need to manually convert between 32 bit words and 8 bit ones. However, to do this conversion you could build on what you have.
type PACKET_REG_TYPE32 is array(natural range <>) of std_logic_vector(31 downto 0);
Then create a function that converts a 32 bit word into an array of four bytes. The declaration for this is shown below, you would write the body of the function.
function ToPacketRegType(Inp: std_logic_vector(31 downto 0)) return PACKET_REG_TYPE;
Then create a function that converts PACKET_REG_TYPE32 to PACKET_REG_TYPE by iterating and calling the function ToPacketRegType. Again, you would write the body of the function.
function ToPacketRegType(Inp: PACKET_REG_TYPE32) return PACKET_REG_TYPE;
Now that you have these to helper functions you can convert directly from your ADC data array like this
AdcDataPacketRegType <= ToPacketRegType(AdcData);
Alternatively, you would dispense with AdcDataPacketRegType and simply assign ToPacketRegType(AdcData) into the appropriate range in your packet.
Kevin Jennings
--- SoupGate-Win32 v1.05
* Origin: fsxNet Usenet Gateway (21:1/5)