USB
This library provides functions for creating and extracting USB v1 and v2 packets.
Functionality
- Create USB packets
- Extract USB packets
- Packet types: Token, Start-of-Frame, Data, Handshake, Split Transaction
More details in nw_usb_pkg
Example use
Include the libraries:
library nw_util;
context nw_util.nw_util_context;
library nw_usb;
context nw_usb.nw_usb_context;
In many other NetWiz protocols a packet consists of a header and a payload. The USB packet is contained completely in a record. The CRC5 or CRC16 is added according to packet type.
variable v_usb_pkt : t_usb_packet;
variable v_len : natural;
variable v_pkt : t_slv_arr(0 to 127)(7 downto 0);
Example 1: Create a data packet.
v_usb_pkt := C_DEFAULT_USB_PACKET;
v_usb_pkt.pkt_type := DATA;
v_usb_pkt.data_pkt.data(0 to 5) := (x"01", x"02", x"33", x"44", x"50", x"06");
v_usb_pkt.data_pkt.data_len := 6;
v_len := f_usb_create_pkt_len(v_usb_pkt);
v_pkt(0 to v_len - 1) := f_usb_create_pkt(v_usb_pkt);
See further examples in the test bench nw_usb_tb.vhd.