mirror of
https://github.com/alexforencich/verilog-ethernet.git
synced 2025-01-14 06:43:18 +08:00
Convert generated udp_demux to verilog parametrized module
This commit is contained in:
parent
81e9aa0c77
commit
98fc042489
462
rtl/udp_demux.py
462
rtl/udp_demux.py
@ -1,462 +0,0 @@
|
||||
#!/usr/bin/env python
|
||||
"""
|
||||
Generates a UDP demux with the specified number of ports
|
||||
"""
|
||||
|
||||
from __future__ import print_function
|
||||
|
||||
import argparse
|
||||
import math
|
||||
from jinja2 import Template
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(description=__doc__.strip())
|
||||
parser.add_argument('-p', '--ports', type=int, default=4, help="number of ports")
|
||||
parser.add_argument('-n', '--name', type=str, help="module name")
|
||||
parser.add_argument('-o', '--output', type=str, help="output file name")
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
try:
|
||||
generate(**args.__dict__)
|
||||
except IOError as ex:
|
||||
print(ex)
|
||||
exit(1)
|
||||
|
||||
def generate(ports=4, name=None, output=None):
|
||||
if name is None:
|
||||
name = "udp_demux_{0}".format(ports)
|
||||
|
||||
if output is None:
|
||||
output = name + ".v"
|
||||
|
||||
print("Opening file '{0}'...".format(output))
|
||||
|
||||
output_file = open(output, 'w')
|
||||
|
||||
print("Generating {0} port UDP demux {1}...".format(ports, name))
|
||||
|
||||
select_width = int(math.ceil(math.log(ports, 2)))
|
||||
|
||||
t = Template(u"""/*
|
||||
|
||||
Copyright (c) 2014-2018 Alex Forencich
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
|
||||
*/
|
||||
|
||||
// Language: Verilog 2001
|
||||
|
||||
`timescale 1ns / 1ps
|
||||
|
||||
/*
|
||||
* UDP {{n}} port demultiplexer
|
||||
*/
|
||||
module {{name}}
|
||||
(
|
||||
input wire clk,
|
||||
input wire rst,
|
||||
|
||||
/*
|
||||
* UDP frame input
|
||||
*/
|
||||
input wire input_udp_hdr_valid,
|
||||
output wire input_udp_hdr_ready,
|
||||
input wire [47:0] input_eth_dest_mac,
|
||||
input wire [47:0] input_eth_src_mac,
|
||||
input wire [15:0] input_eth_type,
|
||||
input wire [3:0] input_ip_version,
|
||||
input wire [3:0] input_ip_ihl,
|
||||
input wire [5:0] input_ip_dscp,
|
||||
input wire [1:0] input_ip_ecn,
|
||||
input wire [15:0] input_ip_length,
|
||||
input wire [15:0] input_ip_identification,
|
||||
input wire [2:0] input_ip_flags,
|
||||
input wire [12:0] input_ip_fragment_offset,
|
||||
input wire [7:0] input_ip_ttl,
|
||||
input wire [7:0] input_ip_protocol,
|
||||
input wire [15:0] input_ip_header_checksum,
|
||||
input wire [31:0] input_ip_source_ip,
|
||||
input wire [31:0] input_ip_dest_ip,
|
||||
input wire [15:0] input_udp_source_port,
|
||||
input wire [15:0] input_udp_dest_port,
|
||||
input wire [15:0] input_udp_length,
|
||||
input wire [15:0] input_udp_checksum,
|
||||
input wire [7:0] input_udp_payload_tdata,
|
||||
input wire input_udp_payload_tvalid,
|
||||
output wire input_udp_payload_tready,
|
||||
input wire input_udp_payload_tlast,
|
||||
input wire input_udp_payload_tuser,
|
||||
|
||||
/*
|
||||
* UDP frame outputs
|
||||
*/
|
||||
{%- for p in ports %}
|
||||
output wire output_{{p}}_udp_hdr_valid,
|
||||
input wire output_{{p}}_udp_hdr_ready,
|
||||
output wire [47:0] output_{{p}}_eth_dest_mac,
|
||||
output wire [47:0] output_{{p}}_eth_src_mac,
|
||||
output wire [15:0] output_{{p}}_eth_type,
|
||||
output wire [3:0] output_{{p}}_ip_version,
|
||||
output wire [3:0] output_{{p}}_ip_ihl,
|
||||
output wire [5:0] output_{{p}}_ip_dscp,
|
||||
output wire [1:0] output_{{p}}_ip_ecn,
|
||||
output wire [15:0] output_{{p}}_ip_length,
|
||||
output wire [15:0] output_{{p}}_ip_identification,
|
||||
output wire [2:0] output_{{p}}_ip_flags,
|
||||
output wire [12:0] output_{{p}}_ip_fragment_offset,
|
||||
output wire [7:0] output_{{p}}_ip_ttl,
|
||||
output wire [7:0] output_{{p}}_ip_protocol,
|
||||
output wire [15:0] output_{{p}}_ip_header_checksum,
|
||||
output wire [31:0] output_{{p}}_ip_source_ip,
|
||||
output wire [31:0] output_{{p}}_ip_dest_ip,
|
||||
output wire [15:0] output_{{p}}_udp_source_port,
|
||||
output wire [15:0] output_{{p}}_udp_dest_port,
|
||||
output wire [15:0] output_{{p}}_udp_length,
|
||||
output wire [15:0] output_{{p}}_udp_checksum,
|
||||
output wire [7:0] output_{{p}}_udp_payload_tdata,
|
||||
output wire output_{{p}}_udp_payload_tvalid,
|
||||
input wire output_{{p}}_udp_payload_tready,
|
||||
output wire output_{{p}}_udp_payload_tlast,
|
||||
output wire output_{{p}}_udp_payload_tuser,
|
||||
{% endfor %}
|
||||
/*
|
||||
* Control
|
||||
*/
|
||||
input wire enable,
|
||||
input wire [{{w-1}}:0] select
|
||||
);
|
||||
|
||||
reg [{{w-1}}:0] select_reg = {{w}}'d0, select_next;
|
||||
reg frame_reg = 1'b0, frame_next;
|
||||
|
||||
reg input_udp_hdr_ready_reg = 1'b0, input_udp_hdr_ready_next;
|
||||
reg input_udp_payload_tready_reg = 1'b0, input_udp_payload_tready_next;
|
||||
{% for p in ports %}
|
||||
reg output_{{p}}_udp_hdr_valid_reg = 1'b0, output_{{p}}_udp_hdr_valid_next;
|
||||
{%- endfor %}
|
||||
reg [47:0] output_eth_dest_mac_reg = 48'd0, output_eth_dest_mac_next;
|
||||
reg [47:0] output_eth_src_mac_reg = 48'd0, output_eth_src_mac_next;
|
||||
reg [15:0] output_eth_type_reg = 16'd0, output_eth_type_next;
|
||||
reg [3:0] output_ip_version_reg = 4'd0, output_ip_version_next;
|
||||
reg [3:0] output_ip_ihl_reg = 4'd0, output_ip_ihl_next;
|
||||
reg [5:0] output_ip_dscp_reg = 6'd0, output_ip_dscp_next;
|
||||
reg [1:0] output_ip_ecn_reg = 2'd0, output_ip_ecn_next;
|
||||
reg [15:0] output_ip_length_reg = 16'd0, output_ip_length_next;
|
||||
reg [15:0] output_ip_identification_reg = 16'd0, output_ip_identification_next;
|
||||
reg [2:0] output_ip_flags_reg = 3'd0, output_ip_flags_next;
|
||||
reg [12:0] output_ip_fragment_offset_reg = 13'd0, output_ip_fragment_offset_next;
|
||||
reg [7:0] output_ip_ttl_reg = 8'd0, output_ip_ttl_next;
|
||||
reg [7:0] output_ip_protocol_reg = 8'd0, output_ip_protocol_next;
|
||||
reg [15:0] output_ip_header_checksum_reg = 16'd0, output_ip_header_checksum_next;
|
||||
reg [31:0] output_ip_source_ip_reg = 32'd0, output_ip_source_ip_next;
|
||||
reg [31:0] output_ip_dest_ip_reg = 32'd0, output_ip_dest_ip_next;
|
||||
reg [15:0] output_udp_source_port_reg = 16'd0, output_udp_source_port_next;
|
||||
reg [15:0] output_udp_dest_port_reg = 16'd0, output_udp_dest_port_next;
|
||||
reg [15:0] output_udp_length_reg = 16'd0, output_udp_length_next;
|
||||
reg [15:0] output_udp_checksum_reg = 16'd0, output_udp_checksum_next;
|
||||
|
||||
// internal datapath
|
||||
reg [7:0] output_udp_payload_tdata_int;
|
||||
reg output_udp_payload_tvalid_int;
|
||||
reg output_udp_payload_tready_int_reg = 1'b0;
|
||||
reg output_udp_payload_tlast_int;
|
||||
reg output_udp_payload_tuser_int;
|
||||
wire output_udp_payload_tready_int_early;
|
||||
|
||||
assign input_udp_hdr_ready = input_udp_hdr_ready_reg;
|
||||
assign input_udp_payload_tready = input_udp_payload_tready_reg;
|
||||
{% for p in ports %}
|
||||
assign output_{{p}}_udp_hdr_valid = output_{{p}}_udp_hdr_valid_reg;
|
||||
assign output_{{p}}_eth_dest_mac = output_eth_dest_mac_reg;
|
||||
assign output_{{p}}_eth_src_mac = output_eth_src_mac_reg;
|
||||
assign output_{{p}}_eth_type = output_eth_type_reg;
|
||||
assign output_{{p}}_ip_version = output_ip_version_reg;
|
||||
assign output_{{p}}_ip_ihl = output_ip_ihl_reg;
|
||||
assign output_{{p}}_ip_dscp = output_ip_dscp_reg;
|
||||
assign output_{{p}}_ip_ecn = output_ip_ecn_reg;
|
||||
assign output_{{p}}_ip_length = output_ip_length_reg;
|
||||
assign output_{{p}}_ip_identification = output_ip_identification_reg;
|
||||
assign output_{{p}}_ip_flags = output_ip_flags_reg;
|
||||
assign output_{{p}}_ip_fragment_offset = output_ip_fragment_offset_reg;
|
||||
assign output_{{p}}_ip_ttl = output_ip_ttl_reg;
|
||||
assign output_{{p}}_ip_protocol = output_ip_protocol_reg;
|
||||
assign output_{{p}}_ip_header_checksum = output_ip_header_checksum_reg;
|
||||
assign output_{{p}}_ip_source_ip = output_ip_source_ip_reg;
|
||||
assign output_{{p}}_ip_dest_ip = output_ip_dest_ip_reg;
|
||||
assign output_{{p}}_udp_source_port = output_udp_source_port_reg;
|
||||
assign output_{{p}}_udp_dest_port = output_udp_dest_port_reg;
|
||||
assign output_{{p}}_udp_length = output_udp_length_reg;
|
||||
assign output_{{p}}_udp_checksum = output_udp_checksum_reg;
|
||||
{% endfor %}
|
||||
// mux for output control signals
|
||||
reg current_output_udp_hdr_valid;
|
||||
reg current_output_udp_hdr_ready;
|
||||
reg current_output_tvalid;
|
||||
reg current_output_tready;
|
||||
always @* begin
|
||||
case (select_reg)
|
||||
{%- for p in ports %}
|
||||
{{w}}'d{{p}}: begin
|
||||
current_output_udp_hdr_valid = output_{{p}}_udp_hdr_valid;
|
||||
current_output_udp_hdr_ready = output_{{p}}_udp_hdr_ready;
|
||||
current_output_tvalid = output_{{p}}_udp_payload_tvalid;
|
||||
current_output_tready = output_{{p}}_udp_payload_tready;
|
||||
end
|
||||
{%- endfor %}
|
||||
default: begin
|
||||
current_output_udp_hdr_valid = 1'b0;
|
||||
current_output_udp_hdr_ready = 1'b0;
|
||||
current_output_tvalid = 1'b0;
|
||||
current_output_tready = 1'b0;
|
||||
end
|
||||
endcase
|
||||
end
|
||||
|
||||
always @* begin
|
||||
select_next = select_reg;
|
||||
frame_next = frame_reg;
|
||||
|
||||
input_udp_hdr_ready_next = input_udp_hdr_ready_reg & ~input_udp_hdr_valid;
|
||||
input_udp_payload_tready_next = 1'b0;
|
||||
|
||||
{%- for p in ports %}
|
||||
output_{{p}}_udp_hdr_valid_next = output_{{p}}_udp_hdr_valid_reg & ~output_{{p}}_udp_hdr_ready;
|
||||
{%- endfor %}
|
||||
output_eth_dest_mac_next = output_eth_dest_mac_reg;
|
||||
output_eth_src_mac_next = output_eth_src_mac_reg;
|
||||
output_eth_type_next = output_eth_type_reg;
|
||||
output_ip_version_next = output_ip_version_reg;
|
||||
output_ip_ihl_next = output_ip_ihl_reg;
|
||||
output_ip_dscp_next = output_ip_dscp_reg;
|
||||
output_ip_ecn_next = output_ip_ecn_reg;
|
||||
output_ip_length_next = output_ip_length_reg;
|
||||
output_ip_identification_next = output_ip_identification_reg;
|
||||
output_ip_flags_next = output_ip_flags_reg;
|
||||
output_ip_fragment_offset_next = output_ip_fragment_offset_reg;
|
||||
output_ip_ttl_next = output_ip_ttl_reg;
|
||||
output_ip_protocol_next = output_ip_protocol_reg;
|
||||
output_ip_header_checksum_next = output_ip_header_checksum_reg;
|
||||
output_ip_source_ip_next = output_ip_source_ip_reg;
|
||||
output_ip_dest_ip_next = output_ip_dest_ip_reg;
|
||||
output_udp_source_port_next = output_udp_source_port_reg;
|
||||
output_udp_dest_port_next = output_udp_dest_port_reg;
|
||||
output_udp_length_next = output_udp_length_reg;
|
||||
output_udp_checksum_next = output_udp_checksum_reg;
|
||||
|
||||
if (input_udp_payload_tvalid & input_udp_payload_tready) begin
|
||||
// end of frame detection
|
||||
if (input_udp_payload_tlast) begin
|
||||
frame_next = 1'b0;
|
||||
end
|
||||
end
|
||||
|
||||
if (~frame_reg & enable & input_udp_hdr_valid & ~current_output_udp_hdr_valid & ~current_output_tvalid) begin
|
||||
// start of frame, grab select value
|
||||
frame_next = 1'b1;
|
||||
select_next = select;
|
||||
|
||||
input_udp_hdr_ready_next = 1'b1;
|
||||
|
||||
case (select)
|
||||
{%- for p in ports %}
|
||||
{{w}}'d{{p}}: output_{{p}}_udp_hdr_valid_next = 1'b1;
|
||||
{%- endfor %}
|
||||
endcase
|
||||
output_eth_dest_mac_next = input_eth_dest_mac;
|
||||
output_eth_src_mac_next = input_eth_src_mac;
|
||||
output_eth_type_next = input_eth_type;
|
||||
output_ip_version_next = input_ip_version;
|
||||
output_ip_ihl_next = input_ip_ihl;
|
||||
output_ip_dscp_next = input_ip_dscp;
|
||||
output_ip_ecn_next = input_ip_ecn;
|
||||
output_ip_length_next = input_ip_length;
|
||||
output_ip_identification_next = input_ip_identification;
|
||||
output_ip_flags_next = input_ip_flags;
|
||||
output_ip_fragment_offset_next = input_ip_fragment_offset;
|
||||
output_ip_ttl_next = input_ip_ttl;
|
||||
output_ip_protocol_next = input_ip_protocol;
|
||||
output_ip_header_checksum_next = input_ip_header_checksum;
|
||||
output_ip_source_ip_next = input_ip_source_ip;
|
||||
output_ip_dest_ip_next = input_ip_dest_ip;
|
||||
output_udp_source_port_next = input_udp_source_port;
|
||||
output_udp_dest_port_next = input_udp_dest_port;
|
||||
output_udp_length_next = input_udp_length;
|
||||
output_udp_checksum_next = input_udp_checksum;
|
||||
end
|
||||
|
||||
input_udp_payload_tready_next = output_udp_payload_tready_int_early & frame_next;
|
||||
|
||||
output_udp_payload_tdata_int = input_udp_payload_tdata;
|
||||
output_udp_payload_tvalid_int = input_udp_payload_tvalid & input_udp_payload_tready;
|
||||
output_udp_payload_tlast_int = input_udp_payload_tlast;
|
||||
output_udp_payload_tuser_int = input_udp_payload_tuser;
|
||||
end
|
||||
|
||||
always @(posedge clk) begin
|
||||
if (rst) begin
|
||||
select_reg <= {{w}}'d0;
|
||||
frame_reg <= 1'b0;
|
||||
input_udp_hdr_ready_reg <= 1'b0;
|
||||
input_udp_payload_tready_reg <= 1'b0;
|
||||
{%- for p in ports %}
|
||||
output_{{p}}_udp_hdr_valid_reg <= 1'b0;
|
||||
{%- endfor %}
|
||||
end else begin
|
||||
select_reg <= select_next;
|
||||
frame_reg <= frame_next;
|
||||
input_udp_hdr_ready_reg <= input_udp_hdr_ready_next;
|
||||
input_udp_payload_tready_reg <= input_udp_payload_tready_next;
|
||||
{%- for p in ports %}
|
||||
output_{{p}}_udp_hdr_valid_reg <= output_{{p}}_udp_hdr_valid_next;
|
||||
{%- endfor %}
|
||||
end
|
||||
|
||||
output_eth_dest_mac_reg <= output_eth_dest_mac_next;
|
||||
output_eth_src_mac_reg <= output_eth_src_mac_next;
|
||||
output_eth_type_reg <= output_eth_type_next;
|
||||
output_ip_version_reg <= output_ip_version_next;
|
||||
output_ip_ihl_reg <= output_ip_ihl_next;
|
||||
output_ip_dscp_reg <= output_ip_dscp_next;
|
||||
output_ip_ecn_reg <= output_ip_ecn_next;
|
||||
output_ip_length_reg <= output_ip_length_next;
|
||||
output_ip_identification_reg <= output_ip_identification_next;
|
||||
output_ip_flags_reg <= output_ip_flags_next;
|
||||
output_ip_fragment_offset_reg <= output_ip_fragment_offset_next;
|
||||
output_ip_ttl_reg <= output_ip_ttl_next;
|
||||
output_ip_protocol_reg <= output_ip_protocol_next;
|
||||
output_ip_header_checksum_reg <= output_ip_header_checksum_next;
|
||||
output_ip_source_ip_reg <= output_ip_source_ip_next;
|
||||
output_ip_dest_ip_reg <= output_ip_dest_ip_next;
|
||||
output_udp_source_port_reg <= output_udp_source_port_next;
|
||||
output_udp_dest_port_reg <= output_udp_dest_port_next;
|
||||
output_udp_length_reg <= output_udp_length_next;
|
||||
output_udp_checksum_reg <= output_udp_checksum_next;
|
||||
end
|
||||
|
||||
// output datapath logic
|
||||
reg [7:0] output_udp_payload_tdata_reg = 8'd0;
|
||||
{%- for p in ports %}
|
||||
reg output_{{p}}_udp_payload_tvalid_reg = 1'b0, output_{{p}}_udp_payload_tvalid_next;
|
||||
{%- endfor %}
|
||||
reg output_udp_payload_tlast_reg = 1'b0;
|
||||
reg output_udp_payload_tuser_reg = 1'b0;
|
||||
|
||||
reg [7:0] temp_udp_payload_tdata_reg = 8'd0;
|
||||
reg temp_udp_payload_tvalid_reg = 1'b0, temp_udp_payload_tvalid_next;
|
||||
reg temp_udp_payload_tlast_reg = 1'b0;
|
||||
reg temp_udp_payload_tuser_reg = 1'b0;
|
||||
|
||||
// datapath control
|
||||
reg store_udp_payload_int_to_output;
|
||||
reg store_udp_payload_int_to_temp;
|
||||
reg store_udp_payload_temp_to_output;
|
||||
{% for p in ports %}
|
||||
assign output_{{p}}_udp_payload_tdata = output_udp_payload_tdata_reg;
|
||||
assign output_{{p}}_udp_payload_tvalid = output_{{p}}_udp_payload_tvalid_reg;
|
||||
assign output_{{p}}_udp_payload_tlast = output_udp_payload_tlast_reg;
|
||||
assign output_{{p}}_udp_payload_tuser = output_udp_payload_tuser_reg;
|
||||
{% endfor %}
|
||||
// enable ready input next cycle if output is ready or the temp reg will not be filled on the next cycle (output reg empty or no input)
|
||||
assign output_udp_payload_tready_int_early = current_output_tready | (~temp_udp_payload_tvalid_reg & (~current_output_tvalid | ~output_udp_payload_tvalid_int));
|
||||
|
||||
always @* begin
|
||||
// transfer sink ready state to source
|
||||
{%- for p in ports %}
|
||||
output_{{p}}_udp_payload_tvalid_next = output_{{p}}_udp_payload_tvalid_reg;
|
||||
{%- endfor %}
|
||||
temp_udp_payload_tvalid_next = temp_udp_payload_tvalid_reg;
|
||||
|
||||
store_udp_payload_int_to_output = 1'b0;
|
||||
store_udp_payload_int_to_temp = 1'b0;
|
||||
store_udp_payload_temp_to_output = 1'b0;
|
||||
|
||||
if (output_udp_payload_tready_int_reg) begin
|
||||
// input is ready
|
||||
if (current_output_tready | ~current_output_tvalid) begin
|
||||
// output is ready or currently not valid, transfer data to output
|
||||
{%- for p in ports %}
|
||||
output_{{p}}_udp_payload_tvalid_next = output_udp_payload_tvalid_int & (select_reg == {{w}}'d{{p}});
|
||||
{%- endfor %}
|
||||
store_udp_payload_int_to_output = 1'b1;
|
||||
end else begin
|
||||
// output is not ready, store input in temp
|
||||
temp_udp_payload_tvalid_next = output_udp_payload_tvalid_int;
|
||||
store_udp_payload_int_to_temp = 1'b1;
|
||||
end
|
||||
end else if (current_output_tready) begin
|
||||
// input is not ready, but output is ready
|
||||
{%- for p in ports %}
|
||||
output_{{p}}_udp_payload_tvalid_next = temp_udp_payload_tvalid_reg & (select_reg == {{w}}'d{{p}});
|
||||
{%- endfor %}
|
||||
temp_udp_payload_tvalid_next = 1'b0;
|
||||
store_udp_payload_temp_to_output = 1'b1;
|
||||
end
|
||||
end
|
||||
|
||||
always @(posedge clk) begin
|
||||
if (rst) begin
|
||||
{%- for p in ports %}
|
||||
output_{{p}}_udp_payload_tvalid_reg <= 1'b0;
|
||||
{%- endfor %}
|
||||
output_udp_payload_tready_int_reg <= 1'b0;
|
||||
temp_udp_payload_tvalid_reg <= 1'b0;
|
||||
end else begin
|
||||
{%- for p in ports %}
|
||||
output_{{p}}_udp_payload_tvalid_reg <= output_{{p}}_udp_payload_tvalid_next;
|
||||
{%- endfor %}
|
||||
output_udp_payload_tready_int_reg <= output_udp_payload_tready_int_early;
|
||||
temp_udp_payload_tvalid_reg <= temp_udp_payload_tvalid_next;
|
||||
end
|
||||
|
||||
// datapath
|
||||
if (store_udp_payload_int_to_output) begin
|
||||
output_udp_payload_tdata_reg <= output_udp_payload_tdata_int;
|
||||
output_udp_payload_tlast_reg <= output_udp_payload_tlast_int;
|
||||
output_udp_payload_tuser_reg <= output_udp_payload_tuser_int;
|
||||
end else if (store_udp_payload_temp_to_output) begin
|
||||
output_udp_payload_tdata_reg <= temp_udp_payload_tdata_reg;
|
||||
output_udp_payload_tlast_reg <= temp_udp_payload_tlast_reg;
|
||||
output_udp_payload_tuser_reg <= temp_udp_payload_tuser_reg;
|
||||
end
|
||||
|
||||
if (store_udp_payload_int_to_temp) begin
|
||||
temp_udp_payload_tdata_reg <= output_udp_payload_tdata_int;
|
||||
temp_udp_payload_tlast_reg <= output_udp_payload_tlast_int;
|
||||
temp_udp_payload_tuser_reg <= output_udp_payload_tuser_int;
|
||||
end
|
||||
end
|
||||
|
||||
endmodule
|
||||
|
||||
""")
|
||||
|
||||
output_file.write(t.render(
|
||||
n=ports,
|
||||
w=select_width,
|
||||
name=name,
|
||||
ports=range(ports)
|
||||
))
|
||||
|
||||
print("Done")
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
424
rtl/udp_demux.v
Normal file
424
rtl/udp_demux.v
Normal file
@ -0,0 +1,424 @@
|
||||
/*
|
||||
|
||||
Copyright (c) 2018 Alex Forencich
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
|
||||
*/
|
||||
|
||||
// Language: Verilog 2001
|
||||
|
||||
`timescale 1ns / 1ps
|
||||
|
||||
/*
|
||||
* UDP demultiplexer
|
||||
*/
|
||||
module udp_demux #
|
||||
(
|
||||
parameter M_COUNT = 4,
|
||||
parameter DATA_WIDTH = 8,
|
||||
parameter KEEP_ENABLE = (DATA_WIDTH>8),
|
||||
parameter KEEP_WIDTH = (DATA_WIDTH/8),
|
||||
parameter ID_ENABLE = 0,
|
||||
parameter ID_WIDTH = 8,
|
||||
parameter DEST_ENABLE = 0,
|
||||
parameter DEST_WIDTH = 8,
|
||||
parameter USER_ENABLE = 1,
|
||||
parameter USER_WIDTH = 1
|
||||
)
|
||||
(
|
||||
input wire clk,
|
||||
input wire rst,
|
||||
|
||||
/*
|
||||
* UDP frame input
|
||||
*/
|
||||
input wire s_udp_hdr_valid,
|
||||
output wire s_udp_hdr_ready,
|
||||
input wire [47:0] s_eth_dest_mac,
|
||||
input wire [47:0] s_eth_src_mac,
|
||||
input wire [15:0] s_eth_type,
|
||||
input wire [3:0] s_ip_version,
|
||||
input wire [3:0] s_ip_ihl,
|
||||
input wire [5:0] s_ip_dscp,
|
||||
input wire [1:0] s_ip_ecn,
|
||||
input wire [15:0] s_ip_length,
|
||||
input wire [15:0] s_ip_identification,
|
||||
input wire [2:0] s_ip_flags,
|
||||
input wire [12:0] s_ip_fragment_offset,
|
||||
input wire [7:0] s_ip_ttl,
|
||||
input wire [7:0] s_ip_protocol,
|
||||
input wire [15:0] s_ip_header_checksum,
|
||||
input wire [31:0] s_ip_source_ip,
|
||||
input wire [31:0] s_ip_dest_ip,
|
||||
input wire [15:0] s_udp_source_port,
|
||||
input wire [15:0] s_udp_dest_port,
|
||||
input wire [15:0] s_udp_length,
|
||||
input wire [15:0] s_udp_checksum,
|
||||
input wire [DATA_WIDTH-1:0] s_udp_payload_axis_tdata,
|
||||
input wire [KEEP_WIDTH-1:0] s_udp_payload_axis_tkeep,
|
||||
input wire s_udp_payload_axis_tvalid,
|
||||
output wire s_udp_payload_axis_tready,
|
||||
input wire s_udp_payload_axis_tlast,
|
||||
input wire [ID_WIDTH-1:0] s_udp_payload_axis_tid,
|
||||
input wire [DEST_WIDTH-1:0] s_udp_payload_axis_tdest,
|
||||
input wire [USER_WIDTH-1:0] s_udp_payload_axis_tuser,
|
||||
|
||||
/*
|
||||
* UDP frame outputs
|
||||
*/
|
||||
output wire [M_COUNT-1:0] m_udp_hdr_valid,
|
||||
input wire [M_COUNT-1:0] m_udp_hdr_ready,
|
||||
output wire [M_COUNT*48-1:0] m_eth_dest_mac,
|
||||
output wire [M_COUNT*48-1:0] m_eth_src_mac,
|
||||
output wire [M_COUNT*16-1:0] m_eth_type,
|
||||
output wire [M_COUNT*4-1:0] m_ip_version,
|
||||
output wire [M_COUNT*4-1:0] m_ip_ihl,
|
||||
output wire [M_COUNT*6-1:0] m_ip_dscp,
|
||||
output wire [M_COUNT*2-1:0] m_ip_ecn,
|
||||
output wire [M_COUNT*16-1:0] m_ip_length,
|
||||
output wire [M_COUNT*16-1:0] m_ip_identification,
|
||||
output wire [M_COUNT*3-1:0] m_ip_flags,
|
||||
output wire [M_COUNT*13-1:0] m_ip_fragment_offset,
|
||||
output wire [M_COUNT*8-1:0] m_ip_ttl,
|
||||
output wire [M_COUNT*8-1:0] m_ip_protocol,
|
||||
output wire [M_COUNT*16-1:0] m_ip_header_checksum,
|
||||
output wire [M_COUNT*32-1:0] m_ip_source_ip,
|
||||
output wire [M_COUNT*32-1:0] m_ip_dest_ip,
|
||||
output wire [M_COUNT*16-1:0] m_udp_source_port,
|
||||
output wire [M_COUNT*16-1:0] m_udp_dest_port,
|
||||
output wire [M_COUNT*16-1:0] m_udp_length,
|
||||
output wire [M_COUNT*16-1:0] m_udp_checksum,
|
||||
output wire [M_COUNT*DATA_WIDTH-1:0] m_udp_payload_axis_tdata,
|
||||
output wire [M_COUNT*KEEP_WIDTH-1:0] m_udp_payload_axis_tkeep,
|
||||
output wire [M_COUNT-1:0] m_udp_payload_axis_tvalid,
|
||||
input wire [M_COUNT-1:0] m_udp_payload_axis_tready,
|
||||
output wire [M_COUNT-1:0] m_udp_payload_axis_tlast,
|
||||
output wire [M_COUNT*ID_WIDTH-1:0] m_udp_payload_axis_tid,
|
||||
output wire [M_COUNT*DEST_WIDTH-1:0] m_udp_payload_axis_tdest,
|
||||
output wire [M_COUNT*USER_WIDTH-1:0] m_udp_payload_axis_tuser,
|
||||
|
||||
/*
|
||||
* Control
|
||||
*/
|
||||
input wire enable,
|
||||
input wire drop,
|
||||
input wire [$clog2(M_COUNT)-1:0] select
|
||||
);
|
||||
|
||||
parameter CL_M_COUNT = $clog2(M_COUNT);
|
||||
|
||||
reg [CL_M_COUNT-1:0] select_reg = {CL_M_COUNT{1'b0}}, select_ctl, select_next;
|
||||
reg drop_reg = 1'b0, drop_ctl, drop_next;
|
||||
reg frame_reg = 1'b0, frame_ctl, frame_next;
|
||||
|
||||
reg s_udp_hdr_ready_reg = 1'b0, s_udp_hdr_ready_next;
|
||||
|
||||
reg s_udp_payload_axis_tready_reg = 1'b0, s_udp_payload_axis_tready_next;
|
||||
|
||||
reg [M_COUNT-1:0] m_udp_hdr_valid_reg = 0, m_udp_hdr_valid_next;
|
||||
reg [47:0] m_eth_dest_mac_reg = 48'd0, m_eth_dest_mac_next;
|
||||
reg [47:0] m_eth_src_mac_reg = 48'd0, m_eth_src_mac_next;
|
||||
reg [15:0] m_eth_type_reg = 16'd0, m_eth_type_next;
|
||||
reg [3:0] m_ip_version_reg = 4'd0, m_ip_version_next;
|
||||
reg [3:0] m_ip_ihl_reg = 4'd0, m_ip_ihl_next;
|
||||
reg [5:0] m_ip_dscp_reg = 6'd0, m_ip_dscp_next;
|
||||
reg [1:0] m_ip_ecn_reg = 2'd0, m_ip_ecn_next;
|
||||
reg [15:0] m_ip_length_reg = 16'd0, m_ip_length_next;
|
||||
reg [15:0] m_ip_identification_reg = 16'd0, m_ip_identification_next;
|
||||
reg [2:0] m_ip_flags_reg = 3'd0, m_ip_flags_next;
|
||||
reg [12:0] m_ip_fragment_offset_reg = 13'd0, m_ip_fragment_offset_next;
|
||||
reg [7:0] m_ip_ttl_reg = 8'd0, m_ip_ttl_next;
|
||||
reg [7:0] m_ip_protocol_reg = 8'd0, m_ip_protocol_next;
|
||||
reg [15:0] m_ip_header_checksum_reg = 16'd0, m_ip_header_checksum_next;
|
||||
reg [31:0] m_ip_source_ip_reg = 32'd0, m_ip_source_ip_next;
|
||||
reg [31:0] m_ip_dest_ip_reg = 32'd0, m_ip_dest_ip_next;
|
||||
reg [15:0] m_udp_source_port_reg = 16'd0, m_udp_source_port_next;
|
||||
reg [15:0] m_udp_dest_port_reg = 16'd0, m_udp_dest_port_next;
|
||||
reg [15:0] m_udp_length_reg = 16'd0, m_udp_length_next;
|
||||
reg [15:0] m_udp_checksum_reg = 16'd0, m_udp_checksum_next;
|
||||
|
||||
// internal datapath
|
||||
reg [DATA_WIDTH-1:0] m_udp_payload_axis_tdata_int;
|
||||
reg [KEEP_WIDTH-1:0] m_udp_payload_axis_tkeep_int;
|
||||
reg [M_COUNT-1:0] m_udp_payload_axis_tvalid_int;
|
||||
reg m_udp_payload_axis_tready_int_reg = 1'b0;
|
||||
reg m_udp_payload_axis_tlast_int;
|
||||
reg [ID_WIDTH-1:0] m_udp_payload_axis_tid_int;
|
||||
reg [DEST_WIDTH-1:0] m_udp_payload_axis_tdest_int;
|
||||
reg [USER_WIDTH-1:0] m_udp_payload_axis_tuser_int;
|
||||
wire m_udp_payload_axis_tready_int_early;
|
||||
|
||||
assign s_udp_hdr_ready = s_udp_hdr_ready_reg && enable;
|
||||
|
||||
assign s_udp_payload_axis_tready = s_udp_payload_axis_tready_reg && enable;
|
||||
|
||||
assign m_udp_hdr_valid = m_udp_hdr_valid_reg;
|
||||
assign m_eth_dest_mac = {M_COUNT{m_eth_dest_mac_reg}};
|
||||
assign m_eth_src_mac = {M_COUNT{m_eth_src_mac_reg}};
|
||||
assign m_eth_type = {M_COUNT{m_eth_type_reg}};
|
||||
assign m_ip_version = {M_COUNT{m_ip_version_reg}};
|
||||
assign m_ip_ihl = {M_COUNT{m_ip_ihl_reg}};
|
||||
assign m_ip_dscp = {M_COUNT{m_ip_dscp_reg}};
|
||||
assign m_ip_ecn = {M_COUNT{m_ip_ecn_reg}};
|
||||
assign m_ip_length = {M_COUNT{m_ip_length_reg}};
|
||||
assign m_ip_identification = {M_COUNT{m_ip_identification_reg}};
|
||||
assign m_ip_flags = {M_COUNT{m_ip_flags_reg}};
|
||||
assign m_ip_fragment_offset = {M_COUNT{m_ip_fragment_offset_reg}};
|
||||
assign m_ip_ttl = {M_COUNT{m_ip_ttl_reg}};
|
||||
assign m_ip_protocol = {M_COUNT{m_ip_protocol_reg}};
|
||||
assign m_ip_header_checksum = {M_COUNT{m_ip_header_checksum_reg}};
|
||||
assign m_ip_source_ip = {M_COUNT{m_ip_source_ip_reg}};
|
||||
assign m_ip_dest_ip = {M_COUNT{m_ip_dest_ip_reg}};
|
||||
assign m_udp_source_port = {M_COUNT{m_udp_source_port_reg}};
|
||||
assign m_udp_dest_port = {M_COUNT{m_udp_dest_port_reg}};
|
||||
assign m_udp_length = {M_COUNT{m_udp_length_reg}};
|
||||
assign m_udp_checksum = {M_COUNT{m_udp_checksum_reg}};
|
||||
|
||||
integer i;
|
||||
|
||||
always @* begin
|
||||
select_next = select_reg;
|
||||
select_ctl = select_reg;
|
||||
drop_next = drop_reg;
|
||||
drop_ctl = drop_reg;
|
||||
frame_next = frame_reg;
|
||||
frame_ctl = frame_reg;
|
||||
|
||||
s_udp_hdr_ready_next = 1'b0;
|
||||
|
||||
s_udp_payload_axis_tready_next = 1'b0;
|
||||
|
||||
m_udp_hdr_valid_next = m_udp_hdr_valid_reg & ~m_udp_hdr_ready;
|
||||
m_eth_dest_mac_next = m_eth_dest_mac_reg;
|
||||
m_eth_src_mac_next = m_eth_src_mac_reg;
|
||||
m_eth_type_next = m_eth_type_reg;
|
||||
m_ip_version_next = m_ip_version_reg;
|
||||
m_ip_ihl_next = m_ip_ihl_reg;
|
||||
m_ip_dscp_next = m_ip_dscp_reg;
|
||||
m_ip_ecn_next = m_ip_ecn_reg;
|
||||
m_ip_length_next = m_ip_length_reg;
|
||||
m_ip_identification_next = m_ip_identification_reg;
|
||||
m_ip_flags_next = m_ip_flags_reg;
|
||||
m_ip_fragment_offset_next = m_ip_fragment_offset_reg;
|
||||
m_ip_ttl_next = m_ip_ttl_reg;
|
||||
m_ip_protocol_next = m_ip_protocol_reg;
|
||||
m_ip_header_checksum_next = m_ip_header_checksum_reg;
|
||||
m_ip_source_ip_next = m_ip_source_ip_reg;
|
||||
m_ip_dest_ip_next = m_ip_dest_ip_reg;
|
||||
m_udp_source_port_next = m_udp_source_port_reg;
|
||||
m_udp_dest_port_next = m_udp_dest_port_reg;
|
||||
m_udp_length_next = m_udp_length_reg;
|
||||
m_udp_checksum_next = m_udp_checksum_reg;
|
||||
|
||||
if (s_udp_payload_axis_tvalid && s_udp_payload_axis_tready) begin
|
||||
// end of frame detection
|
||||
if (s_udp_payload_axis_tlast) begin
|
||||
frame_next = 1'b0;
|
||||
drop_next = 1'b0;
|
||||
end
|
||||
end
|
||||
|
||||
if (!frame_reg && s_udp_hdr_valid && s_udp_hdr_ready) begin
|
||||
// start of frame, grab select value
|
||||
select_ctl = select;
|
||||
drop_ctl = drop;
|
||||
frame_ctl = 1'b1;
|
||||
|
||||
select_next = select_ctl;
|
||||
drop_next = drop_ctl;
|
||||
frame_next = frame_ctl;
|
||||
|
||||
s_udp_hdr_ready_next = 1'b0;
|
||||
|
||||
m_udp_hdr_valid_next = (!drop_ctl) << select_ctl;
|
||||
m_eth_dest_mac_next = s_eth_dest_mac;
|
||||
m_eth_src_mac_next = s_eth_src_mac;
|
||||
m_eth_type_next = s_eth_type;
|
||||
m_ip_version_next = s_ip_version;
|
||||
m_ip_ihl_next = s_ip_ihl;
|
||||
m_ip_dscp_next = s_ip_dscp;
|
||||
m_ip_ecn_next = s_ip_ecn;
|
||||
m_ip_length_next = s_ip_length;
|
||||
m_ip_identification_next = s_ip_identification;
|
||||
m_ip_flags_next = s_ip_flags;
|
||||
m_ip_fragment_offset_next = s_ip_fragment_offset;
|
||||
m_ip_ttl_next = s_ip_ttl;
|
||||
m_ip_protocol_next = s_ip_protocol;
|
||||
m_ip_header_checksum_next = s_ip_header_checksum;
|
||||
m_ip_source_ip_next = s_ip_source_ip;
|
||||
m_ip_dest_ip_next = s_ip_dest_ip;
|
||||
m_udp_source_port_next = s_udp_source_port;
|
||||
m_udp_dest_port_next = s_udp_dest_port;
|
||||
m_udp_length_next = s_udp_length;
|
||||
m_udp_checksum_next = s_udp_checksum;
|
||||
end
|
||||
|
||||
s_udp_hdr_ready_next = !frame_next && !m_udp_hdr_valid_next;
|
||||
|
||||
s_udp_payload_axis_tready_next = (m_udp_payload_axis_tready_int_early || drop_ctl) && frame_ctl;
|
||||
|
||||
m_udp_payload_axis_tdata_int = s_udp_payload_axis_tdata;
|
||||
m_udp_payload_axis_tkeep_int = s_udp_payload_axis_tkeep;
|
||||
m_udp_payload_axis_tvalid_int = (s_udp_payload_axis_tvalid && s_udp_payload_axis_tready && !drop_ctl) << select_ctl;
|
||||
m_udp_payload_axis_tlast_int = s_udp_payload_axis_tlast;
|
||||
m_udp_payload_axis_tid_int = s_udp_payload_axis_tid;
|
||||
m_udp_payload_axis_tdest_int = s_udp_payload_axis_tdest;
|
||||
m_udp_payload_axis_tuser_int = s_udp_payload_axis_tuser;
|
||||
end
|
||||
|
||||
always @(posedge clk) begin
|
||||
if (rst) begin
|
||||
select_reg <= 2'd0;
|
||||
drop_reg <= 1'b0;
|
||||
frame_reg <= 1'b0;
|
||||
s_udp_hdr_ready_reg <= 1'b0;
|
||||
s_udp_payload_axis_tready_reg <= 1'b0;
|
||||
m_udp_hdr_valid_reg <= 0;
|
||||
end else begin
|
||||
select_reg <= select_next;
|
||||
drop_reg <= drop_next;
|
||||
frame_reg <= frame_next;
|
||||
s_udp_hdr_ready_reg <= s_udp_hdr_ready_next;
|
||||
s_udp_payload_axis_tready_reg <= s_udp_payload_axis_tready_next;
|
||||
m_udp_hdr_valid_reg <= m_udp_hdr_valid_next;
|
||||
end
|
||||
|
||||
m_eth_dest_mac_reg <= m_eth_dest_mac_next;
|
||||
m_eth_src_mac_reg <= m_eth_src_mac_next;
|
||||
m_eth_type_reg <= m_eth_type_next;
|
||||
m_ip_version_reg <= m_ip_version_next;
|
||||
m_ip_ihl_reg <= m_ip_ihl_next;
|
||||
m_ip_dscp_reg <= m_ip_dscp_next;
|
||||
m_ip_ecn_reg <= m_ip_ecn_next;
|
||||
m_ip_length_reg <= m_ip_length_next;
|
||||
m_ip_identification_reg <= m_ip_identification_next;
|
||||
m_ip_flags_reg <= m_ip_flags_next;
|
||||
m_ip_fragment_offset_reg <= m_ip_fragment_offset_next;
|
||||
m_ip_ttl_reg <= m_ip_ttl_next;
|
||||
m_ip_protocol_reg <= m_ip_protocol_next;
|
||||
m_ip_header_checksum_reg <= m_ip_header_checksum_next;
|
||||
m_ip_source_ip_reg <= m_ip_source_ip_next;
|
||||
m_ip_dest_ip_reg <= m_ip_dest_ip_next;
|
||||
m_udp_source_port_reg <= m_udp_source_port_next;
|
||||
m_udp_dest_port_reg <= m_udp_dest_port_next;
|
||||
m_udp_length_reg <= m_udp_length_next;
|
||||
m_udp_checksum_reg <= m_udp_checksum_next;
|
||||
end
|
||||
|
||||
// output datapath logic
|
||||
reg [DATA_WIDTH-1:0] m_udp_payload_axis_tdata_reg = {DATA_WIDTH{1'b0}};
|
||||
reg [KEEP_WIDTH-1:0] m_udp_payload_axis_tkeep_reg = {KEEP_WIDTH{1'b0}};
|
||||
reg [M_COUNT-1:0] m_udp_payload_axis_tvalid_reg = {M_COUNT{1'b0}}, m_udp_payload_axis_tvalid_next;
|
||||
reg m_udp_payload_axis_tlast_reg = 1'b0;
|
||||
reg [ID_WIDTH-1:0] m_udp_payload_axis_tid_reg = {ID_WIDTH{1'b0}};
|
||||
reg [DEST_WIDTH-1:0] m_udp_payload_axis_tdest_reg = {DEST_WIDTH{1'b0}};
|
||||
reg [USER_WIDTH-1:0] m_udp_payload_axis_tuser_reg = {USER_WIDTH{1'b0}};
|
||||
|
||||
reg [DATA_WIDTH-1:0] temp_m_udp_payload_axis_tdata_reg = {DATA_WIDTH{1'b0}};
|
||||
reg [KEEP_WIDTH-1:0] temp_m_udp_payload_axis_tkeep_reg = {KEEP_WIDTH{1'b0}};
|
||||
reg [M_COUNT-1:0] temp_m_udp_payload_axis_tvalid_reg = {M_COUNT{1'b0}}, temp_m_udp_payload_axis_tvalid_next;
|
||||
reg temp_m_udp_payload_axis_tlast_reg = 1'b0;
|
||||
reg [ID_WIDTH-1:0] temp_m_udp_payload_axis_tid_reg = {ID_WIDTH{1'b0}};
|
||||
reg [DEST_WIDTH-1:0] temp_m_udp_payload_axis_tdest_reg = {DEST_WIDTH{1'b0}};
|
||||
reg [USER_WIDTH-1:0] temp_m_udp_payload_axis_tuser_reg = {USER_WIDTH{1'b0}};
|
||||
|
||||
// datapath control
|
||||
reg store_axis_int_to_output;
|
||||
reg store_axis_int_to_temp;
|
||||
reg store_udp_payload_axis_temp_to_output;
|
||||
|
||||
assign m_udp_payload_axis_tdata = {M_COUNT{m_udp_payload_axis_tdata_reg}};
|
||||
assign m_udp_payload_axis_tkeep = KEEP_ENABLE ? {M_COUNT{m_udp_payload_axis_tkeep_reg}} : {M_COUNT*KEEP_WIDTH{1'b1}};
|
||||
assign m_udp_payload_axis_tvalid = m_udp_payload_axis_tvalid_reg;
|
||||
assign m_udp_payload_axis_tlast = {M_COUNT{m_udp_payload_axis_tlast_reg}};
|
||||
assign m_udp_payload_axis_tid = ID_ENABLE ? {M_COUNT{m_udp_payload_axis_tid_reg}} : {M_COUNT*ID_WIDTH{1'b0}};
|
||||
assign m_udp_payload_axis_tdest = DEST_ENABLE ? {M_COUNT{m_udp_payload_axis_tdest_reg}} : {M_COUNT*DEST_WIDTH{1'b0}};
|
||||
assign m_udp_payload_axis_tuser = USER_ENABLE ? {M_COUNT{m_udp_payload_axis_tuser_reg}} : {M_COUNT*USER_WIDTH{1'b0}};
|
||||
|
||||
// enable ready input next cycle if output is ready or the temp reg will not be filled on the next cycle (output reg empty or no input)
|
||||
assign m_udp_payload_axis_tready_int_early = (m_udp_payload_axis_tready & m_udp_payload_axis_tvalid) || (!temp_m_udp_payload_axis_tvalid_reg && (!m_udp_payload_axis_tvalid || !m_udp_payload_axis_tvalid_int));
|
||||
|
||||
always @* begin
|
||||
// transfer sink ready state to source
|
||||
m_udp_payload_axis_tvalid_next = m_udp_payload_axis_tvalid_reg;
|
||||
temp_m_udp_payload_axis_tvalid_next = temp_m_udp_payload_axis_tvalid_reg;
|
||||
|
||||
store_axis_int_to_output = 1'b0;
|
||||
store_axis_int_to_temp = 1'b0;
|
||||
store_udp_payload_axis_temp_to_output = 1'b0;
|
||||
|
||||
if (m_udp_payload_axis_tready_int_reg) begin
|
||||
// input is ready
|
||||
if ((m_udp_payload_axis_tready & m_udp_payload_axis_tvalid) || !m_udp_payload_axis_tvalid) begin
|
||||
// output is ready or currently not valid, transfer data to output
|
||||
m_udp_payload_axis_tvalid_next = m_udp_payload_axis_tvalid_int;
|
||||
store_axis_int_to_output = 1'b1;
|
||||
end else begin
|
||||
// output is not ready, store input in temp
|
||||
temp_m_udp_payload_axis_tvalid_next = m_udp_payload_axis_tvalid_int;
|
||||
store_axis_int_to_temp = 1'b1;
|
||||
end
|
||||
end else if (m_udp_payload_axis_tready & m_udp_payload_axis_tvalid) begin
|
||||
// input is not ready, but output is ready
|
||||
m_udp_payload_axis_tvalid_next = temp_m_udp_payload_axis_tvalid_reg;
|
||||
temp_m_udp_payload_axis_tvalid_next = 1'b0;
|
||||
store_udp_payload_axis_temp_to_output = 1'b1;
|
||||
end
|
||||
end
|
||||
|
||||
always @(posedge clk) begin
|
||||
if (rst) begin
|
||||
m_udp_payload_axis_tvalid_reg <= {M_COUNT{1'b0}};
|
||||
m_udp_payload_axis_tready_int_reg <= 1'b0;
|
||||
temp_m_udp_payload_axis_tvalid_reg <= 1'b0;
|
||||
end else begin
|
||||
m_udp_payload_axis_tvalid_reg <= m_udp_payload_axis_tvalid_next;
|
||||
m_udp_payload_axis_tready_int_reg <= m_udp_payload_axis_tready_int_early;
|
||||
temp_m_udp_payload_axis_tvalid_reg <= temp_m_udp_payload_axis_tvalid_next;
|
||||
end
|
||||
|
||||
// datapath
|
||||
if (store_axis_int_to_output) begin
|
||||
m_udp_payload_axis_tdata_reg <= m_udp_payload_axis_tdata_int;
|
||||
m_udp_payload_axis_tkeep_reg <= m_udp_payload_axis_tkeep_int;
|
||||
m_udp_payload_axis_tlast_reg <= m_udp_payload_axis_tlast_int;
|
||||
m_udp_payload_axis_tid_reg <= m_udp_payload_axis_tid_int;
|
||||
m_udp_payload_axis_tdest_reg <= m_udp_payload_axis_tdest_int;
|
||||
m_udp_payload_axis_tuser_reg <= m_udp_payload_axis_tuser_int;
|
||||
end else if (store_udp_payload_axis_temp_to_output) begin
|
||||
m_udp_payload_axis_tdata_reg <= temp_m_udp_payload_axis_tdata_reg;
|
||||
m_udp_payload_axis_tkeep_reg <= temp_m_udp_payload_axis_tkeep_reg;
|
||||
m_udp_payload_axis_tlast_reg <= temp_m_udp_payload_axis_tlast_reg;
|
||||
m_udp_payload_axis_tid_reg <= temp_m_udp_payload_axis_tid_reg;
|
||||
m_udp_payload_axis_tdest_reg <= temp_m_udp_payload_axis_tdest_reg;
|
||||
m_udp_payload_axis_tuser_reg <= temp_m_udp_payload_axis_tuser_reg;
|
||||
end
|
||||
|
||||
if (store_axis_int_to_temp) begin
|
||||
temp_m_udp_payload_axis_tdata_reg <= m_udp_payload_axis_tdata_int;
|
||||
temp_m_udp_payload_axis_tkeep_reg <= m_udp_payload_axis_tkeep_int;
|
||||
temp_m_udp_payload_axis_tlast_reg <= m_udp_payload_axis_tlast_int;
|
||||
temp_m_udp_payload_axis_tid_reg <= m_udp_payload_axis_tid_int;
|
||||
temp_m_udp_payload_axis_tdest_reg <= m_udp_payload_axis_tdest_int;
|
||||
temp_m_udp_payload_axis_tuser_reg <= m_udp_payload_axis_tuser_int;
|
||||
end
|
||||
end
|
||||
|
||||
endmodule
|
@ -1,598 +0,0 @@
|
||||
/*
|
||||
|
||||
Copyright (c) 2014-2018 Alex Forencich
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
|
||||
*/
|
||||
|
||||
// Language: Verilog 2001
|
||||
|
||||
`timescale 1ns / 1ps
|
||||
|
||||
/*
|
||||
* UDP 4 port demultiplexer
|
||||
*/
|
||||
module udp_demux_4
|
||||
(
|
||||
input wire clk,
|
||||
input wire rst,
|
||||
|
||||
/*
|
||||
* UDP frame input
|
||||
*/
|
||||
input wire input_udp_hdr_valid,
|
||||
output wire input_udp_hdr_ready,
|
||||
input wire [47:0] input_eth_dest_mac,
|
||||
input wire [47:0] input_eth_src_mac,
|
||||
input wire [15:0] input_eth_type,
|
||||
input wire [3:0] input_ip_version,
|
||||
input wire [3:0] input_ip_ihl,
|
||||
input wire [5:0] input_ip_dscp,
|
||||
input wire [1:0] input_ip_ecn,
|
||||
input wire [15:0] input_ip_length,
|
||||
input wire [15:0] input_ip_identification,
|
||||
input wire [2:0] input_ip_flags,
|
||||
input wire [12:0] input_ip_fragment_offset,
|
||||
input wire [7:0] input_ip_ttl,
|
||||
input wire [7:0] input_ip_protocol,
|
||||
input wire [15:0] input_ip_header_checksum,
|
||||
input wire [31:0] input_ip_source_ip,
|
||||
input wire [31:0] input_ip_dest_ip,
|
||||
input wire [15:0] input_udp_source_port,
|
||||
input wire [15:0] input_udp_dest_port,
|
||||
input wire [15:0] input_udp_length,
|
||||
input wire [15:0] input_udp_checksum,
|
||||
input wire [7:0] input_udp_payload_tdata,
|
||||
input wire input_udp_payload_tvalid,
|
||||
output wire input_udp_payload_tready,
|
||||
input wire input_udp_payload_tlast,
|
||||
input wire input_udp_payload_tuser,
|
||||
|
||||
/*
|
||||
* UDP frame outputs
|
||||
*/
|
||||
output wire output_0_udp_hdr_valid,
|
||||
input wire output_0_udp_hdr_ready,
|
||||
output wire [47:0] output_0_eth_dest_mac,
|
||||
output wire [47:0] output_0_eth_src_mac,
|
||||
output wire [15:0] output_0_eth_type,
|
||||
output wire [3:0] output_0_ip_version,
|
||||
output wire [3:0] output_0_ip_ihl,
|
||||
output wire [5:0] output_0_ip_dscp,
|
||||
output wire [1:0] output_0_ip_ecn,
|
||||
output wire [15:0] output_0_ip_length,
|
||||
output wire [15:0] output_0_ip_identification,
|
||||
output wire [2:0] output_0_ip_flags,
|
||||
output wire [12:0] output_0_ip_fragment_offset,
|
||||
output wire [7:0] output_0_ip_ttl,
|
||||
output wire [7:0] output_0_ip_protocol,
|
||||
output wire [15:0] output_0_ip_header_checksum,
|
||||
output wire [31:0] output_0_ip_source_ip,
|
||||
output wire [31:0] output_0_ip_dest_ip,
|
||||
output wire [15:0] output_0_udp_source_port,
|
||||
output wire [15:0] output_0_udp_dest_port,
|
||||
output wire [15:0] output_0_udp_length,
|
||||
output wire [15:0] output_0_udp_checksum,
|
||||
output wire [7:0] output_0_udp_payload_tdata,
|
||||
output wire output_0_udp_payload_tvalid,
|
||||
input wire output_0_udp_payload_tready,
|
||||
output wire output_0_udp_payload_tlast,
|
||||
output wire output_0_udp_payload_tuser,
|
||||
|
||||
output wire output_1_udp_hdr_valid,
|
||||
input wire output_1_udp_hdr_ready,
|
||||
output wire [47:0] output_1_eth_dest_mac,
|
||||
output wire [47:0] output_1_eth_src_mac,
|
||||
output wire [15:0] output_1_eth_type,
|
||||
output wire [3:0] output_1_ip_version,
|
||||
output wire [3:0] output_1_ip_ihl,
|
||||
output wire [5:0] output_1_ip_dscp,
|
||||
output wire [1:0] output_1_ip_ecn,
|
||||
output wire [15:0] output_1_ip_length,
|
||||
output wire [15:0] output_1_ip_identification,
|
||||
output wire [2:0] output_1_ip_flags,
|
||||
output wire [12:0] output_1_ip_fragment_offset,
|
||||
output wire [7:0] output_1_ip_ttl,
|
||||
output wire [7:0] output_1_ip_protocol,
|
||||
output wire [15:0] output_1_ip_header_checksum,
|
||||
output wire [31:0] output_1_ip_source_ip,
|
||||
output wire [31:0] output_1_ip_dest_ip,
|
||||
output wire [15:0] output_1_udp_source_port,
|
||||
output wire [15:0] output_1_udp_dest_port,
|
||||
output wire [15:0] output_1_udp_length,
|
||||
output wire [15:0] output_1_udp_checksum,
|
||||
output wire [7:0] output_1_udp_payload_tdata,
|
||||
output wire output_1_udp_payload_tvalid,
|
||||
input wire output_1_udp_payload_tready,
|
||||
output wire output_1_udp_payload_tlast,
|
||||
output wire output_1_udp_payload_tuser,
|
||||
|
||||
output wire output_2_udp_hdr_valid,
|
||||
input wire output_2_udp_hdr_ready,
|
||||
output wire [47:0] output_2_eth_dest_mac,
|
||||
output wire [47:0] output_2_eth_src_mac,
|
||||
output wire [15:0] output_2_eth_type,
|
||||
output wire [3:0] output_2_ip_version,
|
||||
output wire [3:0] output_2_ip_ihl,
|
||||
output wire [5:0] output_2_ip_dscp,
|
||||
output wire [1:0] output_2_ip_ecn,
|
||||
output wire [15:0] output_2_ip_length,
|
||||
output wire [15:0] output_2_ip_identification,
|
||||
output wire [2:0] output_2_ip_flags,
|
||||
output wire [12:0] output_2_ip_fragment_offset,
|
||||
output wire [7:0] output_2_ip_ttl,
|
||||
output wire [7:0] output_2_ip_protocol,
|
||||
output wire [15:0] output_2_ip_header_checksum,
|
||||
output wire [31:0] output_2_ip_source_ip,
|
||||
output wire [31:0] output_2_ip_dest_ip,
|
||||
output wire [15:0] output_2_udp_source_port,
|
||||
output wire [15:0] output_2_udp_dest_port,
|
||||
output wire [15:0] output_2_udp_length,
|
||||
output wire [15:0] output_2_udp_checksum,
|
||||
output wire [7:0] output_2_udp_payload_tdata,
|
||||
output wire output_2_udp_payload_tvalid,
|
||||
input wire output_2_udp_payload_tready,
|
||||
output wire output_2_udp_payload_tlast,
|
||||
output wire output_2_udp_payload_tuser,
|
||||
|
||||
output wire output_3_udp_hdr_valid,
|
||||
input wire output_3_udp_hdr_ready,
|
||||
output wire [47:0] output_3_eth_dest_mac,
|
||||
output wire [47:0] output_3_eth_src_mac,
|
||||
output wire [15:0] output_3_eth_type,
|
||||
output wire [3:0] output_3_ip_version,
|
||||
output wire [3:0] output_3_ip_ihl,
|
||||
output wire [5:0] output_3_ip_dscp,
|
||||
output wire [1:0] output_3_ip_ecn,
|
||||
output wire [15:0] output_3_ip_length,
|
||||
output wire [15:0] output_3_ip_identification,
|
||||
output wire [2:0] output_3_ip_flags,
|
||||
output wire [12:0] output_3_ip_fragment_offset,
|
||||
output wire [7:0] output_3_ip_ttl,
|
||||
output wire [7:0] output_3_ip_protocol,
|
||||
output wire [15:0] output_3_ip_header_checksum,
|
||||
output wire [31:0] output_3_ip_source_ip,
|
||||
output wire [31:0] output_3_ip_dest_ip,
|
||||
output wire [15:0] output_3_udp_source_port,
|
||||
output wire [15:0] output_3_udp_dest_port,
|
||||
output wire [15:0] output_3_udp_length,
|
||||
output wire [15:0] output_3_udp_checksum,
|
||||
output wire [7:0] output_3_udp_payload_tdata,
|
||||
output wire output_3_udp_payload_tvalid,
|
||||
input wire output_3_udp_payload_tready,
|
||||
output wire output_3_udp_payload_tlast,
|
||||
output wire output_3_udp_payload_tuser,
|
||||
|
||||
/*
|
||||
* Control
|
||||
*/
|
||||
input wire enable,
|
||||
input wire [1:0] select
|
||||
);
|
||||
|
||||
reg [1:0] select_reg = 2'd0, select_next;
|
||||
reg frame_reg = 1'b0, frame_next;
|
||||
|
||||
reg input_udp_hdr_ready_reg = 1'b0, input_udp_hdr_ready_next;
|
||||
reg input_udp_payload_tready_reg = 1'b0, input_udp_payload_tready_next;
|
||||
|
||||
reg output_0_udp_hdr_valid_reg = 1'b0, output_0_udp_hdr_valid_next;
|
||||
reg output_1_udp_hdr_valid_reg = 1'b0, output_1_udp_hdr_valid_next;
|
||||
reg output_2_udp_hdr_valid_reg = 1'b0, output_2_udp_hdr_valid_next;
|
||||
reg output_3_udp_hdr_valid_reg = 1'b0, output_3_udp_hdr_valid_next;
|
||||
reg [47:0] output_eth_dest_mac_reg = 48'd0, output_eth_dest_mac_next;
|
||||
reg [47:0] output_eth_src_mac_reg = 48'd0, output_eth_src_mac_next;
|
||||
reg [15:0] output_eth_type_reg = 16'd0, output_eth_type_next;
|
||||
reg [3:0] output_ip_version_reg = 4'd0, output_ip_version_next;
|
||||
reg [3:0] output_ip_ihl_reg = 4'd0, output_ip_ihl_next;
|
||||
reg [5:0] output_ip_dscp_reg = 6'd0, output_ip_dscp_next;
|
||||
reg [1:0] output_ip_ecn_reg = 2'd0, output_ip_ecn_next;
|
||||
reg [15:0] output_ip_length_reg = 16'd0, output_ip_length_next;
|
||||
reg [15:0] output_ip_identification_reg = 16'd0, output_ip_identification_next;
|
||||
reg [2:0] output_ip_flags_reg = 3'd0, output_ip_flags_next;
|
||||
reg [12:0] output_ip_fragment_offset_reg = 13'd0, output_ip_fragment_offset_next;
|
||||
reg [7:0] output_ip_ttl_reg = 8'd0, output_ip_ttl_next;
|
||||
reg [7:0] output_ip_protocol_reg = 8'd0, output_ip_protocol_next;
|
||||
reg [15:0] output_ip_header_checksum_reg = 16'd0, output_ip_header_checksum_next;
|
||||
reg [31:0] output_ip_source_ip_reg = 32'd0, output_ip_source_ip_next;
|
||||
reg [31:0] output_ip_dest_ip_reg = 32'd0, output_ip_dest_ip_next;
|
||||
reg [15:0] output_udp_source_port_reg = 16'd0, output_udp_source_port_next;
|
||||
reg [15:0] output_udp_dest_port_reg = 16'd0, output_udp_dest_port_next;
|
||||
reg [15:0] output_udp_length_reg = 16'd0, output_udp_length_next;
|
||||
reg [15:0] output_udp_checksum_reg = 16'd0, output_udp_checksum_next;
|
||||
|
||||
// internal datapath
|
||||
reg [7:0] output_udp_payload_tdata_int;
|
||||
reg output_udp_payload_tvalid_int;
|
||||
reg output_udp_payload_tready_int_reg = 1'b0;
|
||||
reg output_udp_payload_tlast_int;
|
||||
reg output_udp_payload_tuser_int;
|
||||
wire output_udp_payload_tready_int_early;
|
||||
|
||||
assign input_udp_hdr_ready = input_udp_hdr_ready_reg;
|
||||
assign input_udp_payload_tready = input_udp_payload_tready_reg;
|
||||
|
||||
assign output_0_udp_hdr_valid = output_0_udp_hdr_valid_reg;
|
||||
assign output_0_eth_dest_mac = output_eth_dest_mac_reg;
|
||||
assign output_0_eth_src_mac = output_eth_src_mac_reg;
|
||||
assign output_0_eth_type = output_eth_type_reg;
|
||||
assign output_0_ip_version = output_ip_version_reg;
|
||||
assign output_0_ip_ihl = output_ip_ihl_reg;
|
||||
assign output_0_ip_dscp = output_ip_dscp_reg;
|
||||
assign output_0_ip_ecn = output_ip_ecn_reg;
|
||||
assign output_0_ip_length = output_ip_length_reg;
|
||||
assign output_0_ip_identification = output_ip_identification_reg;
|
||||
assign output_0_ip_flags = output_ip_flags_reg;
|
||||
assign output_0_ip_fragment_offset = output_ip_fragment_offset_reg;
|
||||
assign output_0_ip_ttl = output_ip_ttl_reg;
|
||||
assign output_0_ip_protocol = output_ip_protocol_reg;
|
||||
assign output_0_ip_header_checksum = output_ip_header_checksum_reg;
|
||||
assign output_0_ip_source_ip = output_ip_source_ip_reg;
|
||||
assign output_0_ip_dest_ip = output_ip_dest_ip_reg;
|
||||
assign output_0_udp_source_port = output_udp_source_port_reg;
|
||||
assign output_0_udp_dest_port = output_udp_dest_port_reg;
|
||||
assign output_0_udp_length = output_udp_length_reg;
|
||||
assign output_0_udp_checksum = output_udp_checksum_reg;
|
||||
|
||||
assign output_1_udp_hdr_valid = output_1_udp_hdr_valid_reg;
|
||||
assign output_1_eth_dest_mac = output_eth_dest_mac_reg;
|
||||
assign output_1_eth_src_mac = output_eth_src_mac_reg;
|
||||
assign output_1_eth_type = output_eth_type_reg;
|
||||
assign output_1_ip_version = output_ip_version_reg;
|
||||
assign output_1_ip_ihl = output_ip_ihl_reg;
|
||||
assign output_1_ip_dscp = output_ip_dscp_reg;
|
||||
assign output_1_ip_ecn = output_ip_ecn_reg;
|
||||
assign output_1_ip_length = output_ip_length_reg;
|
||||
assign output_1_ip_identification = output_ip_identification_reg;
|
||||
assign output_1_ip_flags = output_ip_flags_reg;
|
||||
assign output_1_ip_fragment_offset = output_ip_fragment_offset_reg;
|
||||
assign output_1_ip_ttl = output_ip_ttl_reg;
|
||||
assign output_1_ip_protocol = output_ip_protocol_reg;
|
||||
assign output_1_ip_header_checksum = output_ip_header_checksum_reg;
|
||||
assign output_1_ip_source_ip = output_ip_source_ip_reg;
|
||||
assign output_1_ip_dest_ip = output_ip_dest_ip_reg;
|
||||
assign output_1_udp_source_port = output_udp_source_port_reg;
|
||||
assign output_1_udp_dest_port = output_udp_dest_port_reg;
|
||||
assign output_1_udp_length = output_udp_length_reg;
|
||||
assign output_1_udp_checksum = output_udp_checksum_reg;
|
||||
|
||||
assign output_2_udp_hdr_valid = output_2_udp_hdr_valid_reg;
|
||||
assign output_2_eth_dest_mac = output_eth_dest_mac_reg;
|
||||
assign output_2_eth_src_mac = output_eth_src_mac_reg;
|
||||
assign output_2_eth_type = output_eth_type_reg;
|
||||
assign output_2_ip_version = output_ip_version_reg;
|
||||
assign output_2_ip_ihl = output_ip_ihl_reg;
|
||||
assign output_2_ip_dscp = output_ip_dscp_reg;
|
||||
assign output_2_ip_ecn = output_ip_ecn_reg;
|
||||
assign output_2_ip_length = output_ip_length_reg;
|
||||
assign output_2_ip_identification = output_ip_identification_reg;
|
||||
assign output_2_ip_flags = output_ip_flags_reg;
|
||||
assign output_2_ip_fragment_offset = output_ip_fragment_offset_reg;
|
||||
assign output_2_ip_ttl = output_ip_ttl_reg;
|
||||
assign output_2_ip_protocol = output_ip_protocol_reg;
|
||||
assign output_2_ip_header_checksum = output_ip_header_checksum_reg;
|
||||
assign output_2_ip_source_ip = output_ip_source_ip_reg;
|
||||
assign output_2_ip_dest_ip = output_ip_dest_ip_reg;
|
||||
assign output_2_udp_source_port = output_udp_source_port_reg;
|
||||
assign output_2_udp_dest_port = output_udp_dest_port_reg;
|
||||
assign output_2_udp_length = output_udp_length_reg;
|
||||
assign output_2_udp_checksum = output_udp_checksum_reg;
|
||||
|
||||
assign output_3_udp_hdr_valid = output_3_udp_hdr_valid_reg;
|
||||
assign output_3_eth_dest_mac = output_eth_dest_mac_reg;
|
||||
assign output_3_eth_src_mac = output_eth_src_mac_reg;
|
||||
assign output_3_eth_type = output_eth_type_reg;
|
||||
assign output_3_ip_version = output_ip_version_reg;
|
||||
assign output_3_ip_ihl = output_ip_ihl_reg;
|
||||
assign output_3_ip_dscp = output_ip_dscp_reg;
|
||||
assign output_3_ip_ecn = output_ip_ecn_reg;
|
||||
assign output_3_ip_length = output_ip_length_reg;
|
||||
assign output_3_ip_identification = output_ip_identification_reg;
|
||||
assign output_3_ip_flags = output_ip_flags_reg;
|
||||
assign output_3_ip_fragment_offset = output_ip_fragment_offset_reg;
|
||||
assign output_3_ip_ttl = output_ip_ttl_reg;
|
||||
assign output_3_ip_protocol = output_ip_protocol_reg;
|
||||
assign output_3_ip_header_checksum = output_ip_header_checksum_reg;
|
||||
assign output_3_ip_source_ip = output_ip_source_ip_reg;
|
||||
assign output_3_ip_dest_ip = output_ip_dest_ip_reg;
|
||||
assign output_3_udp_source_port = output_udp_source_port_reg;
|
||||
assign output_3_udp_dest_port = output_udp_dest_port_reg;
|
||||
assign output_3_udp_length = output_udp_length_reg;
|
||||
assign output_3_udp_checksum = output_udp_checksum_reg;
|
||||
|
||||
// mux for output control signals
|
||||
reg current_output_udp_hdr_valid;
|
||||
reg current_output_udp_hdr_ready;
|
||||
reg current_output_tvalid;
|
||||
reg current_output_tready;
|
||||
always @* begin
|
||||
case (select_reg)
|
||||
2'd0: begin
|
||||
current_output_udp_hdr_valid = output_0_udp_hdr_valid;
|
||||
current_output_udp_hdr_ready = output_0_udp_hdr_ready;
|
||||
current_output_tvalid = output_0_udp_payload_tvalid;
|
||||
current_output_tready = output_0_udp_payload_tready;
|
||||
end
|
||||
2'd1: begin
|
||||
current_output_udp_hdr_valid = output_1_udp_hdr_valid;
|
||||
current_output_udp_hdr_ready = output_1_udp_hdr_ready;
|
||||
current_output_tvalid = output_1_udp_payload_tvalid;
|
||||
current_output_tready = output_1_udp_payload_tready;
|
||||
end
|
||||
2'd2: begin
|
||||
current_output_udp_hdr_valid = output_2_udp_hdr_valid;
|
||||
current_output_udp_hdr_ready = output_2_udp_hdr_ready;
|
||||
current_output_tvalid = output_2_udp_payload_tvalid;
|
||||
current_output_tready = output_2_udp_payload_tready;
|
||||
end
|
||||
2'd3: begin
|
||||
current_output_udp_hdr_valid = output_3_udp_hdr_valid;
|
||||
current_output_udp_hdr_ready = output_3_udp_hdr_ready;
|
||||
current_output_tvalid = output_3_udp_payload_tvalid;
|
||||
current_output_tready = output_3_udp_payload_tready;
|
||||
end
|
||||
default: begin
|
||||
current_output_udp_hdr_valid = 1'b0;
|
||||
current_output_udp_hdr_ready = 1'b0;
|
||||
current_output_tvalid = 1'b0;
|
||||
current_output_tready = 1'b0;
|
||||
end
|
||||
endcase
|
||||
end
|
||||
|
||||
always @* begin
|
||||
select_next = select_reg;
|
||||
frame_next = frame_reg;
|
||||
|
||||
input_udp_hdr_ready_next = input_udp_hdr_ready_reg & ~input_udp_hdr_valid;
|
||||
input_udp_payload_tready_next = 1'b0;
|
||||
output_0_udp_hdr_valid_next = output_0_udp_hdr_valid_reg & ~output_0_udp_hdr_ready;
|
||||
output_1_udp_hdr_valid_next = output_1_udp_hdr_valid_reg & ~output_1_udp_hdr_ready;
|
||||
output_2_udp_hdr_valid_next = output_2_udp_hdr_valid_reg & ~output_2_udp_hdr_ready;
|
||||
output_3_udp_hdr_valid_next = output_3_udp_hdr_valid_reg & ~output_3_udp_hdr_ready;
|
||||
output_eth_dest_mac_next = output_eth_dest_mac_reg;
|
||||
output_eth_src_mac_next = output_eth_src_mac_reg;
|
||||
output_eth_type_next = output_eth_type_reg;
|
||||
output_ip_version_next = output_ip_version_reg;
|
||||
output_ip_ihl_next = output_ip_ihl_reg;
|
||||
output_ip_dscp_next = output_ip_dscp_reg;
|
||||
output_ip_ecn_next = output_ip_ecn_reg;
|
||||
output_ip_length_next = output_ip_length_reg;
|
||||
output_ip_identification_next = output_ip_identification_reg;
|
||||
output_ip_flags_next = output_ip_flags_reg;
|
||||
output_ip_fragment_offset_next = output_ip_fragment_offset_reg;
|
||||
output_ip_ttl_next = output_ip_ttl_reg;
|
||||
output_ip_protocol_next = output_ip_protocol_reg;
|
||||
output_ip_header_checksum_next = output_ip_header_checksum_reg;
|
||||
output_ip_source_ip_next = output_ip_source_ip_reg;
|
||||
output_ip_dest_ip_next = output_ip_dest_ip_reg;
|
||||
output_udp_source_port_next = output_udp_source_port_reg;
|
||||
output_udp_dest_port_next = output_udp_dest_port_reg;
|
||||
output_udp_length_next = output_udp_length_reg;
|
||||
output_udp_checksum_next = output_udp_checksum_reg;
|
||||
|
||||
if (input_udp_payload_tvalid & input_udp_payload_tready) begin
|
||||
// end of frame detection
|
||||
if (input_udp_payload_tlast) begin
|
||||
frame_next = 1'b0;
|
||||
end
|
||||
end
|
||||
|
||||
if (~frame_reg & enable & input_udp_hdr_valid & ~current_output_udp_hdr_valid & ~current_output_tvalid) begin
|
||||
// start of frame, grab select value
|
||||
frame_next = 1'b1;
|
||||
select_next = select;
|
||||
|
||||
input_udp_hdr_ready_next = 1'b1;
|
||||
|
||||
case (select)
|
||||
2'd0: output_0_udp_hdr_valid_next = 1'b1;
|
||||
2'd1: output_1_udp_hdr_valid_next = 1'b1;
|
||||
2'd2: output_2_udp_hdr_valid_next = 1'b1;
|
||||
2'd3: output_3_udp_hdr_valid_next = 1'b1;
|
||||
endcase
|
||||
output_eth_dest_mac_next = input_eth_dest_mac;
|
||||
output_eth_src_mac_next = input_eth_src_mac;
|
||||
output_eth_type_next = input_eth_type;
|
||||
output_ip_version_next = input_ip_version;
|
||||
output_ip_ihl_next = input_ip_ihl;
|
||||
output_ip_dscp_next = input_ip_dscp;
|
||||
output_ip_ecn_next = input_ip_ecn;
|
||||
output_ip_length_next = input_ip_length;
|
||||
output_ip_identification_next = input_ip_identification;
|
||||
output_ip_flags_next = input_ip_flags;
|
||||
output_ip_fragment_offset_next = input_ip_fragment_offset;
|
||||
output_ip_ttl_next = input_ip_ttl;
|
||||
output_ip_protocol_next = input_ip_protocol;
|
||||
output_ip_header_checksum_next = input_ip_header_checksum;
|
||||
output_ip_source_ip_next = input_ip_source_ip;
|
||||
output_ip_dest_ip_next = input_ip_dest_ip;
|
||||
output_udp_source_port_next = input_udp_source_port;
|
||||
output_udp_dest_port_next = input_udp_dest_port;
|
||||
output_udp_length_next = input_udp_length;
|
||||
output_udp_checksum_next = input_udp_checksum;
|
||||
end
|
||||
|
||||
input_udp_payload_tready_next = output_udp_payload_tready_int_early & frame_next;
|
||||
|
||||
output_udp_payload_tdata_int = input_udp_payload_tdata;
|
||||
output_udp_payload_tvalid_int = input_udp_payload_tvalid & input_udp_payload_tready;
|
||||
output_udp_payload_tlast_int = input_udp_payload_tlast;
|
||||
output_udp_payload_tuser_int = input_udp_payload_tuser;
|
||||
end
|
||||
|
||||
always @(posedge clk) begin
|
||||
if (rst) begin
|
||||
select_reg <= 2'd0;
|
||||
frame_reg <= 1'b0;
|
||||
input_udp_hdr_ready_reg <= 1'b0;
|
||||
input_udp_payload_tready_reg <= 1'b0;
|
||||
output_0_udp_hdr_valid_reg <= 1'b0;
|
||||
output_1_udp_hdr_valid_reg <= 1'b0;
|
||||
output_2_udp_hdr_valid_reg <= 1'b0;
|
||||
output_3_udp_hdr_valid_reg <= 1'b0;
|
||||
end else begin
|
||||
select_reg <= select_next;
|
||||
frame_reg <= frame_next;
|
||||
input_udp_hdr_ready_reg <= input_udp_hdr_ready_next;
|
||||
input_udp_payload_tready_reg <= input_udp_payload_tready_next;
|
||||
output_0_udp_hdr_valid_reg <= output_0_udp_hdr_valid_next;
|
||||
output_1_udp_hdr_valid_reg <= output_1_udp_hdr_valid_next;
|
||||
output_2_udp_hdr_valid_reg <= output_2_udp_hdr_valid_next;
|
||||
output_3_udp_hdr_valid_reg <= output_3_udp_hdr_valid_next;
|
||||
end
|
||||
|
||||
output_eth_dest_mac_reg <= output_eth_dest_mac_next;
|
||||
output_eth_src_mac_reg <= output_eth_src_mac_next;
|
||||
output_eth_type_reg <= output_eth_type_next;
|
||||
output_ip_version_reg <= output_ip_version_next;
|
||||
output_ip_ihl_reg <= output_ip_ihl_next;
|
||||
output_ip_dscp_reg <= output_ip_dscp_next;
|
||||
output_ip_ecn_reg <= output_ip_ecn_next;
|
||||
output_ip_length_reg <= output_ip_length_next;
|
||||
output_ip_identification_reg <= output_ip_identification_next;
|
||||
output_ip_flags_reg <= output_ip_flags_next;
|
||||
output_ip_fragment_offset_reg <= output_ip_fragment_offset_next;
|
||||
output_ip_ttl_reg <= output_ip_ttl_next;
|
||||
output_ip_protocol_reg <= output_ip_protocol_next;
|
||||
output_ip_header_checksum_reg <= output_ip_header_checksum_next;
|
||||
output_ip_source_ip_reg <= output_ip_source_ip_next;
|
||||
output_ip_dest_ip_reg <= output_ip_dest_ip_next;
|
||||
output_udp_source_port_reg <= output_udp_source_port_next;
|
||||
output_udp_dest_port_reg <= output_udp_dest_port_next;
|
||||
output_udp_length_reg <= output_udp_length_next;
|
||||
output_udp_checksum_reg <= output_udp_checksum_next;
|
||||
end
|
||||
|
||||
// output datapath logic
|
||||
reg [7:0] output_udp_payload_tdata_reg = 8'd0;
|
||||
reg output_0_udp_payload_tvalid_reg = 1'b0, output_0_udp_payload_tvalid_next;
|
||||
reg output_1_udp_payload_tvalid_reg = 1'b0, output_1_udp_payload_tvalid_next;
|
||||
reg output_2_udp_payload_tvalid_reg = 1'b0, output_2_udp_payload_tvalid_next;
|
||||
reg output_3_udp_payload_tvalid_reg = 1'b0, output_3_udp_payload_tvalid_next;
|
||||
reg output_udp_payload_tlast_reg = 1'b0;
|
||||
reg output_udp_payload_tuser_reg = 1'b0;
|
||||
|
||||
reg [7:0] temp_udp_payload_tdata_reg = 8'd0;
|
||||
reg temp_udp_payload_tvalid_reg = 1'b0, temp_udp_payload_tvalid_next;
|
||||
reg temp_udp_payload_tlast_reg = 1'b0;
|
||||
reg temp_udp_payload_tuser_reg = 1'b0;
|
||||
|
||||
// datapath control
|
||||
reg store_udp_payload_int_to_output;
|
||||
reg store_udp_payload_int_to_temp;
|
||||
reg store_udp_payload_temp_to_output;
|
||||
|
||||
assign output_0_udp_payload_tdata = output_udp_payload_tdata_reg;
|
||||
assign output_0_udp_payload_tvalid = output_0_udp_payload_tvalid_reg;
|
||||
assign output_0_udp_payload_tlast = output_udp_payload_tlast_reg;
|
||||
assign output_0_udp_payload_tuser = output_udp_payload_tuser_reg;
|
||||
|
||||
assign output_1_udp_payload_tdata = output_udp_payload_tdata_reg;
|
||||
assign output_1_udp_payload_tvalid = output_1_udp_payload_tvalid_reg;
|
||||
assign output_1_udp_payload_tlast = output_udp_payload_tlast_reg;
|
||||
assign output_1_udp_payload_tuser = output_udp_payload_tuser_reg;
|
||||
|
||||
assign output_2_udp_payload_tdata = output_udp_payload_tdata_reg;
|
||||
assign output_2_udp_payload_tvalid = output_2_udp_payload_tvalid_reg;
|
||||
assign output_2_udp_payload_tlast = output_udp_payload_tlast_reg;
|
||||
assign output_2_udp_payload_tuser = output_udp_payload_tuser_reg;
|
||||
|
||||
assign output_3_udp_payload_tdata = output_udp_payload_tdata_reg;
|
||||
assign output_3_udp_payload_tvalid = output_3_udp_payload_tvalid_reg;
|
||||
assign output_3_udp_payload_tlast = output_udp_payload_tlast_reg;
|
||||
assign output_3_udp_payload_tuser = output_udp_payload_tuser_reg;
|
||||
|
||||
// enable ready input next cycle if output is ready or the temp reg will not be filled on the next cycle (output reg empty or no input)
|
||||
assign output_udp_payload_tready_int_early = current_output_tready | (~temp_udp_payload_tvalid_reg & (~current_output_tvalid | ~output_udp_payload_tvalid_int));
|
||||
|
||||
always @* begin
|
||||
// transfer sink ready state to source
|
||||
output_0_udp_payload_tvalid_next = output_0_udp_payload_tvalid_reg;
|
||||
output_1_udp_payload_tvalid_next = output_1_udp_payload_tvalid_reg;
|
||||
output_2_udp_payload_tvalid_next = output_2_udp_payload_tvalid_reg;
|
||||
output_3_udp_payload_tvalid_next = output_3_udp_payload_tvalid_reg;
|
||||
temp_udp_payload_tvalid_next = temp_udp_payload_tvalid_reg;
|
||||
|
||||
store_udp_payload_int_to_output = 1'b0;
|
||||
store_udp_payload_int_to_temp = 1'b0;
|
||||
store_udp_payload_temp_to_output = 1'b0;
|
||||
|
||||
if (output_udp_payload_tready_int_reg) begin
|
||||
// input is ready
|
||||
if (current_output_tready | ~current_output_tvalid) begin
|
||||
// output is ready or currently not valid, transfer data to output
|
||||
output_0_udp_payload_tvalid_next = output_udp_payload_tvalid_int & (select_reg == 2'd0);
|
||||
output_1_udp_payload_tvalid_next = output_udp_payload_tvalid_int & (select_reg == 2'd1);
|
||||
output_2_udp_payload_tvalid_next = output_udp_payload_tvalid_int & (select_reg == 2'd2);
|
||||
output_3_udp_payload_tvalid_next = output_udp_payload_tvalid_int & (select_reg == 2'd3);
|
||||
store_udp_payload_int_to_output = 1'b1;
|
||||
end else begin
|
||||
// output is not ready, store input in temp
|
||||
temp_udp_payload_tvalid_next = output_udp_payload_tvalid_int;
|
||||
store_udp_payload_int_to_temp = 1'b1;
|
||||
end
|
||||
end else if (current_output_tready) begin
|
||||
// input is not ready, but output is ready
|
||||
output_0_udp_payload_tvalid_next = temp_udp_payload_tvalid_reg & (select_reg == 2'd0);
|
||||
output_1_udp_payload_tvalid_next = temp_udp_payload_tvalid_reg & (select_reg == 2'd1);
|
||||
output_2_udp_payload_tvalid_next = temp_udp_payload_tvalid_reg & (select_reg == 2'd2);
|
||||
output_3_udp_payload_tvalid_next = temp_udp_payload_tvalid_reg & (select_reg == 2'd3);
|
||||
temp_udp_payload_tvalid_next = 1'b0;
|
||||
store_udp_payload_temp_to_output = 1'b1;
|
||||
end
|
||||
end
|
||||
|
||||
always @(posedge clk) begin
|
||||
if (rst) begin
|
||||
output_0_udp_payload_tvalid_reg <= 1'b0;
|
||||
output_1_udp_payload_tvalid_reg <= 1'b0;
|
||||
output_2_udp_payload_tvalid_reg <= 1'b0;
|
||||
output_3_udp_payload_tvalid_reg <= 1'b0;
|
||||
output_udp_payload_tready_int_reg <= 1'b0;
|
||||
temp_udp_payload_tvalid_reg <= 1'b0;
|
||||
end else begin
|
||||
output_0_udp_payload_tvalid_reg <= output_0_udp_payload_tvalid_next;
|
||||
output_1_udp_payload_tvalid_reg <= output_1_udp_payload_tvalid_next;
|
||||
output_2_udp_payload_tvalid_reg <= output_2_udp_payload_tvalid_next;
|
||||
output_3_udp_payload_tvalid_reg <= output_3_udp_payload_tvalid_next;
|
||||
output_udp_payload_tready_int_reg <= output_udp_payload_tready_int_early;
|
||||
temp_udp_payload_tvalid_reg <= temp_udp_payload_tvalid_next;
|
||||
end
|
||||
|
||||
// datapath
|
||||
if (store_udp_payload_int_to_output) begin
|
||||
output_udp_payload_tdata_reg <= output_udp_payload_tdata_int;
|
||||
output_udp_payload_tlast_reg <= output_udp_payload_tlast_int;
|
||||
output_udp_payload_tuser_reg <= output_udp_payload_tuser_int;
|
||||
end else if (store_udp_payload_temp_to_output) begin
|
||||
output_udp_payload_tdata_reg <= temp_udp_payload_tdata_reg;
|
||||
output_udp_payload_tlast_reg <= temp_udp_payload_tlast_reg;
|
||||
output_udp_payload_tuser_reg <= temp_udp_payload_tuser_reg;
|
||||
end
|
||||
|
||||
if (store_udp_payload_int_to_temp) begin
|
||||
temp_udp_payload_tdata_reg <= output_udp_payload_tdata_int;
|
||||
temp_udp_payload_tlast_reg <= output_udp_payload_tlast_int;
|
||||
temp_udp_payload_tuser_reg <= output_udp_payload_tuser_int;
|
||||
end
|
||||
end
|
||||
|
||||
endmodule
|
@ -1,472 +0,0 @@
|
||||
#!/usr/bin/env python
|
||||
"""
|
||||
Generates a UDP demux with the specified number of ports
|
||||
"""
|
||||
|
||||
from __future__ import print_function
|
||||
|
||||
import argparse
|
||||
import math
|
||||
from jinja2 import Template
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(description=__doc__.strip())
|
||||
parser.add_argument('-p', '--ports', type=int, default=4, help="number of ports")
|
||||
parser.add_argument('-n', '--name', type=str, help="module name")
|
||||
parser.add_argument('-o', '--output', type=str, help="output file name")
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
try:
|
||||
generate(**args.__dict__)
|
||||
except IOError as ex:
|
||||
print(ex)
|
||||
exit(1)
|
||||
|
||||
def generate(ports=4, name=None, output=None):
|
||||
if name is None:
|
||||
name = "udp_demux_64_{0}".format(ports)
|
||||
|
||||
if output is None:
|
||||
output = name + ".v"
|
||||
|
||||
print("Opening file '{0}'...".format(output))
|
||||
|
||||
output_file = open(output, 'w')
|
||||
|
||||
print("Generating {0} port UDP demux {1}...".format(ports, name))
|
||||
|
||||
select_width = int(math.ceil(math.log(ports, 2)))
|
||||
|
||||
t = Template(u"""/*
|
||||
|
||||
Copyright (c) 2014-2018 Alex Forencich
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
|
||||
*/
|
||||
|
||||
// Language: Verilog 2001
|
||||
|
||||
`timescale 1ns / 1ps
|
||||
|
||||
/*
|
||||
* UDP {{n}} port demultiplexer (64 bit datapath)
|
||||
*/
|
||||
module {{name}}
|
||||
(
|
||||
input wire clk,
|
||||
input wire rst,
|
||||
|
||||
/*
|
||||
* UDP frame input
|
||||
*/
|
||||
input wire input_udp_hdr_valid,
|
||||
output wire input_udp_hdr_ready,
|
||||
input wire [47:0] input_eth_dest_mac,
|
||||
input wire [47:0] input_eth_src_mac,
|
||||
input wire [15:0] input_eth_type,
|
||||
input wire [3:0] input_ip_version,
|
||||
input wire [3:0] input_ip_ihl,
|
||||
input wire [5:0] input_ip_dscp,
|
||||
input wire [1:0] input_ip_ecn,
|
||||
input wire [15:0] input_ip_length,
|
||||
input wire [15:0] input_ip_identification,
|
||||
input wire [2:0] input_ip_flags,
|
||||
input wire [12:0] input_ip_fragment_offset,
|
||||
input wire [7:0] input_ip_ttl,
|
||||
input wire [7:0] input_ip_protocol,
|
||||
input wire [15:0] input_ip_header_checksum,
|
||||
input wire [31:0] input_ip_source_ip,
|
||||
input wire [31:0] input_ip_dest_ip,
|
||||
input wire [15:0] input_udp_source_port,
|
||||
input wire [15:0] input_udp_dest_port,
|
||||
input wire [15:0] input_udp_length,
|
||||
input wire [15:0] input_udp_checksum,
|
||||
input wire [63:0] input_udp_payload_tdata,
|
||||
input wire [7:0] input_udp_payload_tkeep,
|
||||
input wire input_udp_payload_tvalid,
|
||||
output wire input_udp_payload_tready,
|
||||
input wire input_udp_payload_tlast,
|
||||
input wire input_udp_payload_tuser,
|
||||
|
||||
/*
|
||||
* UDP frame outputs
|
||||
*/
|
||||
{%- for p in ports %}
|
||||
output wire output_{{p}}_udp_hdr_valid,
|
||||
input wire output_{{p}}_udp_hdr_ready,
|
||||
output wire [47:0] output_{{p}}_eth_dest_mac,
|
||||
output wire [47:0] output_{{p}}_eth_src_mac,
|
||||
output wire [15:0] output_{{p}}_eth_type,
|
||||
output wire [3:0] output_{{p}}_ip_version,
|
||||
output wire [3:0] output_{{p}}_ip_ihl,
|
||||
output wire [5:0] output_{{p}}_ip_dscp,
|
||||
output wire [1:0] output_{{p}}_ip_ecn,
|
||||
output wire [15:0] output_{{p}}_ip_length,
|
||||
output wire [15:0] output_{{p}}_ip_identification,
|
||||
output wire [2:0] output_{{p}}_ip_flags,
|
||||
output wire [12:0] output_{{p}}_ip_fragment_offset,
|
||||
output wire [7:0] output_{{p}}_ip_ttl,
|
||||
output wire [7:0] output_{{p}}_ip_protocol,
|
||||
output wire [15:0] output_{{p}}_ip_header_checksum,
|
||||
output wire [31:0] output_{{p}}_ip_source_ip,
|
||||
output wire [31:0] output_{{p}}_ip_dest_ip,
|
||||
output wire [15:0] output_{{p}}_udp_source_port,
|
||||
output wire [15:0] output_{{p}}_udp_dest_port,
|
||||
output wire [15:0] output_{{p}}_udp_length,
|
||||
output wire [15:0] output_{{p}}_udp_checksum,
|
||||
output wire [63:0] output_{{p}}_udp_payload_tdata,
|
||||
output wire [7:0] output_{{p}}_udp_payload_tkeep,
|
||||
output wire output_{{p}}_udp_payload_tvalid,
|
||||
input wire output_{{p}}_udp_payload_tready,
|
||||
output wire output_{{p}}_udp_payload_tlast,
|
||||
output wire output_{{p}}_udp_payload_tuser,
|
||||
{% endfor %}
|
||||
/*
|
||||
* Control
|
||||
*/
|
||||
input wire enable,
|
||||
input wire [{{w-1}}:0] select
|
||||
);
|
||||
|
||||
reg [{{w-1}}:0] select_reg = {{w}}'d0, select_next;
|
||||
reg frame_reg = 1'b0, frame_next;
|
||||
|
||||
reg input_udp_hdr_ready_reg = 1'b0, input_udp_hdr_ready_next;
|
||||
reg input_udp_payload_tready_reg = 1'b0, input_udp_payload_tready_next;
|
||||
{% for p in ports %}
|
||||
reg output_{{p}}_udp_hdr_valid_reg = 1'b0, output_{{p}}_udp_hdr_valid_next;
|
||||
{%- endfor %}
|
||||
reg [47:0] output_eth_dest_mac_reg = 48'd0, output_eth_dest_mac_next;
|
||||
reg [47:0] output_eth_src_mac_reg = 48'd0, output_eth_src_mac_next;
|
||||
reg [15:0] output_eth_type_reg = 16'd0, output_eth_type_next;
|
||||
reg [3:0] output_ip_version_reg = 4'd0, output_ip_version_next;
|
||||
reg [3:0] output_ip_ihl_reg = 4'd0, output_ip_ihl_next;
|
||||
reg [5:0] output_ip_dscp_reg = 6'd0, output_ip_dscp_next;
|
||||
reg [1:0] output_ip_ecn_reg = 2'd0, output_ip_ecn_next;
|
||||
reg [15:0] output_ip_length_reg = 16'd0, output_ip_length_next;
|
||||
reg [15:0] output_ip_identification_reg = 16'd0, output_ip_identification_next;
|
||||
reg [2:0] output_ip_flags_reg = 3'd0, output_ip_flags_next;
|
||||
reg [12:0] output_ip_fragment_offset_reg = 13'd0, output_ip_fragment_offset_next;
|
||||
reg [7:0] output_ip_ttl_reg = 8'd0, output_ip_ttl_next;
|
||||
reg [7:0] output_ip_protocol_reg = 8'd0, output_ip_protocol_next;
|
||||
reg [15:0] output_ip_header_checksum_reg = 16'd0, output_ip_header_checksum_next;
|
||||
reg [31:0] output_ip_source_ip_reg = 32'd0, output_ip_source_ip_next;
|
||||
reg [31:0] output_ip_dest_ip_reg = 32'd0, output_ip_dest_ip_next;
|
||||
reg [15:0] output_udp_source_port_reg = 16'd0, output_udp_source_port_next;
|
||||
reg [15:0] output_udp_dest_port_reg = 16'd0, output_udp_dest_port_next;
|
||||
reg [15:0] output_udp_length_reg = 16'd0, output_udp_length_next;
|
||||
reg [15:0] output_udp_checksum_reg = 16'd0, output_udp_checksum_next;
|
||||
|
||||
// internal datapath
|
||||
reg [63:0] output_udp_payload_tdata_int;
|
||||
reg [7:0] output_udp_payload_tkeep_int;
|
||||
reg output_udp_payload_tvalid_int;
|
||||
reg output_udp_payload_tready_int_reg = 1'b0;
|
||||
reg output_udp_payload_tlast_int;
|
||||
reg output_udp_payload_tuser_int;
|
||||
wire output_udp_payload_tready_int_early;
|
||||
|
||||
assign input_udp_hdr_ready = input_udp_hdr_ready_reg;
|
||||
assign input_udp_payload_tready = input_udp_payload_tready_reg;
|
||||
{% for p in ports %}
|
||||
assign output_{{p}}_udp_hdr_valid = output_{{p}}_udp_hdr_valid_reg;
|
||||
assign output_{{p}}_eth_dest_mac = output_eth_dest_mac_reg;
|
||||
assign output_{{p}}_eth_src_mac = output_eth_src_mac_reg;
|
||||
assign output_{{p}}_eth_type = output_eth_type_reg;
|
||||
assign output_{{p}}_ip_version = output_ip_version_reg;
|
||||
assign output_{{p}}_ip_ihl = output_ip_ihl_reg;
|
||||
assign output_{{p}}_ip_dscp = output_ip_dscp_reg;
|
||||
assign output_{{p}}_ip_ecn = output_ip_ecn_reg;
|
||||
assign output_{{p}}_ip_length = output_ip_length_reg;
|
||||
assign output_{{p}}_ip_identification = output_ip_identification_reg;
|
||||
assign output_{{p}}_ip_flags = output_ip_flags_reg;
|
||||
assign output_{{p}}_ip_fragment_offset = output_ip_fragment_offset_reg;
|
||||
assign output_{{p}}_ip_ttl = output_ip_ttl_reg;
|
||||
assign output_{{p}}_ip_protocol = output_ip_protocol_reg;
|
||||
assign output_{{p}}_ip_header_checksum = output_ip_header_checksum_reg;
|
||||
assign output_{{p}}_ip_source_ip = output_ip_source_ip_reg;
|
||||
assign output_{{p}}_ip_dest_ip = output_ip_dest_ip_reg;
|
||||
assign output_{{p}}_udp_source_port = output_udp_source_port_reg;
|
||||
assign output_{{p}}_udp_dest_port = output_udp_dest_port_reg;
|
||||
assign output_{{p}}_udp_length = output_udp_length_reg;
|
||||
assign output_{{p}}_udp_checksum = output_udp_checksum_reg;
|
||||
{% endfor %}
|
||||
// mux for output control signals
|
||||
reg current_output_udp_hdr_valid;
|
||||
reg current_output_udp_hdr_ready;
|
||||
reg current_output_tvalid;
|
||||
reg current_output_tready;
|
||||
always @* begin
|
||||
case (select_reg)
|
||||
{%- for p in ports %}
|
||||
{{w}}'d{{p}}: begin
|
||||
current_output_udp_hdr_valid = output_{{p}}_udp_hdr_valid;
|
||||
current_output_udp_hdr_ready = output_{{p}}_udp_hdr_ready;
|
||||
current_output_tvalid = output_{{p}}_udp_payload_tvalid;
|
||||
current_output_tready = output_{{p}}_udp_payload_tready;
|
||||
end
|
||||
{%- endfor %}
|
||||
default: begin
|
||||
current_output_udp_hdr_valid = 1'b0;
|
||||
current_output_udp_hdr_ready = 1'b0;
|
||||
current_output_tvalid = 1'b0;
|
||||
current_output_tready = 1'b0;
|
||||
end
|
||||
endcase
|
||||
end
|
||||
|
||||
always @* begin
|
||||
select_next = select_reg;
|
||||
frame_next = frame_reg;
|
||||
|
||||
input_udp_hdr_ready_next = input_udp_hdr_ready_reg & ~input_udp_hdr_valid;
|
||||
input_udp_payload_tready_next = 1'b0;
|
||||
|
||||
{%- for p in ports %}
|
||||
output_{{p}}_udp_hdr_valid_next = output_{{p}}_udp_hdr_valid_reg & ~output_{{p}}_udp_hdr_ready;
|
||||
{%- endfor %}
|
||||
output_eth_dest_mac_next = output_eth_dest_mac_reg;
|
||||
output_eth_src_mac_next = output_eth_src_mac_reg;
|
||||
output_eth_type_next = output_eth_type_reg;
|
||||
output_ip_version_next = output_ip_version_reg;
|
||||
output_ip_ihl_next = output_ip_ihl_reg;
|
||||
output_ip_dscp_next = output_ip_dscp_reg;
|
||||
output_ip_ecn_next = output_ip_ecn_reg;
|
||||
output_ip_length_next = output_ip_length_reg;
|
||||
output_ip_identification_next = output_ip_identification_reg;
|
||||
output_ip_flags_next = output_ip_flags_reg;
|
||||
output_ip_fragment_offset_next = output_ip_fragment_offset_reg;
|
||||
output_ip_ttl_next = output_ip_ttl_reg;
|
||||
output_ip_protocol_next = output_ip_protocol_reg;
|
||||
output_ip_header_checksum_next = output_ip_header_checksum_reg;
|
||||
output_ip_source_ip_next = output_ip_source_ip_reg;
|
||||
output_ip_dest_ip_next = output_ip_dest_ip_reg;
|
||||
output_udp_source_port_next = output_udp_source_port_reg;
|
||||
output_udp_dest_port_next = output_udp_dest_port_reg;
|
||||
output_udp_length_next = output_udp_length_reg;
|
||||
output_udp_checksum_next = output_udp_checksum_reg;
|
||||
|
||||
if (input_udp_payload_tvalid & input_udp_payload_tready) begin
|
||||
// end of frame detection
|
||||
if (input_udp_payload_tlast) begin
|
||||
frame_next = 1'b0;
|
||||
end
|
||||
end
|
||||
|
||||
if (~frame_reg & enable & input_udp_hdr_valid & ~current_output_udp_hdr_valid & ~current_output_tvalid) begin
|
||||
// start of frame, grab select value
|
||||
frame_next = 1'b1;
|
||||
select_next = select;
|
||||
|
||||
input_udp_hdr_ready_next = 1'b1;
|
||||
|
||||
case (select)
|
||||
{%- for p in ports %}
|
||||
{{w}}'d{{p}}: output_{{p}}_udp_hdr_valid_next = 1'b1;
|
||||
{%- endfor %}
|
||||
endcase
|
||||
output_eth_dest_mac_next = input_eth_dest_mac;
|
||||
output_eth_src_mac_next = input_eth_src_mac;
|
||||
output_eth_type_next = input_eth_type;
|
||||
output_ip_version_next = input_ip_version;
|
||||
output_ip_ihl_next = input_ip_ihl;
|
||||
output_ip_dscp_next = input_ip_dscp;
|
||||
output_ip_ecn_next = input_ip_ecn;
|
||||
output_ip_length_next = input_ip_length;
|
||||
output_ip_identification_next = input_ip_identification;
|
||||
output_ip_flags_next = input_ip_flags;
|
||||
output_ip_fragment_offset_next = input_ip_fragment_offset;
|
||||
output_ip_ttl_next = input_ip_ttl;
|
||||
output_ip_protocol_next = input_ip_protocol;
|
||||
output_ip_header_checksum_next = input_ip_header_checksum;
|
||||
output_ip_source_ip_next = input_ip_source_ip;
|
||||
output_ip_dest_ip_next = input_ip_dest_ip;
|
||||
output_udp_source_port_next = input_udp_source_port;
|
||||
output_udp_dest_port_next = input_udp_dest_port;
|
||||
output_udp_length_next = input_udp_length;
|
||||
output_udp_checksum_next = input_udp_checksum;
|
||||
end
|
||||
|
||||
input_udp_payload_tready_next = output_udp_payload_tready_int_early & frame_next;
|
||||
|
||||
output_udp_payload_tdata_int = input_udp_payload_tdata;
|
||||
output_udp_payload_tkeep_int = input_udp_payload_tkeep;
|
||||
output_udp_payload_tvalid_int = input_udp_payload_tvalid & input_udp_payload_tready;
|
||||
output_udp_payload_tlast_int = input_udp_payload_tlast;
|
||||
output_udp_payload_tuser_int = input_udp_payload_tuser;
|
||||
end
|
||||
|
||||
always @(posedge clk) begin
|
||||
if (rst) begin
|
||||
select_reg <= {{w}}'d0;
|
||||
frame_reg <= 1'b0;
|
||||
input_udp_hdr_ready_reg <= 1'b0;
|
||||
input_udp_payload_tready_reg <= 1'b0;
|
||||
{%- for p in ports %}
|
||||
output_{{p}}_udp_hdr_valid_reg <= 1'b0;
|
||||
{%- endfor %}
|
||||
end else begin
|
||||
select_reg <= select_next;
|
||||
frame_reg <= frame_next;
|
||||
input_udp_hdr_ready_reg <= input_udp_hdr_ready_next;
|
||||
input_udp_payload_tready_reg <= input_udp_payload_tready_next;
|
||||
{%- for p in ports %}
|
||||
output_{{p}}_udp_hdr_valid_reg <= output_{{p}}_udp_hdr_valid_next;
|
||||
{%- endfor %}
|
||||
end
|
||||
|
||||
output_eth_dest_mac_reg <= output_eth_dest_mac_next;
|
||||
output_eth_src_mac_reg <= output_eth_src_mac_next;
|
||||
output_eth_type_reg <= output_eth_type_next;
|
||||
output_ip_version_reg <= output_ip_version_next;
|
||||
output_ip_ihl_reg <= output_ip_ihl_next;
|
||||
output_ip_dscp_reg <= output_ip_dscp_next;
|
||||
output_ip_ecn_reg <= output_ip_ecn_next;
|
||||
output_ip_length_reg <= output_ip_length_next;
|
||||
output_ip_identification_reg <= output_ip_identification_next;
|
||||
output_ip_flags_reg <= output_ip_flags_next;
|
||||
output_ip_fragment_offset_reg <= output_ip_fragment_offset_next;
|
||||
output_ip_ttl_reg <= output_ip_ttl_next;
|
||||
output_ip_protocol_reg <= output_ip_protocol_next;
|
||||
output_ip_header_checksum_reg <= output_ip_header_checksum_next;
|
||||
output_ip_source_ip_reg <= output_ip_source_ip_next;
|
||||
output_ip_dest_ip_reg <= output_ip_dest_ip_next;
|
||||
output_udp_source_port_reg <= output_udp_source_port_next;
|
||||
output_udp_dest_port_reg <= output_udp_dest_port_next;
|
||||
output_udp_length_reg <= output_udp_length_next;
|
||||
output_udp_checksum_reg <= output_udp_checksum_next;
|
||||
end
|
||||
|
||||
// output datapath logic
|
||||
reg [63:0] output_udp_payload_tdata_reg = 64'd0;
|
||||
reg [7:0] output_udp_payload_tkeep_reg = 8'd0;
|
||||
{%- for p in ports %}
|
||||
reg output_{{p}}_udp_payload_tvalid_reg = 1'b0, output_{{p}}_udp_payload_tvalid_next;
|
||||
{%- endfor %}
|
||||
reg output_udp_payload_tlast_reg = 1'b0;
|
||||
reg output_udp_payload_tuser_reg = 1'b0;
|
||||
|
||||
reg [63:0] temp_udp_payload_tdata_reg = 64'd0;
|
||||
reg [7:0] temp_udp_payload_tkeep_reg = 8'd0;
|
||||
reg temp_udp_payload_tvalid_reg = 1'b0, temp_udp_payload_tvalid_next;
|
||||
reg temp_udp_payload_tlast_reg = 1'b0;
|
||||
reg temp_udp_payload_tuser_reg = 1'b0;
|
||||
|
||||
// datapath control
|
||||
reg store_udp_payload_int_to_output;
|
||||
reg store_udp_payload_int_to_temp;
|
||||
reg store_udp_payload_temp_to_output;
|
||||
{% for p in ports %}
|
||||
assign output_{{p}}_udp_payload_tdata = output_udp_payload_tdata_reg;
|
||||
assign output_{{p}}_udp_payload_tkeep = output_udp_payload_tkeep_reg;
|
||||
assign output_{{p}}_udp_payload_tvalid = output_{{p}}_udp_payload_tvalid_reg;
|
||||
assign output_{{p}}_udp_payload_tlast = output_udp_payload_tlast_reg;
|
||||
assign output_{{p}}_udp_payload_tuser = output_udp_payload_tuser_reg;
|
||||
{% endfor %}
|
||||
// enable ready input next cycle if output is ready or the temp reg will not be filled on the next cycle (output reg empty or no input)
|
||||
assign output_udp_payload_tready_int_early = current_output_tready | (~temp_udp_payload_tvalid_reg & (~current_output_tvalid | ~output_udp_payload_tvalid_int));
|
||||
|
||||
always @* begin
|
||||
// transfer sink ready state to source
|
||||
{%- for p in ports %}
|
||||
output_{{p}}_udp_payload_tvalid_next = output_{{p}}_udp_payload_tvalid_reg;
|
||||
{%- endfor %}
|
||||
temp_udp_payload_tvalid_next = temp_udp_payload_tvalid_reg;
|
||||
|
||||
store_udp_payload_int_to_output = 1'b0;
|
||||
store_udp_payload_int_to_temp = 1'b0;
|
||||
store_udp_payload_temp_to_output = 1'b0;
|
||||
|
||||
if (output_udp_payload_tready_int_reg) begin
|
||||
// input is ready
|
||||
if (current_output_tready | ~current_output_tvalid) begin
|
||||
// output is ready or currently not valid, transfer data to output
|
||||
{%- for p in ports %}
|
||||
output_{{p}}_udp_payload_tvalid_next = output_udp_payload_tvalid_int & (select_reg == {{w}}'d{{p}});
|
||||
{%- endfor %}
|
||||
store_udp_payload_int_to_output = 1'b1;
|
||||
end else begin
|
||||
// output is not ready, store input in temp
|
||||
temp_udp_payload_tvalid_next = output_udp_payload_tvalid_int;
|
||||
store_udp_payload_int_to_temp = 1'b1;
|
||||
end
|
||||
end else if (current_output_tready) begin
|
||||
// input is not ready, but output is ready
|
||||
{%- for p in ports %}
|
||||
output_{{p}}_udp_payload_tvalid_next = temp_udp_payload_tvalid_reg & (select_reg == {{w}}'d{{p}});
|
||||
{%- endfor %}
|
||||
temp_udp_payload_tvalid_next = 1'b0;
|
||||
store_udp_payload_temp_to_output = 1'b1;
|
||||
end
|
||||
end
|
||||
|
||||
always @(posedge clk) begin
|
||||
if (rst) begin
|
||||
{%- for p in ports %}
|
||||
output_{{p}}_udp_payload_tvalid_reg <= 1'b0;
|
||||
{%- endfor %}
|
||||
output_udp_payload_tready_int_reg <= 1'b0;
|
||||
temp_udp_payload_tvalid_reg <= 1'b0;
|
||||
end else begin
|
||||
{%- for p in ports %}
|
||||
output_{{p}}_udp_payload_tvalid_reg <= output_{{p}}_udp_payload_tvalid_next;
|
||||
{%- endfor %}
|
||||
output_udp_payload_tready_int_reg <= output_udp_payload_tready_int_early;
|
||||
temp_udp_payload_tvalid_reg <= temp_udp_payload_tvalid_next;
|
||||
end
|
||||
|
||||
// datapath
|
||||
if (store_udp_payload_int_to_output) begin
|
||||
output_udp_payload_tdata_reg <= output_udp_payload_tdata_int;
|
||||
output_udp_payload_tkeep_reg <= output_udp_payload_tkeep_int;
|
||||
output_udp_payload_tlast_reg <= output_udp_payload_tlast_int;
|
||||
output_udp_payload_tuser_reg <= output_udp_payload_tuser_int;
|
||||
end else if (store_udp_payload_temp_to_output) begin
|
||||
output_udp_payload_tdata_reg <= temp_udp_payload_tdata_reg;
|
||||
output_udp_payload_tkeep_reg <= temp_udp_payload_tkeep_reg;
|
||||
output_udp_payload_tlast_reg <= temp_udp_payload_tlast_reg;
|
||||
output_udp_payload_tuser_reg <= temp_udp_payload_tuser_reg;
|
||||
end
|
||||
|
||||
if (store_udp_payload_int_to_temp) begin
|
||||
temp_udp_payload_tdata_reg <= output_udp_payload_tdata_int;
|
||||
temp_udp_payload_tkeep_reg <= output_udp_payload_tkeep_int;
|
||||
temp_udp_payload_tlast_reg <= output_udp_payload_tlast_int;
|
||||
temp_udp_payload_tuser_reg <= output_udp_payload_tuser_int;
|
||||
end
|
||||
end
|
||||
|
||||
endmodule
|
||||
|
||||
""")
|
||||
|
||||
output_file.write(t.render(
|
||||
n=ports,
|
||||
w=select_width,
|
||||
name=name,
|
||||
ports=range(ports)
|
||||
))
|
||||
|
||||
print("Done")
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
@ -1,614 +0,0 @@
|
||||
/*
|
||||
|
||||
Copyright (c) 2014-2018 Alex Forencich
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
|
||||
*/
|
||||
|
||||
// Language: Verilog 2001
|
||||
|
||||
`timescale 1ns / 1ps
|
||||
|
||||
/*
|
||||
* UDP 4 port demultiplexer (64 bit datapath)
|
||||
*/
|
||||
module udp_demux_64_4
|
||||
(
|
||||
input wire clk,
|
||||
input wire rst,
|
||||
|
||||
/*
|
||||
* UDP frame input
|
||||
*/
|
||||
input wire input_udp_hdr_valid,
|
||||
output wire input_udp_hdr_ready,
|
||||
input wire [47:0] input_eth_dest_mac,
|
||||
input wire [47:0] input_eth_src_mac,
|
||||
input wire [15:0] input_eth_type,
|
||||
input wire [3:0] input_ip_version,
|
||||
input wire [3:0] input_ip_ihl,
|
||||
input wire [5:0] input_ip_dscp,
|
||||
input wire [1:0] input_ip_ecn,
|
||||
input wire [15:0] input_ip_length,
|
||||
input wire [15:0] input_ip_identification,
|
||||
input wire [2:0] input_ip_flags,
|
||||
input wire [12:0] input_ip_fragment_offset,
|
||||
input wire [7:0] input_ip_ttl,
|
||||
input wire [7:0] input_ip_protocol,
|
||||
input wire [15:0] input_ip_header_checksum,
|
||||
input wire [31:0] input_ip_source_ip,
|
||||
input wire [31:0] input_ip_dest_ip,
|
||||
input wire [15:0] input_udp_source_port,
|
||||
input wire [15:0] input_udp_dest_port,
|
||||
input wire [15:0] input_udp_length,
|
||||
input wire [15:0] input_udp_checksum,
|
||||
input wire [63:0] input_udp_payload_tdata,
|
||||
input wire [7:0] input_udp_payload_tkeep,
|
||||
input wire input_udp_payload_tvalid,
|
||||
output wire input_udp_payload_tready,
|
||||
input wire input_udp_payload_tlast,
|
||||
input wire input_udp_payload_tuser,
|
||||
|
||||
/*
|
||||
* UDP frame outputs
|
||||
*/
|
||||
output wire output_0_udp_hdr_valid,
|
||||
input wire output_0_udp_hdr_ready,
|
||||
output wire [47:0] output_0_eth_dest_mac,
|
||||
output wire [47:0] output_0_eth_src_mac,
|
||||
output wire [15:0] output_0_eth_type,
|
||||
output wire [3:0] output_0_ip_version,
|
||||
output wire [3:0] output_0_ip_ihl,
|
||||
output wire [5:0] output_0_ip_dscp,
|
||||
output wire [1:0] output_0_ip_ecn,
|
||||
output wire [15:0] output_0_ip_length,
|
||||
output wire [15:0] output_0_ip_identification,
|
||||
output wire [2:0] output_0_ip_flags,
|
||||
output wire [12:0] output_0_ip_fragment_offset,
|
||||
output wire [7:0] output_0_ip_ttl,
|
||||
output wire [7:0] output_0_ip_protocol,
|
||||
output wire [15:0] output_0_ip_header_checksum,
|
||||
output wire [31:0] output_0_ip_source_ip,
|
||||
output wire [31:0] output_0_ip_dest_ip,
|
||||
output wire [15:0] output_0_udp_source_port,
|
||||
output wire [15:0] output_0_udp_dest_port,
|
||||
output wire [15:0] output_0_udp_length,
|
||||
output wire [15:0] output_0_udp_checksum,
|
||||
output wire [63:0] output_0_udp_payload_tdata,
|
||||
output wire [7:0] output_0_udp_payload_tkeep,
|
||||
output wire output_0_udp_payload_tvalid,
|
||||
input wire output_0_udp_payload_tready,
|
||||
output wire output_0_udp_payload_tlast,
|
||||
output wire output_0_udp_payload_tuser,
|
||||
|
||||
output wire output_1_udp_hdr_valid,
|
||||
input wire output_1_udp_hdr_ready,
|
||||
output wire [47:0] output_1_eth_dest_mac,
|
||||
output wire [47:0] output_1_eth_src_mac,
|
||||
output wire [15:0] output_1_eth_type,
|
||||
output wire [3:0] output_1_ip_version,
|
||||
output wire [3:0] output_1_ip_ihl,
|
||||
output wire [5:0] output_1_ip_dscp,
|
||||
output wire [1:0] output_1_ip_ecn,
|
||||
output wire [15:0] output_1_ip_length,
|
||||
output wire [15:0] output_1_ip_identification,
|
||||
output wire [2:0] output_1_ip_flags,
|
||||
output wire [12:0] output_1_ip_fragment_offset,
|
||||
output wire [7:0] output_1_ip_ttl,
|
||||
output wire [7:0] output_1_ip_protocol,
|
||||
output wire [15:0] output_1_ip_header_checksum,
|
||||
output wire [31:0] output_1_ip_source_ip,
|
||||
output wire [31:0] output_1_ip_dest_ip,
|
||||
output wire [15:0] output_1_udp_source_port,
|
||||
output wire [15:0] output_1_udp_dest_port,
|
||||
output wire [15:0] output_1_udp_length,
|
||||
output wire [15:0] output_1_udp_checksum,
|
||||
output wire [63:0] output_1_udp_payload_tdata,
|
||||
output wire [7:0] output_1_udp_payload_tkeep,
|
||||
output wire output_1_udp_payload_tvalid,
|
||||
input wire output_1_udp_payload_tready,
|
||||
output wire output_1_udp_payload_tlast,
|
||||
output wire output_1_udp_payload_tuser,
|
||||
|
||||
output wire output_2_udp_hdr_valid,
|
||||
input wire output_2_udp_hdr_ready,
|
||||
output wire [47:0] output_2_eth_dest_mac,
|
||||
output wire [47:0] output_2_eth_src_mac,
|
||||
output wire [15:0] output_2_eth_type,
|
||||
output wire [3:0] output_2_ip_version,
|
||||
output wire [3:0] output_2_ip_ihl,
|
||||
output wire [5:0] output_2_ip_dscp,
|
||||
output wire [1:0] output_2_ip_ecn,
|
||||
output wire [15:0] output_2_ip_length,
|
||||
output wire [15:0] output_2_ip_identification,
|
||||
output wire [2:0] output_2_ip_flags,
|
||||
output wire [12:0] output_2_ip_fragment_offset,
|
||||
output wire [7:0] output_2_ip_ttl,
|
||||
output wire [7:0] output_2_ip_protocol,
|
||||
output wire [15:0] output_2_ip_header_checksum,
|
||||
output wire [31:0] output_2_ip_source_ip,
|
||||
output wire [31:0] output_2_ip_dest_ip,
|
||||
output wire [15:0] output_2_udp_source_port,
|
||||
output wire [15:0] output_2_udp_dest_port,
|
||||
output wire [15:0] output_2_udp_length,
|
||||
output wire [15:0] output_2_udp_checksum,
|
||||
output wire [63:0] output_2_udp_payload_tdata,
|
||||
output wire [7:0] output_2_udp_payload_tkeep,
|
||||
output wire output_2_udp_payload_tvalid,
|
||||
input wire output_2_udp_payload_tready,
|
||||
output wire output_2_udp_payload_tlast,
|
||||
output wire output_2_udp_payload_tuser,
|
||||
|
||||
output wire output_3_udp_hdr_valid,
|
||||
input wire output_3_udp_hdr_ready,
|
||||
output wire [47:0] output_3_eth_dest_mac,
|
||||
output wire [47:0] output_3_eth_src_mac,
|
||||
output wire [15:0] output_3_eth_type,
|
||||
output wire [3:0] output_3_ip_version,
|
||||
output wire [3:0] output_3_ip_ihl,
|
||||
output wire [5:0] output_3_ip_dscp,
|
||||
output wire [1:0] output_3_ip_ecn,
|
||||
output wire [15:0] output_3_ip_length,
|
||||
output wire [15:0] output_3_ip_identification,
|
||||
output wire [2:0] output_3_ip_flags,
|
||||
output wire [12:0] output_3_ip_fragment_offset,
|
||||
output wire [7:0] output_3_ip_ttl,
|
||||
output wire [7:0] output_3_ip_protocol,
|
||||
output wire [15:0] output_3_ip_header_checksum,
|
||||
output wire [31:0] output_3_ip_source_ip,
|
||||
output wire [31:0] output_3_ip_dest_ip,
|
||||
output wire [15:0] output_3_udp_source_port,
|
||||
output wire [15:0] output_3_udp_dest_port,
|
||||
output wire [15:0] output_3_udp_length,
|
||||
output wire [15:0] output_3_udp_checksum,
|
||||
output wire [63:0] output_3_udp_payload_tdata,
|
||||
output wire [7:0] output_3_udp_payload_tkeep,
|
||||
output wire output_3_udp_payload_tvalid,
|
||||
input wire output_3_udp_payload_tready,
|
||||
output wire output_3_udp_payload_tlast,
|
||||
output wire output_3_udp_payload_tuser,
|
||||
|
||||
/*
|
||||
* Control
|
||||
*/
|
||||
input wire enable,
|
||||
input wire [1:0] select
|
||||
);
|
||||
|
||||
reg [1:0] select_reg = 2'd0, select_next;
|
||||
reg frame_reg = 1'b0, frame_next;
|
||||
|
||||
reg input_udp_hdr_ready_reg = 1'b0, input_udp_hdr_ready_next;
|
||||
reg input_udp_payload_tready_reg = 1'b0, input_udp_payload_tready_next;
|
||||
|
||||
reg output_0_udp_hdr_valid_reg = 1'b0, output_0_udp_hdr_valid_next;
|
||||
reg output_1_udp_hdr_valid_reg = 1'b0, output_1_udp_hdr_valid_next;
|
||||
reg output_2_udp_hdr_valid_reg = 1'b0, output_2_udp_hdr_valid_next;
|
||||
reg output_3_udp_hdr_valid_reg = 1'b0, output_3_udp_hdr_valid_next;
|
||||
reg [47:0] output_eth_dest_mac_reg = 48'd0, output_eth_dest_mac_next;
|
||||
reg [47:0] output_eth_src_mac_reg = 48'd0, output_eth_src_mac_next;
|
||||
reg [15:0] output_eth_type_reg = 16'd0, output_eth_type_next;
|
||||
reg [3:0] output_ip_version_reg = 4'd0, output_ip_version_next;
|
||||
reg [3:0] output_ip_ihl_reg = 4'd0, output_ip_ihl_next;
|
||||
reg [5:0] output_ip_dscp_reg = 6'd0, output_ip_dscp_next;
|
||||
reg [1:0] output_ip_ecn_reg = 2'd0, output_ip_ecn_next;
|
||||
reg [15:0] output_ip_length_reg = 16'd0, output_ip_length_next;
|
||||
reg [15:0] output_ip_identification_reg = 16'd0, output_ip_identification_next;
|
||||
reg [2:0] output_ip_flags_reg = 3'd0, output_ip_flags_next;
|
||||
reg [12:0] output_ip_fragment_offset_reg = 13'd0, output_ip_fragment_offset_next;
|
||||
reg [7:0] output_ip_ttl_reg = 8'd0, output_ip_ttl_next;
|
||||
reg [7:0] output_ip_protocol_reg = 8'd0, output_ip_protocol_next;
|
||||
reg [15:0] output_ip_header_checksum_reg = 16'd0, output_ip_header_checksum_next;
|
||||
reg [31:0] output_ip_source_ip_reg = 32'd0, output_ip_source_ip_next;
|
||||
reg [31:0] output_ip_dest_ip_reg = 32'd0, output_ip_dest_ip_next;
|
||||
reg [15:0] output_udp_source_port_reg = 16'd0, output_udp_source_port_next;
|
||||
reg [15:0] output_udp_dest_port_reg = 16'd0, output_udp_dest_port_next;
|
||||
reg [15:0] output_udp_length_reg = 16'd0, output_udp_length_next;
|
||||
reg [15:0] output_udp_checksum_reg = 16'd0, output_udp_checksum_next;
|
||||
|
||||
// internal datapath
|
||||
reg [63:0] output_udp_payload_tdata_int;
|
||||
reg [7:0] output_udp_payload_tkeep_int;
|
||||
reg output_udp_payload_tvalid_int;
|
||||
reg output_udp_payload_tready_int_reg = 1'b0;
|
||||
reg output_udp_payload_tlast_int;
|
||||
reg output_udp_payload_tuser_int;
|
||||
wire output_udp_payload_tready_int_early;
|
||||
|
||||
assign input_udp_hdr_ready = input_udp_hdr_ready_reg;
|
||||
assign input_udp_payload_tready = input_udp_payload_tready_reg;
|
||||
|
||||
assign output_0_udp_hdr_valid = output_0_udp_hdr_valid_reg;
|
||||
assign output_0_eth_dest_mac = output_eth_dest_mac_reg;
|
||||
assign output_0_eth_src_mac = output_eth_src_mac_reg;
|
||||
assign output_0_eth_type = output_eth_type_reg;
|
||||
assign output_0_ip_version = output_ip_version_reg;
|
||||
assign output_0_ip_ihl = output_ip_ihl_reg;
|
||||
assign output_0_ip_dscp = output_ip_dscp_reg;
|
||||
assign output_0_ip_ecn = output_ip_ecn_reg;
|
||||
assign output_0_ip_length = output_ip_length_reg;
|
||||
assign output_0_ip_identification = output_ip_identification_reg;
|
||||
assign output_0_ip_flags = output_ip_flags_reg;
|
||||
assign output_0_ip_fragment_offset = output_ip_fragment_offset_reg;
|
||||
assign output_0_ip_ttl = output_ip_ttl_reg;
|
||||
assign output_0_ip_protocol = output_ip_protocol_reg;
|
||||
assign output_0_ip_header_checksum = output_ip_header_checksum_reg;
|
||||
assign output_0_ip_source_ip = output_ip_source_ip_reg;
|
||||
assign output_0_ip_dest_ip = output_ip_dest_ip_reg;
|
||||
assign output_0_udp_source_port = output_udp_source_port_reg;
|
||||
assign output_0_udp_dest_port = output_udp_dest_port_reg;
|
||||
assign output_0_udp_length = output_udp_length_reg;
|
||||
assign output_0_udp_checksum = output_udp_checksum_reg;
|
||||
|
||||
assign output_1_udp_hdr_valid = output_1_udp_hdr_valid_reg;
|
||||
assign output_1_eth_dest_mac = output_eth_dest_mac_reg;
|
||||
assign output_1_eth_src_mac = output_eth_src_mac_reg;
|
||||
assign output_1_eth_type = output_eth_type_reg;
|
||||
assign output_1_ip_version = output_ip_version_reg;
|
||||
assign output_1_ip_ihl = output_ip_ihl_reg;
|
||||
assign output_1_ip_dscp = output_ip_dscp_reg;
|
||||
assign output_1_ip_ecn = output_ip_ecn_reg;
|
||||
assign output_1_ip_length = output_ip_length_reg;
|
||||
assign output_1_ip_identification = output_ip_identification_reg;
|
||||
assign output_1_ip_flags = output_ip_flags_reg;
|
||||
assign output_1_ip_fragment_offset = output_ip_fragment_offset_reg;
|
||||
assign output_1_ip_ttl = output_ip_ttl_reg;
|
||||
assign output_1_ip_protocol = output_ip_protocol_reg;
|
||||
assign output_1_ip_header_checksum = output_ip_header_checksum_reg;
|
||||
assign output_1_ip_source_ip = output_ip_source_ip_reg;
|
||||
assign output_1_ip_dest_ip = output_ip_dest_ip_reg;
|
||||
assign output_1_udp_source_port = output_udp_source_port_reg;
|
||||
assign output_1_udp_dest_port = output_udp_dest_port_reg;
|
||||
assign output_1_udp_length = output_udp_length_reg;
|
||||
assign output_1_udp_checksum = output_udp_checksum_reg;
|
||||
|
||||
assign output_2_udp_hdr_valid = output_2_udp_hdr_valid_reg;
|
||||
assign output_2_eth_dest_mac = output_eth_dest_mac_reg;
|
||||
assign output_2_eth_src_mac = output_eth_src_mac_reg;
|
||||
assign output_2_eth_type = output_eth_type_reg;
|
||||
assign output_2_ip_version = output_ip_version_reg;
|
||||
assign output_2_ip_ihl = output_ip_ihl_reg;
|
||||
assign output_2_ip_dscp = output_ip_dscp_reg;
|
||||
assign output_2_ip_ecn = output_ip_ecn_reg;
|
||||
assign output_2_ip_length = output_ip_length_reg;
|
||||
assign output_2_ip_identification = output_ip_identification_reg;
|
||||
assign output_2_ip_flags = output_ip_flags_reg;
|
||||
assign output_2_ip_fragment_offset = output_ip_fragment_offset_reg;
|
||||
assign output_2_ip_ttl = output_ip_ttl_reg;
|
||||
assign output_2_ip_protocol = output_ip_protocol_reg;
|
||||
assign output_2_ip_header_checksum = output_ip_header_checksum_reg;
|
||||
assign output_2_ip_source_ip = output_ip_source_ip_reg;
|
||||
assign output_2_ip_dest_ip = output_ip_dest_ip_reg;
|
||||
assign output_2_udp_source_port = output_udp_source_port_reg;
|
||||
assign output_2_udp_dest_port = output_udp_dest_port_reg;
|
||||
assign output_2_udp_length = output_udp_length_reg;
|
||||
assign output_2_udp_checksum = output_udp_checksum_reg;
|
||||
|
||||
assign output_3_udp_hdr_valid = output_3_udp_hdr_valid_reg;
|
||||
assign output_3_eth_dest_mac = output_eth_dest_mac_reg;
|
||||
assign output_3_eth_src_mac = output_eth_src_mac_reg;
|
||||
assign output_3_eth_type = output_eth_type_reg;
|
||||
assign output_3_ip_version = output_ip_version_reg;
|
||||
assign output_3_ip_ihl = output_ip_ihl_reg;
|
||||
assign output_3_ip_dscp = output_ip_dscp_reg;
|
||||
assign output_3_ip_ecn = output_ip_ecn_reg;
|
||||
assign output_3_ip_length = output_ip_length_reg;
|
||||
assign output_3_ip_identification = output_ip_identification_reg;
|
||||
assign output_3_ip_flags = output_ip_flags_reg;
|
||||
assign output_3_ip_fragment_offset = output_ip_fragment_offset_reg;
|
||||
assign output_3_ip_ttl = output_ip_ttl_reg;
|
||||
assign output_3_ip_protocol = output_ip_protocol_reg;
|
||||
assign output_3_ip_header_checksum = output_ip_header_checksum_reg;
|
||||
assign output_3_ip_source_ip = output_ip_source_ip_reg;
|
||||
assign output_3_ip_dest_ip = output_ip_dest_ip_reg;
|
||||
assign output_3_udp_source_port = output_udp_source_port_reg;
|
||||
assign output_3_udp_dest_port = output_udp_dest_port_reg;
|
||||
assign output_3_udp_length = output_udp_length_reg;
|
||||
assign output_3_udp_checksum = output_udp_checksum_reg;
|
||||
|
||||
// mux for output control signals
|
||||
reg current_output_udp_hdr_valid;
|
||||
reg current_output_udp_hdr_ready;
|
||||
reg current_output_tvalid;
|
||||
reg current_output_tready;
|
||||
always @* begin
|
||||
case (select_reg)
|
||||
2'd0: begin
|
||||
current_output_udp_hdr_valid = output_0_udp_hdr_valid;
|
||||
current_output_udp_hdr_ready = output_0_udp_hdr_ready;
|
||||
current_output_tvalid = output_0_udp_payload_tvalid;
|
||||
current_output_tready = output_0_udp_payload_tready;
|
||||
end
|
||||
2'd1: begin
|
||||
current_output_udp_hdr_valid = output_1_udp_hdr_valid;
|
||||
current_output_udp_hdr_ready = output_1_udp_hdr_ready;
|
||||
current_output_tvalid = output_1_udp_payload_tvalid;
|
||||
current_output_tready = output_1_udp_payload_tready;
|
||||
end
|
||||
2'd2: begin
|
||||
current_output_udp_hdr_valid = output_2_udp_hdr_valid;
|
||||
current_output_udp_hdr_ready = output_2_udp_hdr_ready;
|
||||
current_output_tvalid = output_2_udp_payload_tvalid;
|
||||
current_output_tready = output_2_udp_payload_tready;
|
||||
end
|
||||
2'd3: begin
|
||||
current_output_udp_hdr_valid = output_3_udp_hdr_valid;
|
||||
current_output_udp_hdr_ready = output_3_udp_hdr_ready;
|
||||
current_output_tvalid = output_3_udp_payload_tvalid;
|
||||
current_output_tready = output_3_udp_payload_tready;
|
||||
end
|
||||
default: begin
|
||||
current_output_udp_hdr_valid = 1'b0;
|
||||
current_output_udp_hdr_ready = 1'b0;
|
||||
current_output_tvalid = 1'b0;
|
||||
current_output_tready = 1'b0;
|
||||
end
|
||||
endcase
|
||||
end
|
||||
|
||||
always @* begin
|
||||
select_next = select_reg;
|
||||
frame_next = frame_reg;
|
||||
|
||||
input_udp_hdr_ready_next = input_udp_hdr_ready_reg & ~input_udp_hdr_valid;
|
||||
input_udp_payload_tready_next = 1'b0;
|
||||
output_0_udp_hdr_valid_next = output_0_udp_hdr_valid_reg & ~output_0_udp_hdr_ready;
|
||||
output_1_udp_hdr_valid_next = output_1_udp_hdr_valid_reg & ~output_1_udp_hdr_ready;
|
||||
output_2_udp_hdr_valid_next = output_2_udp_hdr_valid_reg & ~output_2_udp_hdr_ready;
|
||||
output_3_udp_hdr_valid_next = output_3_udp_hdr_valid_reg & ~output_3_udp_hdr_ready;
|
||||
output_eth_dest_mac_next = output_eth_dest_mac_reg;
|
||||
output_eth_src_mac_next = output_eth_src_mac_reg;
|
||||
output_eth_type_next = output_eth_type_reg;
|
||||
output_ip_version_next = output_ip_version_reg;
|
||||
output_ip_ihl_next = output_ip_ihl_reg;
|
||||
output_ip_dscp_next = output_ip_dscp_reg;
|
||||
output_ip_ecn_next = output_ip_ecn_reg;
|
||||
output_ip_length_next = output_ip_length_reg;
|
||||
output_ip_identification_next = output_ip_identification_reg;
|
||||
output_ip_flags_next = output_ip_flags_reg;
|
||||
output_ip_fragment_offset_next = output_ip_fragment_offset_reg;
|
||||
output_ip_ttl_next = output_ip_ttl_reg;
|
||||
output_ip_protocol_next = output_ip_protocol_reg;
|
||||
output_ip_header_checksum_next = output_ip_header_checksum_reg;
|
||||
output_ip_source_ip_next = output_ip_source_ip_reg;
|
||||
output_ip_dest_ip_next = output_ip_dest_ip_reg;
|
||||
output_udp_source_port_next = output_udp_source_port_reg;
|
||||
output_udp_dest_port_next = output_udp_dest_port_reg;
|
||||
output_udp_length_next = output_udp_length_reg;
|
||||
output_udp_checksum_next = output_udp_checksum_reg;
|
||||
|
||||
if (input_udp_payload_tvalid & input_udp_payload_tready) begin
|
||||
// end of frame detection
|
||||
if (input_udp_payload_tlast) begin
|
||||
frame_next = 1'b0;
|
||||
end
|
||||
end
|
||||
|
||||
if (~frame_reg & enable & input_udp_hdr_valid & ~current_output_udp_hdr_valid & ~current_output_tvalid) begin
|
||||
// start of frame, grab select value
|
||||
frame_next = 1'b1;
|
||||
select_next = select;
|
||||
|
||||
input_udp_hdr_ready_next = 1'b1;
|
||||
|
||||
case (select)
|
||||
2'd0: output_0_udp_hdr_valid_next = 1'b1;
|
||||
2'd1: output_1_udp_hdr_valid_next = 1'b1;
|
||||
2'd2: output_2_udp_hdr_valid_next = 1'b1;
|
||||
2'd3: output_3_udp_hdr_valid_next = 1'b1;
|
||||
endcase
|
||||
output_eth_dest_mac_next = input_eth_dest_mac;
|
||||
output_eth_src_mac_next = input_eth_src_mac;
|
||||
output_eth_type_next = input_eth_type;
|
||||
output_ip_version_next = input_ip_version;
|
||||
output_ip_ihl_next = input_ip_ihl;
|
||||
output_ip_dscp_next = input_ip_dscp;
|
||||
output_ip_ecn_next = input_ip_ecn;
|
||||
output_ip_length_next = input_ip_length;
|
||||
output_ip_identification_next = input_ip_identification;
|
||||
output_ip_flags_next = input_ip_flags;
|
||||
output_ip_fragment_offset_next = input_ip_fragment_offset;
|
||||
output_ip_ttl_next = input_ip_ttl;
|
||||
output_ip_protocol_next = input_ip_protocol;
|
||||
output_ip_header_checksum_next = input_ip_header_checksum;
|
||||
output_ip_source_ip_next = input_ip_source_ip;
|
||||
output_ip_dest_ip_next = input_ip_dest_ip;
|
||||
output_udp_source_port_next = input_udp_source_port;
|
||||
output_udp_dest_port_next = input_udp_dest_port;
|
||||
output_udp_length_next = input_udp_length;
|
||||
output_udp_checksum_next = input_udp_checksum;
|
||||
end
|
||||
|
||||
input_udp_payload_tready_next = output_udp_payload_tready_int_early & frame_next;
|
||||
|
||||
output_udp_payload_tdata_int = input_udp_payload_tdata;
|
||||
output_udp_payload_tkeep_int = input_udp_payload_tkeep;
|
||||
output_udp_payload_tvalid_int = input_udp_payload_tvalid & input_udp_payload_tready;
|
||||
output_udp_payload_tlast_int = input_udp_payload_tlast;
|
||||
output_udp_payload_tuser_int = input_udp_payload_tuser;
|
||||
end
|
||||
|
||||
always @(posedge clk) begin
|
||||
if (rst) begin
|
||||
select_reg <= 2'd0;
|
||||
frame_reg <= 1'b0;
|
||||
input_udp_hdr_ready_reg <= 1'b0;
|
||||
input_udp_payload_tready_reg <= 1'b0;
|
||||
output_0_udp_hdr_valid_reg <= 1'b0;
|
||||
output_1_udp_hdr_valid_reg <= 1'b0;
|
||||
output_2_udp_hdr_valid_reg <= 1'b0;
|
||||
output_3_udp_hdr_valid_reg <= 1'b0;
|
||||
end else begin
|
||||
select_reg <= select_next;
|
||||
frame_reg <= frame_next;
|
||||
input_udp_hdr_ready_reg <= input_udp_hdr_ready_next;
|
||||
input_udp_payload_tready_reg <= input_udp_payload_tready_next;
|
||||
output_0_udp_hdr_valid_reg <= output_0_udp_hdr_valid_next;
|
||||
output_1_udp_hdr_valid_reg <= output_1_udp_hdr_valid_next;
|
||||
output_2_udp_hdr_valid_reg <= output_2_udp_hdr_valid_next;
|
||||
output_3_udp_hdr_valid_reg <= output_3_udp_hdr_valid_next;
|
||||
end
|
||||
|
||||
output_eth_dest_mac_reg <= output_eth_dest_mac_next;
|
||||
output_eth_src_mac_reg <= output_eth_src_mac_next;
|
||||
output_eth_type_reg <= output_eth_type_next;
|
||||
output_ip_version_reg <= output_ip_version_next;
|
||||
output_ip_ihl_reg <= output_ip_ihl_next;
|
||||
output_ip_dscp_reg <= output_ip_dscp_next;
|
||||
output_ip_ecn_reg <= output_ip_ecn_next;
|
||||
output_ip_length_reg <= output_ip_length_next;
|
||||
output_ip_identification_reg <= output_ip_identification_next;
|
||||
output_ip_flags_reg <= output_ip_flags_next;
|
||||
output_ip_fragment_offset_reg <= output_ip_fragment_offset_next;
|
||||
output_ip_ttl_reg <= output_ip_ttl_next;
|
||||
output_ip_protocol_reg <= output_ip_protocol_next;
|
||||
output_ip_header_checksum_reg <= output_ip_header_checksum_next;
|
||||
output_ip_source_ip_reg <= output_ip_source_ip_next;
|
||||
output_ip_dest_ip_reg <= output_ip_dest_ip_next;
|
||||
output_udp_source_port_reg <= output_udp_source_port_next;
|
||||
output_udp_dest_port_reg <= output_udp_dest_port_next;
|
||||
output_udp_length_reg <= output_udp_length_next;
|
||||
output_udp_checksum_reg <= output_udp_checksum_next;
|
||||
end
|
||||
|
||||
// output datapath logic
|
||||
reg [63:0] output_udp_payload_tdata_reg = 64'd0;
|
||||
reg [7:0] output_udp_payload_tkeep_reg = 8'd0;
|
||||
reg output_0_udp_payload_tvalid_reg = 1'b0, output_0_udp_payload_tvalid_next;
|
||||
reg output_1_udp_payload_tvalid_reg = 1'b0, output_1_udp_payload_tvalid_next;
|
||||
reg output_2_udp_payload_tvalid_reg = 1'b0, output_2_udp_payload_tvalid_next;
|
||||
reg output_3_udp_payload_tvalid_reg = 1'b0, output_3_udp_payload_tvalid_next;
|
||||
reg output_udp_payload_tlast_reg = 1'b0;
|
||||
reg output_udp_payload_tuser_reg = 1'b0;
|
||||
|
||||
reg [63:0] temp_udp_payload_tdata_reg = 64'd0;
|
||||
reg [7:0] temp_udp_payload_tkeep_reg = 8'd0;
|
||||
reg temp_udp_payload_tvalid_reg = 1'b0, temp_udp_payload_tvalid_next;
|
||||
reg temp_udp_payload_tlast_reg = 1'b0;
|
||||
reg temp_udp_payload_tuser_reg = 1'b0;
|
||||
|
||||
// datapath control
|
||||
reg store_udp_payload_int_to_output;
|
||||
reg store_udp_payload_int_to_temp;
|
||||
reg store_udp_payload_temp_to_output;
|
||||
|
||||
assign output_0_udp_payload_tdata = output_udp_payload_tdata_reg;
|
||||
assign output_0_udp_payload_tkeep = output_udp_payload_tkeep_reg;
|
||||
assign output_0_udp_payload_tvalid = output_0_udp_payload_tvalid_reg;
|
||||
assign output_0_udp_payload_tlast = output_udp_payload_tlast_reg;
|
||||
assign output_0_udp_payload_tuser = output_udp_payload_tuser_reg;
|
||||
|
||||
assign output_1_udp_payload_tdata = output_udp_payload_tdata_reg;
|
||||
assign output_1_udp_payload_tkeep = output_udp_payload_tkeep_reg;
|
||||
assign output_1_udp_payload_tvalid = output_1_udp_payload_tvalid_reg;
|
||||
assign output_1_udp_payload_tlast = output_udp_payload_tlast_reg;
|
||||
assign output_1_udp_payload_tuser = output_udp_payload_tuser_reg;
|
||||
|
||||
assign output_2_udp_payload_tdata = output_udp_payload_tdata_reg;
|
||||
assign output_2_udp_payload_tkeep = output_udp_payload_tkeep_reg;
|
||||
assign output_2_udp_payload_tvalid = output_2_udp_payload_tvalid_reg;
|
||||
assign output_2_udp_payload_tlast = output_udp_payload_tlast_reg;
|
||||
assign output_2_udp_payload_tuser = output_udp_payload_tuser_reg;
|
||||
|
||||
assign output_3_udp_payload_tdata = output_udp_payload_tdata_reg;
|
||||
assign output_3_udp_payload_tkeep = output_udp_payload_tkeep_reg;
|
||||
assign output_3_udp_payload_tvalid = output_3_udp_payload_tvalid_reg;
|
||||
assign output_3_udp_payload_tlast = output_udp_payload_tlast_reg;
|
||||
assign output_3_udp_payload_tuser = output_udp_payload_tuser_reg;
|
||||
|
||||
// enable ready input next cycle if output is ready or the temp reg will not be filled on the next cycle (output reg empty or no input)
|
||||
assign output_udp_payload_tready_int_early = current_output_tready | (~temp_udp_payload_tvalid_reg & (~current_output_tvalid | ~output_udp_payload_tvalid_int));
|
||||
|
||||
always @* begin
|
||||
// transfer sink ready state to source
|
||||
output_0_udp_payload_tvalid_next = output_0_udp_payload_tvalid_reg;
|
||||
output_1_udp_payload_tvalid_next = output_1_udp_payload_tvalid_reg;
|
||||
output_2_udp_payload_tvalid_next = output_2_udp_payload_tvalid_reg;
|
||||
output_3_udp_payload_tvalid_next = output_3_udp_payload_tvalid_reg;
|
||||
temp_udp_payload_tvalid_next = temp_udp_payload_tvalid_reg;
|
||||
|
||||
store_udp_payload_int_to_output = 1'b0;
|
||||
store_udp_payload_int_to_temp = 1'b0;
|
||||
store_udp_payload_temp_to_output = 1'b0;
|
||||
|
||||
if (output_udp_payload_tready_int_reg) begin
|
||||
// input is ready
|
||||
if (current_output_tready | ~current_output_tvalid) begin
|
||||
// output is ready or currently not valid, transfer data to output
|
||||
output_0_udp_payload_tvalid_next = output_udp_payload_tvalid_int & (select_reg == 2'd0);
|
||||
output_1_udp_payload_tvalid_next = output_udp_payload_tvalid_int & (select_reg == 2'd1);
|
||||
output_2_udp_payload_tvalid_next = output_udp_payload_tvalid_int & (select_reg == 2'd2);
|
||||
output_3_udp_payload_tvalid_next = output_udp_payload_tvalid_int & (select_reg == 2'd3);
|
||||
store_udp_payload_int_to_output = 1'b1;
|
||||
end else begin
|
||||
// output is not ready, store input in temp
|
||||
temp_udp_payload_tvalid_next = output_udp_payload_tvalid_int;
|
||||
store_udp_payload_int_to_temp = 1'b1;
|
||||
end
|
||||
end else if (current_output_tready) begin
|
||||
// input is not ready, but output is ready
|
||||
output_0_udp_payload_tvalid_next = temp_udp_payload_tvalid_reg & (select_reg == 2'd0);
|
||||
output_1_udp_payload_tvalid_next = temp_udp_payload_tvalid_reg & (select_reg == 2'd1);
|
||||
output_2_udp_payload_tvalid_next = temp_udp_payload_tvalid_reg & (select_reg == 2'd2);
|
||||
output_3_udp_payload_tvalid_next = temp_udp_payload_tvalid_reg & (select_reg == 2'd3);
|
||||
temp_udp_payload_tvalid_next = 1'b0;
|
||||
store_udp_payload_temp_to_output = 1'b1;
|
||||
end
|
||||
end
|
||||
|
||||
always @(posedge clk) begin
|
||||
if (rst) begin
|
||||
output_0_udp_payload_tvalid_reg <= 1'b0;
|
||||
output_1_udp_payload_tvalid_reg <= 1'b0;
|
||||
output_2_udp_payload_tvalid_reg <= 1'b0;
|
||||
output_3_udp_payload_tvalid_reg <= 1'b0;
|
||||
output_udp_payload_tready_int_reg <= 1'b0;
|
||||
temp_udp_payload_tvalid_reg <= 1'b0;
|
||||
end else begin
|
||||
output_0_udp_payload_tvalid_reg <= output_0_udp_payload_tvalid_next;
|
||||
output_1_udp_payload_tvalid_reg <= output_1_udp_payload_tvalid_next;
|
||||
output_2_udp_payload_tvalid_reg <= output_2_udp_payload_tvalid_next;
|
||||
output_3_udp_payload_tvalid_reg <= output_3_udp_payload_tvalid_next;
|
||||
output_udp_payload_tready_int_reg <= output_udp_payload_tready_int_early;
|
||||
temp_udp_payload_tvalid_reg <= temp_udp_payload_tvalid_next;
|
||||
end
|
||||
|
||||
// datapath
|
||||
if (store_udp_payload_int_to_output) begin
|
||||
output_udp_payload_tdata_reg <= output_udp_payload_tdata_int;
|
||||
output_udp_payload_tkeep_reg <= output_udp_payload_tkeep_int;
|
||||
output_udp_payload_tlast_reg <= output_udp_payload_tlast_int;
|
||||
output_udp_payload_tuser_reg <= output_udp_payload_tuser_int;
|
||||
end else if (store_udp_payload_temp_to_output) begin
|
||||
output_udp_payload_tdata_reg <= temp_udp_payload_tdata_reg;
|
||||
output_udp_payload_tkeep_reg <= temp_udp_payload_tkeep_reg;
|
||||
output_udp_payload_tlast_reg <= temp_udp_payload_tlast_reg;
|
||||
output_udp_payload_tuser_reg <= temp_udp_payload_tuser_reg;
|
||||
end
|
||||
|
||||
if (store_udp_payload_int_to_temp) begin
|
||||
temp_udp_payload_tdata_reg <= output_udp_payload_tdata_int;
|
||||
temp_udp_payload_tkeep_reg <= output_udp_payload_tkeep_int;
|
||||
temp_udp_payload_tlast_reg <= output_udp_payload_tlast_int;
|
||||
temp_udp_payload_tuser_reg <= output_udp_payload_tuser_int;
|
||||
end
|
||||
end
|
||||
|
||||
endmodule
|
@ -28,8 +28,8 @@ import os
|
||||
|
||||
import udp_ep
|
||||
|
||||
module = 'udp_demux_4'
|
||||
testbench = 'test_%s' % module
|
||||
module = 'udp_demux'
|
||||
testbench = 'test_%s_4' % module
|
||||
|
||||
srcs = []
|
||||
|
||||
@ -42,340 +42,208 @@ build_cmd = "iverilog -o %s.vvp %s" % (testbench, src)
|
||||
|
||||
def bench():
|
||||
|
||||
# Parameters
|
||||
M_COUNT = 4
|
||||
DATA_WIDTH = 8
|
||||
KEEP_ENABLE = (DATA_WIDTH>8)
|
||||
KEEP_WIDTH = (DATA_WIDTH/8)
|
||||
ID_ENABLE = 1
|
||||
ID_WIDTH = 8
|
||||
DEST_ENABLE = 1
|
||||
DEST_WIDTH = 8
|
||||
USER_ENABLE = 1
|
||||
USER_WIDTH = 1
|
||||
|
||||
# Inputs
|
||||
clk = Signal(bool(0))
|
||||
rst = Signal(bool(0))
|
||||
current_test = Signal(intbv(0)[8:])
|
||||
|
||||
input_udp_hdr_valid = Signal(bool(0))
|
||||
input_eth_dest_mac = Signal(intbv(0)[48:])
|
||||
input_eth_src_mac = Signal(intbv(0)[48:])
|
||||
input_eth_type = Signal(intbv(0)[16:])
|
||||
input_ip_version = Signal(intbv(0)[4:])
|
||||
input_ip_ihl = Signal(intbv(0)[4:])
|
||||
input_ip_dscp = Signal(intbv(0)[6:])
|
||||
input_ip_ecn = Signal(intbv(0)[2:])
|
||||
input_ip_length = Signal(intbv(0)[16:])
|
||||
input_ip_identification = Signal(intbv(0)[16:])
|
||||
input_ip_flags = Signal(intbv(0)[3:])
|
||||
input_ip_fragment_offset = Signal(intbv(0)[13:])
|
||||
input_ip_ttl = Signal(intbv(0)[8:])
|
||||
input_ip_protocol = Signal(intbv(0)[8:])
|
||||
input_ip_header_checksum = Signal(intbv(0)[16:])
|
||||
input_ip_source_ip = Signal(intbv(0)[32:])
|
||||
input_ip_dest_ip = Signal(intbv(0)[32:])
|
||||
input_udp_source_port = Signal(intbv(0)[16:])
|
||||
input_udp_dest_port = Signal(intbv(0)[16:])
|
||||
input_udp_length = Signal(intbv(0)[16:])
|
||||
input_udp_checksum = Signal(intbv(0)[16:])
|
||||
input_udp_payload_tdata = Signal(intbv(0)[8:])
|
||||
input_udp_payload_tvalid = Signal(bool(0))
|
||||
input_udp_payload_tlast = Signal(bool(0))
|
||||
input_udp_payload_tuser = Signal(bool(0))
|
||||
s_udp_hdr_valid = Signal(bool(0))
|
||||
s_eth_dest_mac = Signal(intbv(0)[48:])
|
||||
s_eth_src_mac = Signal(intbv(0)[48:])
|
||||
s_eth_type = Signal(intbv(0)[16:])
|
||||
s_ip_version = Signal(intbv(0)[4:])
|
||||
s_ip_ihl = Signal(intbv(0)[4:])
|
||||
s_ip_dscp = Signal(intbv(0)[6:])
|
||||
s_ip_ecn = Signal(intbv(0)[2:])
|
||||
s_ip_length = Signal(intbv(0)[16:])
|
||||
s_ip_identification = Signal(intbv(0)[16:])
|
||||
s_ip_flags = Signal(intbv(0)[3:])
|
||||
s_ip_fragment_offset = Signal(intbv(0)[13:])
|
||||
s_ip_ttl = Signal(intbv(0)[8:])
|
||||
s_ip_protocol = Signal(intbv(0)[8:])
|
||||
s_ip_header_checksum = Signal(intbv(0)[16:])
|
||||
s_ip_source_ip = Signal(intbv(0)[32:])
|
||||
s_ip_dest_ip = Signal(intbv(0)[32:])
|
||||
s_udp_source_port = Signal(intbv(0)[16:])
|
||||
s_udp_dest_port = Signal(intbv(0)[16:])
|
||||
s_udp_length = Signal(intbv(0)[16:])
|
||||
s_udp_checksum = Signal(intbv(0)[16:])
|
||||
s_udp_payload_axis_tdata = Signal(intbv(0)[DATA_WIDTH:])
|
||||
s_udp_payload_axis_tkeep = Signal(intbv(1)[KEEP_WIDTH:])
|
||||
s_udp_payload_axis_tvalid = Signal(bool(0))
|
||||
s_udp_payload_axis_tlast = Signal(bool(0))
|
||||
s_udp_payload_axis_tid = Signal(intbv(0)[ID_WIDTH:])
|
||||
s_udp_payload_axis_tdest = Signal(intbv(0)[DEST_WIDTH:])
|
||||
s_udp_payload_axis_tuser = Signal(intbv(0)[USER_WIDTH:])
|
||||
|
||||
output_0_udp_hdr_ready = Signal(bool(0))
|
||||
output_0_udp_payload_tready = Signal(bool(0))
|
||||
output_1_udp_hdr_ready = Signal(bool(0))
|
||||
output_1_udp_payload_tready = Signal(bool(0))
|
||||
output_2_udp_hdr_ready = Signal(bool(0))
|
||||
output_2_udp_payload_tready = Signal(bool(0))
|
||||
output_3_udp_hdr_ready = Signal(bool(0))
|
||||
output_3_udp_payload_tready = Signal(bool(0))
|
||||
m_udp_hdr_ready_list = [Signal(bool(0)) for i in range(M_COUNT)]
|
||||
m_udp_payload_axis_tready_list = [Signal(bool(0)) for i in range(M_COUNT)]
|
||||
|
||||
m_udp_hdr_ready = ConcatSignal(*reversed(m_udp_hdr_ready_list))
|
||||
m_udp_payload_axis_tready = ConcatSignal(*reversed(m_udp_payload_axis_tready_list))
|
||||
|
||||
enable = Signal(bool(0))
|
||||
drop = Signal(bool(0))
|
||||
select = Signal(intbv(0)[2:])
|
||||
|
||||
# Outputs
|
||||
input_udp_hdr_ready = Signal(bool(0))
|
||||
input_udp_payload_tready = Signal(bool(0))
|
||||
s_udp_hdr_ready = Signal(bool(0))
|
||||
s_udp_payload_axis_tready = Signal(bool(0))
|
||||
|
||||
output_0_udp_hdr_valid = Signal(bool(0))
|
||||
output_0_eth_dest_mac = Signal(intbv(0)[48:])
|
||||
output_0_eth_src_mac = Signal(intbv(0)[48:])
|
||||
output_0_eth_type = Signal(intbv(0)[16:])
|
||||
output_0_ip_version = Signal(intbv(0)[4:])
|
||||
output_0_ip_ihl = Signal(intbv(0)[4:])
|
||||
output_0_ip_dscp = Signal(intbv(0)[6:])
|
||||
output_0_ip_ecn = Signal(intbv(0)[2:])
|
||||
output_0_ip_length = Signal(intbv(0)[16:])
|
||||
output_0_ip_identification = Signal(intbv(0)[16:])
|
||||
output_0_ip_flags = Signal(intbv(0)[3:])
|
||||
output_0_ip_fragment_offset = Signal(intbv(0)[13:])
|
||||
output_0_ip_ttl = Signal(intbv(0)[8:])
|
||||
output_0_ip_protocol = Signal(intbv(0)[8:])
|
||||
output_0_ip_header_checksum = Signal(intbv(0)[16:])
|
||||
output_0_ip_source_ip = Signal(intbv(0)[32:])
|
||||
output_0_ip_dest_ip = Signal(intbv(0)[32:])
|
||||
output_0_udp_source_port = Signal(intbv(0)[16:])
|
||||
output_0_udp_dest_port = Signal(intbv(0)[16:])
|
||||
output_0_udp_length = Signal(intbv(0)[16:])
|
||||
output_0_udp_checksum = Signal(intbv(0)[16:])
|
||||
output_0_udp_payload_tdata = Signal(intbv(0)[8:])
|
||||
output_0_udp_payload_tvalid = Signal(bool(0))
|
||||
output_0_udp_payload_tlast = Signal(bool(0))
|
||||
output_0_udp_payload_tuser = Signal(bool(0))
|
||||
output_1_udp_hdr_valid = Signal(bool(0))
|
||||
output_1_eth_dest_mac = Signal(intbv(0)[48:])
|
||||
output_1_eth_src_mac = Signal(intbv(0)[48:])
|
||||
output_1_eth_type = Signal(intbv(0)[16:])
|
||||
output_1_ip_version = Signal(intbv(0)[4:])
|
||||
output_1_ip_ihl = Signal(intbv(0)[4:])
|
||||
output_1_ip_dscp = Signal(intbv(0)[6:])
|
||||
output_1_ip_ecn = Signal(intbv(0)[2:])
|
||||
output_1_ip_length = Signal(intbv(0)[16:])
|
||||
output_1_ip_identification = Signal(intbv(0)[16:])
|
||||
output_1_ip_flags = Signal(intbv(0)[3:])
|
||||
output_1_ip_fragment_offset = Signal(intbv(0)[13:])
|
||||
output_1_ip_ttl = Signal(intbv(0)[8:])
|
||||
output_1_ip_protocol = Signal(intbv(0)[8:])
|
||||
output_1_ip_header_checksum = Signal(intbv(0)[16:])
|
||||
output_1_ip_source_ip = Signal(intbv(0)[32:])
|
||||
output_1_ip_dest_ip = Signal(intbv(0)[32:])
|
||||
output_1_udp_source_port = Signal(intbv(0)[16:])
|
||||
output_1_udp_dest_port = Signal(intbv(0)[16:])
|
||||
output_1_udp_length = Signal(intbv(0)[16:])
|
||||
output_1_udp_checksum = Signal(intbv(0)[16:])
|
||||
output_1_udp_payload_tdata = Signal(intbv(0)[8:])
|
||||
output_1_udp_payload_tvalid = Signal(bool(0))
|
||||
output_1_udp_payload_tlast = Signal(bool(0))
|
||||
output_1_udp_payload_tuser = Signal(bool(0))
|
||||
output_2_udp_hdr_valid = Signal(bool(0))
|
||||
output_2_eth_dest_mac = Signal(intbv(0)[48:])
|
||||
output_2_eth_src_mac = Signal(intbv(0)[48:])
|
||||
output_2_eth_type = Signal(intbv(0)[16:])
|
||||
output_2_ip_version = Signal(intbv(0)[4:])
|
||||
output_2_ip_ihl = Signal(intbv(0)[4:])
|
||||
output_2_ip_dscp = Signal(intbv(0)[6:])
|
||||
output_2_ip_ecn = Signal(intbv(0)[2:])
|
||||
output_2_ip_length = Signal(intbv(0)[16:])
|
||||
output_2_ip_identification = Signal(intbv(0)[16:])
|
||||
output_2_ip_flags = Signal(intbv(0)[3:])
|
||||
output_2_ip_fragment_offset = Signal(intbv(0)[13:])
|
||||
output_2_ip_ttl = Signal(intbv(0)[8:])
|
||||
output_2_ip_protocol = Signal(intbv(0)[8:])
|
||||
output_2_ip_header_checksum = Signal(intbv(0)[16:])
|
||||
output_2_ip_source_ip = Signal(intbv(0)[32:])
|
||||
output_2_ip_dest_ip = Signal(intbv(0)[32:])
|
||||
output_2_udp_source_port = Signal(intbv(0)[16:])
|
||||
output_2_udp_dest_port = Signal(intbv(0)[16:])
|
||||
output_2_udp_length = Signal(intbv(0)[16:])
|
||||
output_2_udp_checksum = Signal(intbv(0)[16:])
|
||||
output_2_udp_payload_tdata = Signal(intbv(0)[8:])
|
||||
output_2_udp_payload_tvalid = Signal(bool(0))
|
||||
output_2_udp_payload_tlast = Signal(bool(0))
|
||||
output_2_udp_payload_tuser = Signal(bool(0))
|
||||
output_3_udp_hdr_valid = Signal(bool(0))
|
||||
output_3_eth_dest_mac = Signal(intbv(0)[48:])
|
||||
output_3_eth_src_mac = Signal(intbv(0)[48:])
|
||||
output_3_eth_type = Signal(intbv(0)[16:])
|
||||
output_3_ip_version = Signal(intbv(0)[4:])
|
||||
output_3_ip_ihl = Signal(intbv(0)[4:])
|
||||
output_3_ip_dscp = Signal(intbv(0)[6:])
|
||||
output_3_ip_ecn = Signal(intbv(0)[2:])
|
||||
output_3_ip_length = Signal(intbv(0)[16:])
|
||||
output_3_ip_identification = Signal(intbv(0)[16:])
|
||||
output_3_ip_flags = Signal(intbv(0)[3:])
|
||||
output_3_ip_fragment_offset = Signal(intbv(0)[13:])
|
||||
output_3_ip_ttl = Signal(intbv(0)[8:])
|
||||
output_3_ip_protocol = Signal(intbv(0)[8:])
|
||||
output_3_ip_header_checksum = Signal(intbv(0)[16:])
|
||||
output_3_ip_source_ip = Signal(intbv(0)[32:])
|
||||
output_3_ip_dest_ip = Signal(intbv(0)[32:])
|
||||
output_3_udp_source_port = Signal(intbv(0)[16:])
|
||||
output_3_udp_dest_port = Signal(intbv(0)[16:])
|
||||
output_3_udp_length = Signal(intbv(0)[16:])
|
||||
output_3_udp_checksum = Signal(intbv(0)[16:])
|
||||
output_3_udp_payload_tdata = Signal(intbv(0)[8:])
|
||||
output_3_udp_payload_tvalid = Signal(bool(0))
|
||||
output_3_udp_payload_tlast = Signal(bool(0))
|
||||
output_3_udp_payload_tuser = Signal(bool(0))
|
||||
m_udp_hdr_valid = Signal(intbv(0)[M_COUNT:])
|
||||
m_eth_dest_mac = Signal(intbv(0)[M_COUNT*48:])
|
||||
m_eth_src_mac = Signal(intbv(0)[M_COUNT*48:])
|
||||
m_eth_type = Signal(intbv(0)[M_COUNT*16:])
|
||||
m_ip_version = Signal(intbv(0)[M_COUNT*4:])
|
||||
m_ip_ihl = Signal(intbv(0)[M_COUNT*4:])
|
||||
m_ip_dscp = Signal(intbv(0)[M_COUNT*6:])
|
||||
m_ip_ecn = Signal(intbv(0)[M_COUNT*2:])
|
||||
m_ip_length = Signal(intbv(0)[M_COUNT*16:])
|
||||
m_ip_identification = Signal(intbv(0)[M_COUNT*16:])
|
||||
m_ip_flags = Signal(intbv(0)[M_COUNT*3:])
|
||||
m_ip_fragment_offset = Signal(intbv(0)[M_COUNT*13:])
|
||||
m_ip_ttl = Signal(intbv(0)[M_COUNT*8:])
|
||||
m_ip_protocol = Signal(intbv(0)[M_COUNT*8:])
|
||||
m_ip_header_checksum = Signal(intbv(0)[M_COUNT*16:])
|
||||
m_ip_source_ip = Signal(intbv(0)[M_COUNT*32:])
|
||||
m_ip_dest_ip = Signal(intbv(0)[M_COUNT*32:])
|
||||
m_udp_source_port = Signal(intbv(0)[M_COUNT*16:])
|
||||
m_udp_dest_port = Signal(intbv(0)[M_COUNT*16:])
|
||||
m_udp_length = Signal(intbv(0)[M_COUNT*16:])
|
||||
m_udp_checksum = Signal(intbv(0)[M_COUNT*16:])
|
||||
m_udp_payload_axis_tdata = Signal(intbv(0)[M_COUNT*DATA_WIDTH:])
|
||||
m_udp_payload_axis_tkeep = Signal(intbv(0xf)[M_COUNT*KEEP_WIDTH:])
|
||||
m_udp_payload_axis_tvalid = Signal(intbv(0)[M_COUNT:])
|
||||
m_udp_payload_axis_tlast = Signal(intbv(0)[M_COUNT:])
|
||||
m_udp_payload_axis_tid = Signal(intbv(0)[M_COUNT*ID_WIDTH:])
|
||||
m_udp_payload_axis_tdest = Signal(intbv(0)[M_COUNT*DEST_WIDTH:])
|
||||
m_udp_payload_axis_tuser = Signal(intbv(0)[M_COUNT*USER_WIDTH:])
|
||||
|
||||
m_udp_hdr_valid_list = [m_udp_hdr_valid(i) for i in range(M_COUNT)]
|
||||
m_eth_dest_mac_list = [m_eth_dest_mac((i+1)*48, i*48) for i in range(M_COUNT)]
|
||||
m_eth_src_mac_list = [m_eth_src_mac((i+1)*48, i*48) for i in range(M_COUNT)]
|
||||
m_eth_type_list = [m_eth_type((i+1)*16, i*16) for i in range(M_COUNT)]
|
||||
m_ip_version_list = [m_ip_version((i+1)*4, i*4) for i in range(M_COUNT)]
|
||||
m_ip_ihl_list = [m_ip_ihl((i+1)*4, i*4) for i in range(M_COUNT)]
|
||||
m_ip_dscp_list = [m_ip_dscp((i+1)*6, i*6) for i in range(M_COUNT)]
|
||||
m_ip_ecn_list = [m_ip_ecn((i+1)*2, i*2) for i in range(M_COUNT)]
|
||||
m_ip_length_list = [m_ip_length((i+1)*16, i*16) for i in range(M_COUNT)]
|
||||
m_ip_identification_list = [m_ip_identification((i+1)*16, i*16) for i in range(M_COUNT)]
|
||||
m_ip_flags_list = [m_ip_flags((i+1)*3, i*3) for i in range(M_COUNT)]
|
||||
m_ip_fragment_offset_list = [m_ip_fragment_offset((i+1)*13, i*13) for i in range(M_COUNT)]
|
||||
m_ip_ttl_list = [m_ip_ttl((i+1)*8, i*8) for i in range(M_COUNT)]
|
||||
m_ip_protocol_list = [m_ip_protocol((i+1)*8, i*8) for i in range(M_COUNT)]
|
||||
m_ip_header_checksum_list = [m_ip_header_checksum((i+1)*16, i*16) for i in range(M_COUNT)]
|
||||
m_ip_source_ip_list = [m_ip_source_ip((i+1)*32, i*32) for i in range(M_COUNT)]
|
||||
m_ip_dest_ip_list = [m_ip_dest_ip((i+1)*32, i*32) for i in range(M_COUNT)]
|
||||
m_udp_source_port_list = [m_udp_source_port((i+1)*16, i*16) for i in range(M_COUNT)]
|
||||
m_udp_dest_port_list = [m_udp_dest_port((i+1)*16, i*16) for i in range(M_COUNT)]
|
||||
m_udp_length_list = [m_udp_length((i+1)*16, i*16) for i in range(M_COUNT)]
|
||||
m_udp_checksum_list = [m_udp_checksum((i+1)*16, i*16) for i in range(M_COUNT)]
|
||||
m_udp_payload_axis_tdata_list = [m_udp_payload_axis_tdata((i+1)*DATA_WIDTH, i*DATA_WIDTH) for i in range(M_COUNT)]
|
||||
m_udp_payload_axis_tkeep_list = [m_udp_payload_axis_tkeep((i+1)*KEEP_WIDTH, i*KEEP_WIDTH) for i in range(M_COUNT)]
|
||||
m_udp_payload_axis_tvalid_list = [m_udp_payload_axis_tvalid(i) for i in range(M_COUNT)]
|
||||
m_udp_payload_axis_tlast_list = [m_udp_payload_axis_tlast(i) for i in range(M_COUNT)]
|
||||
m_udp_payload_axis_tid_list = [m_udp_payload_axis_tid((i+1)*ID_WIDTH, i*ID_WIDTH) for i in range(M_COUNT)]
|
||||
m_udp_payload_axis_tdest_list = [m_udp_payload_axis_tdest((i+1)*DEST_WIDTH, i*DEST_WIDTH) for i in range(M_COUNT)]
|
||||
m_udp_payload_axis_tuser_list = [m_udp_payload_axis_tuser((i+1)*USER_WIDTH, i*USER_WIDTH) for i in range(M_COUNT)]
|
||||
|
||||
# sources and sinks
|
||||
source_pause = Signal(bool(0))
|
||||
sink_0_pause = Signal(bool(0))
|
||||
sink_1_pause = Signal(bool(0))
|
||||
sink_2_pause = Signal(bool(0))
|
||||
sink_3_pause = Signal(bool(0))
|
||||
sink_pause_list = []
|
||||
sink_list = []
|
||||
sink_logic_list = []
|
||||
|
||||
source = udp_ep.UDPFrameSource()
|
||||
|
||||
source_logic = source.create_logic(
|
||||
clk,
|
||||
rst,
|
||||
udp_hdr_ready=input_udp_hdr_ready,
|
||||
udp_hdr_valid=input_udp_hdr_valid,
|
||||
eth_dest_mac=input_eth_dest_mac,
|
||||
eth_src_mac=input_eth_src_mac,
|
||||
eth_type=input_eth_type,
|
||||
ip_version=input_ip_version,
|
||||
ip_ihl=input_ip_ihl,
|
||||
ip_dscp=input_ip_dscp,
|
||||
ip_ecn=input_ip_ecn,
|
||||
ip_length=input_ip_length,
|
||||
ip_identification=input_ip_identification,
|
||||
ip_flags=input_ip_flags,
|
||||
ip_fragment_offset=input_ip_fragment_offset,
|
||||
ip_ttl=input_ip_ttl,
|
||||
ip_protocol=input_ip_protocol,
|
||||
ip_header_checksum=input_ip_header_checksum,
|
||||
ip_source_ip=input_ip_source_ip,
|
||||
ip_dest_ip=input_ip_dest_ip,
|
||||
udp_source_port=input_udp_source_port,
|
||||
udp_dest_port=input_udp_dest_port,
|
||||
udp_length=input_udp_length,
|
||||
udp_checksum=input_udp_checksum,
|
||||
udp_payload_tdata=input_udp_payload_tdata,
|
||||
udp_payload_tvalid=input_udp_payload_tvalid,
|
||||
udp_payload_tready=input_udp_payload_tready,
|
||||
udp_payload_tlast=input_udp_payload_tlast,
|
||||
udp_payload_tuser=input_udp_payload_tuser,
|
||||
udp_hdr_ready=s_udp_hdr_ready,
|
||||
udp_hdr_valid=s_udp_hdr_valid,
|
||||
eth_dest_mac=s_eth_dest_mac,
|
||||
eth_src_mac=s_eth_src_mac,
|
||||
eth_type=s_eth_type,
|
||||
ip_version=s_ip_version,
|
||||
ip_ihl=s_ip_ihl,
|
||||
ip_dscp=s_ip_dscp,
|
||||
ip_ecn=s_ip_ecn,
|
||||
ip_length=s_ip_length,
|
||||
ip_identification=s_ip_identification,
|
||||
ip_flags=s_ip_flags,
|
||||
ip_fragment_offset=s_ip_fragment_offset,
|
||||
ip_ttl=s_ip_ttl,
|
||||
ip_protocol=s_ip_protocol,
|
||||
ip_header_checksum=s_ip_header_checksum,
|
||||
ip_source_ip=s_ip_source_ip,
|
||||
ip_dest_ip=s_ip_dest_ip,
|
||||
udp_source_port=s_udp_source_port,
|
||||
udp_dest_port=s_udp_dest_port,
|
||||
udp_length=s_udp_length,
|
||||
udp_checksum=s_udp_checksum,
|
||||
udp_payload_tdata=s_udp_payload_axis_tdata,
|
||||
udp_payload_tkeep=s_udp_payload_axis_tkeep,
|
||||
udp_payload_tvalid=s_udp_payload_axis_tvalid,
|
||||
udp_payload_tready=s_udp_payload_axis_tready,
|
||||
udp_payload_tlast=s_udp_payload_axis_tlast,
|
||||
udp_payload_tuser=s_udp_payload_axis_tuser,
|
||||
pause=source_pause,
|
||||
name='source'
|
||||
)
|
||||
|
||||
sink_0 = udp_ep.UDPFrameSink()
|
||||
for k in range(M_COUNT):
|
||||
s = udp_ep.UDPFrameSink()
|
||||
p = Signal(bool(0))
|
||||
|
||||
sink_0_logic = sink_0.create_logic(
|
||||
clk,
|
||||
rst,
|
||||
udp_hdr_ready=output_0_udp_hdr_ready,
|
||||
udp_hdr_valid=output_0_udp_hdr_valid,
|
||||
eth_dest_mac=output_0_eth_dest_mac,
|
||||
eth_src_mac=output_0_eth_src_mac,
|
||||
eth_type=output_0_eth_type,
|
||||
ip_version=output_0_ip_version,
|
||||
ip_ihl=output_0_ip_ihl,
|
||||
ip_dscp=output_0_ip_dscp,
|
||||
ip_ecn=output_0_ip_ecn,
|
||||
ip_length=output_0_ip_length,
|
||||
ip_identification=output_0_ip_identification,
|
||||
ip_flags=output_0_ip_flags,
|
||||
ip_fragment_offset=output_0_ip_fragment_offset,
|
||||
ip_ttl=output_0_ip_ttl,
|
||||
ip_protocol=output_0_ip_protocol,
|
||||
ip_header_checksum=output_0_ip_header_checksum,
|
||||
ip_source_ip=output_0_ip_source_ip,
|
||||
ip_dest_ip=output_0_ip_dest_ip,
|
||||
udp_source_port=output_0_udp_source_port,
|
||||
udp_dest_port=output_0_udp_dest_port,
|
||||
udp_length=output_0_udp_length,
|
||||
udp_checksum=output_0_udp_checksum,
|
||||
udp_payload_tdata=output_0_udp_payload_tdata,
|
||||
udp_payload_tvalid=output_0_udp_payload_tvalid,
|
||||
udp_payload_tready=output_0_udp_payload_tready,
|
||||
udp_payload_tlast=output_0_udp_payload_tlast,
|
||||
udp_payload_tuser=output_0_udp_payload_tuser,
|
||||
pause=sink_0_pause,
|
||||
name='sink_0'
|
||||
)
|
||||
sink_list.append(s)
|
||||
sink_pause_list.append(p)
|
||||
|
||||
sink_1 = udp_ep.UDPFrameSink()
|
||||
|
||||
sink_1_logic = sink_1.create_logic(
|
||||
clk,
|
||||
rst,
|
||||
udp_hdr_ready=output_1_udp_hdr_ready,
|
||||
udp_hdr_valid=output_1_udp_hdr_valid,
|
||||
eth_dest_mac=output_1_eth_dest_mac,
|
||||
eth_src_mac=output_1_eth_src_mac,
|
||||
eth_type=output_1_eth_type,
|
||||
ip_version=output_1_ip_version,
|
||||
ip_ihl=output_1_ip_ihl,
|
||||
ip_dscp=output_1_ip_dscp,
|
||||
ip_ecn=output_1_ip_ecn,
|
||||
ip_length=output_1_ip_length,
|
||||
ip_identification=output_1_ip_identification,
|
||||
ip_flags=output_1_ip_flags,
|
||||
ip_fragment_offset=output_1_ip_fragment_offset,
|
||||
ip_ttl=output_1_ip_ttl,
|
||||
ip_protocol=output_1_ip_protocol,
|
||||
ip_header_checksum=output_1_ip_header_checksum,
|
||||
ip_source_ip=output_1_ip_source_ip,
|
||||
ip_dest_ip=output_1_ip_dest_ip,
|
||||
udp_source_port=output_1_udp_source_port,
|
||||
udp_dest_port=output_1_udp_dest_port,
|
||||
udp_length=output_1_udp_length,
|
||||
udp_checksum=output_1_udp_checksum,
|
||||
udp_payload_tdata=output_1_udp_payload_tdata,
|
||||
udp_payload_tvalid=output_1_udp_payload_tvalid,
|
||||
udp_payload_tready=output_1_udp_payload_tready,
|
||||
udp_payload_tlast=output_1_udp_payload_tlast,
|
||||
udp_payload_tuser=output_1_udp_payload_tuser,
|
||||
pause=sink_1_pause,
|
||||
name='sink_1'
|
||||
)
|
||||
|
||||
sink_2 = udp_ep.UDPFrameSink()
|
||||
|
||||
sink_2_logic = sink_2.create_logic(
|
||||
clk,
|
||||
rst,
|
||||
udp_hdr_ready=output_2_udp_hdr_ready,
|
||||
udp_hdr_valid=output_2_udp_hdr_valid,
|
||||
eth_dest_mac=output_2_eth_dest_mac,
|
||||
eth_src_mac=output_2_eth_src_mac,
|
||||
eth_type=output_2_eth_type,
|
||||
ip_version=output_2_ip_version,
|
||||
ip_ihl=output_2_ip_ihl,
|
||||
ip_dscp=output_2_ip_dscp,
|
||||
ip_ecn=output_2_ip_ecn,
|
||||
ip_length=output_2_ip_length,
|
||||
ip_identification=output_2_ip_identification,
|
||||
ip_flags=output_2_ip_flags,
|
||||
ip_fragment_offset=output_2_ip_fragment_offset,
|
||||
ip_ttl=output_2_ip_ttl,
|
||||
ip_protocol=output_2_ip_protocol,
|
||||
ip_header_checksum=output_2_ip_header_checksum,
|
||||
ip_source_ip=output_2_ip_source_ip,
|
||||
ip_dest_ip=output_2_ip_dest_ip,
|
||||
udp_source_port=output_2_udp_source_port,
|
||||
udp_dest_port=output_2_udp_dest_port,
|
||||
udp_length=output_2_udp_length,
|
||||
udp_checksum=output_2_udp_checksum,
|
||||
udp_payload_tdata=output_2_udp_payload_tdata,
|
||||
udp_payload_tvalid=output_2_udp_payload_tvalid,
|
||||
udp_payload_tready=output_2_udp_payload_tready,
|
||||
udp_payload_tlast=output_2_udp_payload_tlast,
|
||||
udp_payload_tuser=output_2_udp_payload_tuser,
|
||||
pause=sink_2_pause,
|
||||
name='sink_2'
|
||||
)
|
||||
|
||||
sink_3 = udp_ep.UDPFrameSink()
|
||||
|
||||
sink_3_logic = sink_3.create_logic(
|
||||
clk,
|
||||
rst,
|
||||
udp_hdr_ready=output_3_udp_hdr_ready,
|
||||
udp_hdr_valid=output_3_udp_hdr_valid,
|
||||
eth_dest_mac=output_3_eth_dest_mac,
|
||||
eth_src_mac=output_3_eth_src_mac,
|
||||
eth_type=output_3_eth_type,
|
||||
ip_version=output_3_ip_version,
|
||||
ip_ihl=output_3_ip_ihl,
|
||||
ip_dscp=output_3_ip_dscp,
|
||||
ip_ecn=output_3_ip_ecn,
|
||||
ip_length=output_3_ip_length,
|
||||
ip_identification=output_3_ip_identification,
|
||||
ip_flags=output_3_ip_flags,
|
||||
ip_fragment_offset=output_3_ip_fragment_offset,
|
||||
ip_ttl=output_3_ip_ttl,
|
||||
ip_protocol=output_3_ip_protocol,
|
||||
ip_header_checksum=output_3_ip_header_checksum,
|
||||
ip_source_ip=output_3_ip_source_ip,
|
||||
ip_dest_ip=output_3_ip_dest_ip,
|
||||
udp_source_port=output_3_udp_source_port,
|
||||
udp_dest_port=output_3_udp_dest_port,
|
||||
udp_length=output_3_udp_length,
|
||||
udp_checksum=output_3_udp_checksum,
|
||||
udp_payload_tdata=output_3_udp_payload_tdata,
|
||||
udp_payload_tvalid=output_3_udp_payload_tvalid,
|
||||
udp_payload_tready=output_3_udp_payload_tready,
|
||||
udp_payload_tlast=output_3_udp_payload_tlast,
|
||||
udp_payload_tuser=output_3_udp_payload_tuser,
|
||||
pause=sink_3_pause,
|
||||
name='sink_3'
|
||||
)
|
||||
sink_logic_list.append(s.create_logic(
|
||||
clk,
|
||||
rst,
|
||||
udp_hdr_ready=m_udp_hdr_ready_list[k],
|
||||
udp_hdr_valid=m_udp_hdr_valid_list[k],
|
||||
eth_dest_mac=m_eth_dest_mac_list[k],
|
||||
eth_src_mac=m_eth_src_mac_list[k],
|
||||
eth_type=m_eth_type_list[k],
|
||||
ip_version=m_ip_version_list[k],
|
||||
ip_ihl=m_ip_ihl_list[k],
|
||||
ip_dscp=m_ip_dscp_list[k],
|
||||
ip_ecn=m_ip_ecn_list[k],
|
||||
ip_length=m_ip_length_list[k],
|
||||
ip_identification=m_ip_identification_list[k],
|
||||
ip_flags=m_ip_flags_list[k],
|
||||
ip_fragment_offset=m_ip_fragment_offset_list[k],
|
||||
ip_ttl=m_ip_ttl_list[k],
|
||||
ip_protocol=m_ip_protocol_list[k],
|
||||
ip_header_checksum=m_ip_header_checksum_list[k],
|
||||
ip_source_ip=m_ip_source_ip_list[k],
|
||||
ip_dest_ip=m_ip_dest_ip_list[k],
|
||||
udp_source_port=m_udp_source_port_list[k],
|
||||
udp_dest_port=m_udp_dest_port_list[k],
|
||||
udp_length=m_udp_length_list[k],
|
||||
udp_checksum=m_udp_checksum_list[k],
|
||||
udp_payload_tdata=m_udp_payload_axis_tdata_list[k],
|
||||
udp_payload_tkeep=m_udp_payload_axis_tkeep_list[k],
|
||||
udp_payload_tvalid=m_udp_payload_axis_tvalid_list[k],
|
||||
udp_payload_tready=m_udp_payload_axis_tready_list[k],
|
||||
udp_payload_tlast=m_udp_payload_axis_tlast_list[k],
|
||||
udp_payload_tuser=m_udp_payload_axis_tuser_list[k],
|
||||
pause=p,
|
||||
name='sink_%d' % k
|
||||
))
|
||||
|
||||
# DUT
|
||||
if os.system(build_cmd):
|
||||
@ -387,144 +255,70 @@ def bench():
|
||||
rst=rst,
|
||||
current_test=current_test,
|
||||
|
||||
input_udp_hdr_valid=input_udp_hdr_valid,
|
||||
input_udp_hdr_ready=input_udp_hdr_ready,
|
||||
input_eth_dest_mac=input_eth_dest_mac,
|
||||
input_eth_src_mac=input_eth_src_mac,
|
||||
input_eth_type=input_eth_type,
|
||||
input_ip_version=input_ip_version,
|
||||
input_ip_ihl=input_ip_ihl,
|
||||
input_ip_dscp=input_ip_dscp,
|
||||
input_ip_ecn=input_ip_ecn,
|
||||
input_ip_length=input_ip_length,
|
||||
input_ip_identification=input_ip_identification,
|
||||
input_ip_flags=input_ip_flags,
|
||||
input_ip_fragment_offset=input_ip_fragment_offset,
|
||||
input_ip_ttl=input_ip_ttl,
|
||||
input_ip_protocol=input_ip_protocol,
|
||||
input_ip_header_checksum=input_ip_header_checksum,
|
||||
input_ip_source_ip=input_ip_source_ip,
|
||||
input_ip_dest_ip=input_ip_dest_ip,
|
||||
input_udp_source_port=input_udp_source_port,
|
||||
input_udp_dest_port=input_udp_dest_port,
|
||||
input_udp_length=input_udp_length,
|
||||
input_udp_checksum=input_udp_checksum,
|
||||
input_udp_payload_tdata=input_udp_payload_tdata,
|
||||
input_udp_payload_tvalid=input_udp_payload_tvalid,
|
||||
input_udp_payload_tready=input_udp_payload_tready,
|
||||
input_udp_payload_tlast=input_udp_payload_tlast,
|
||||
input_udp_payload_tuser=input_udp_payload_tuser,
|
||||
s_udp_hdr_valid=s_udp_hdr_valid,
|
||||
s_udp_hdr_ready=s_udp_hdr_ready,
|
||||
s_eth_dest_mac=s_eth_dest_mac,
|
||||
s_eth_src_mac=s_eth_src_mac,
|
||||
s_eth_type=s_eth_type,
|
||||
s_ip_version=s_ip_version,
|
||||
s_ip_ihl=s_ip_ihl,
|
||||
s_ip_dscp=s_ip_dscp,
|
||||
s_ip_ecn=s_ip_ecn,
|
||||
s_ip_length=s_ip_length,
|
||||
s_ip_identification=s_ip_identification,
|
||||
s_ip_flags=s_ip_flags,
|
||||
s_ip_fragment_offset=s_ip_fragment_offset,
|
||||
s_ip_ttl=s_ip_ttl,
|
||||
s_ip_protocol=s_ip_protocol,
|
||||
s_ip_header_checksum=s_ip_header_checksum,
|
||||
s_ip_source_ip=s_ip_source_ip,
|
||||
s_ip_dest_ip=s_ip_dest_ip,
|
||||
s_udp_source_port=s_udp_source_port,
|
||||
s_udp_dest_port=s_udp_dest_port,
|
||||
s_udp_length=s_udp_length,
|
||||
s_udp_checksum=s_udp_checksum,
|
||||
s_udp_payload_axis_tdata=s_udp_payload_axis_tdata,
|
||||
s_udp_payload_axis_tkeep=s_udp_payload_axis_tkeep,
|
||||
s_udp_payload_axis_tvalid=s_udp_payload_axis_tvalid,
|
||||
s_udp_payload_axis_tready=s_udp_payload_axis_tready,
|
||||
s_udp_payload_axis_tlast=s_udp_payload_axis_tlast,
|
||||
s_udp_payload_axis_tid=s_udp_payload_axis_tid,
|
||||
s_udp_payload_axis_tdest=s_udp_payload_axis_tdest,
|
||||
s_udp_payload_axis_tuser=s_udp_payload_axis_tuser,
|
||||
|
||||
output_0_udp_hdr_valid=output_0_udp_hdr_valid,
|
||||
output_0_udp_hdr_ready=output_0_udp_hdr_ready,
|
||||
output_0_eth_dest_mac=output_0_eth_dest_mac,
|
||||
output_0_eth_src_mac=output_0_eth_src_mac,
|
||||
output_0_eth_type=output_0_eth_type,
|
||||
output_0_ip_version=output_0_ip_version,
|
||||
output_0_ip_ihl=output_0_ip_ihl,
|
||||
output_0_ip_dscp=output_0_ip_dscp,
|
||||
output_0_ip_ecn=output_0_ip_ecn,
|
||||
output_0_ip_length=output_0_ip_length,
|
||||
output_0_ip_identification=output_0_ip_identification,
|
||||
output_0_ip_flags=output_0_ip_flags,
|
||||
output_0_ip_fragment_offset=output_0_ip_fragment_offset,
|
||||
output_0_ip_ttl=output_0_ip_ttl,
|
||||
output_0_ip_protocol=output_0_ip_protocol,
|
||||
output_0_ip_header_checksum=output_0_ip_header_checksum,
|
||||
output_0_ip_source_ip=output_0_ip_source_ip,
|
||||
output_0_ip_dest_ip=output_0_ip_dest_ip,
|
||||
output_0_udp_source_port=output_0_udp_source_port,
|
||||
output_0_udp_dest_port=output_0_udp_dest_port,
|
||||
output_0_udp_length=output_0_udp_length,
|
||||
output_0_udp_checksum=output_0_udp_checksum,
|
||||
output_0_udp_payload_tdata=output_0_udp_payload_tdata,
|
||||
output_0_udp_payload_tvalid=output_0_udp_payload_tvalid,
|
||||
output_0_udp_payload_tready=output_0_udp_payload_tready,
|
||||
output_0_udp_payload_tlast=output_0_udp_payload_tlast,
|
||||
output_0_udp_payload_tuser=output_0_udp_payload_tuser,
|
||||
output_1_udp_hdr_valid=output_1_udp_hdr_valid,
|
||||
output_1_udp_hdr_ready=output_1_udp_hdr_ready,
|
||||
output_1_eth_dest_mac=output_1_eth_dest_mac,
|
||||
output_1_eth_src_mac=output_1_eth_src_mac,
|
||||
output_1_eth_type=output_1_eth_type,
|
||||
output_1_ip_version=output_1_ip_version,
|
||||
output_1_ip_ihl=output_1_ip_ihl,
|
||||
output_1_ip_dscp=output_1_ip_dscp,
|
||||
output_1_ip_ecn=output_1_ip_ecn,
|
||||
output_1_ip_length=output_1_ip_length,
|
||||
output_1_ip_identification=output_1_ip_identification,
|
||||
output_1_ip_flags=output_1_ip_flags,
|
||||
output_1_ip_fragment_offset=output_1_ip_fragment_offset,
|
||||
output_1_ip_ttl=output_1_ip_ttl,
|
||||
output_1_ip_protocol=output_1_ip_protocol,
|
||||
output_1_ip_header_checksum=output_1_ip_header_checksum,
|
||||
output_1_ip_source_ip=output_1_ip_source_ip,
|
||||
output_1_ip_dest_ip=output_1_ip_dest_ip,
|
||||
output_1_udp_source_port=output_1_udp_source_port,
|
||||
output_1_udp_dest_port=output_1_udp_dest_port,
|
||||
output_1_udp_length=output_1_udp_length,
|
||||
output_1_udp_checksum=output_1_udp_checksum,
|
||||
output_1_udp_payload_tdata=output_1_udp_payload_tdata,
|
||||
output_1_udp_payload_tvalid=output_1_udp_payload_tvalid,
|
||||
output_1_udp_payload_tready=output_1_udp_payload_tready,
|
||||
output_1_udp_payload_tlast=output_1_udp_payload_tlast,
|
||||
output_1_udp_payload_tuser=output_1_udp_payload_tuser,
|
||||
output_2_udp_hdr_valid=output_2_udp_hdr_valid,
|
||||
output_2_udp_hdr_ready=output_2_udp_hdr_ready,
|
||||
output_2_eth_dest_mac=output_2_eth_dest_mac,
|
||||
output_2_eth_src_mac=output_2_eth_src_mac,
|
||||
output_2_eth_type=output_2_eth_type,
|
||||
output_2_ip_version=output_2_ip_version,
|
||||
output_2_ip_ihl=output_2_ip_ihl,
|
||||
output_2_ip_dscp=output_2_ip_dscp,
|
||||
output_2_ip_ecn=output_2_ip_ecn,
|
||||
output_2_ip_length=output_2_ip_length,
|
||||
output_2_ip_identification=output_2_ip_identification,
|
||||
output_2_ip_flags=output_2_ip_flags,
|
||||
output_2_ip_fragment_offset=output_2_ip_fragment_offset,
|
||||
output_2_ip_ttl=output_2_ip_ttl,
|
||||
output_2_ip_protocol=output_2_ip_protocol,
|
||||
output_2_ip_header_checksum=output_2_ip_header_checksum,
|
||||
output_2_ip_source_ip=output_2_ip_source_ip,
|
||||
output_2_ip_dest_ip=output_2_ip_dest_ip,
|
||||
output_2_udp_source_port=output_2_udp_source_port,
|
||||
output_2_udp_dest_port=output_2_udp_dest_port,
|
||||
output_2_udp_length=output_2_udp_length,
|
||||
output_2_udp_checksum=output_2_udp_checksum,
|
||||
output_2_udp_payload_tdata=output_2_udp_payload_tdata,
|
||||
output_2_udp_payload_tvalid=output_2_udp_payload_tvalid,
|
||||
output_2_udp_payload_tready=output_2_udp_payload_tready,
|
||||
output_2_udp_payload_tlast=output_2_udp_payload_tlast,
|
||||
output_2_udp_payload_tuser=output_2_udp_payload_tuser,
|
||||
output_3_udp_hdr_valid=output_3_udp_hdr_valid,
|
||||
output_3_udp_hdr_ready=output_3_udp_hdr_ready,
|
||||
output_3_eth_dest_mac=output_3_eth_dest_mac,
|
||||
output_3_eth_src_mac=output_3_eth_src_mac,
|
||||
output_3_eth_type=output_3_eth_type,
|
||||
output_3_ip_version=output_3_ip_version,
|
||||
output_3_ip_ihl=output_3_ip_ihl,
|
||||
output_3_ip_dscp=output_3_ip_dscp,
|
||||
output_3_ip_ecn=output_3_ip_ecn,
|
||||
output_3_ip_length=output_3_ip_length,
|
||||
output_3_ip_identification=output_3_ip_identification,
|
||||
output_3_ip_flags=output_3_ip_flags,
|
||||
output_3_ip_fragment_offset=output_3_ip_fragment_offset,
|
||||
output_3_ip_ttl=output_3_ip_ttl,
|
||||
output_3_ip_protocol=output_3_ip_protocol,
|
||||
output_3_ip_header_checksum=output_3_ip_header_checksum,
|
||||
output_3_ip_source_ip=output_3_ip_source_ip,
|
||||
output_3_ip_dest_ip=output_3_ip_dest_ip,
|
||||
output_3_udp_source_port=output_3_udp_source_port,
|
||||
output_3_udp_dest_port=output_3_udp_dest_port,
|
||||
output_3_udp_length=output_3_udp_length,
|
||||
output_3_udp_checksum=output_3_udp_checksum,
|
||||
output_3_udp_payload_tdata=output_3_udp_payload_tdata,
|
||||
output_3_udp_payload_tvalid=output_3_udp_payload_tvalid,
|
||||
output_3_udp_payload_tready=output_3_udp_payload_tready,
|
||||
output_3_udp_payload_tlast=output_3_udp_payload_tlast,
|
||||
output_3_udp_payload_tuser=output_3_udp_payload_tuser,
|
||||
m_udp_hdr_valid=m_udp_hdr_valid,
|
||||
m_udp_hdr_ready=m_udp_hdr_ready,
|
||||
m_eth_dest_mac=m_eth_dest_mac,
|
||||
m_eth_src_mac=m_eth_src_mac,
|
||||
m_eth_type=m_eth_type,
|
||||
m_ip_version=m_ip_version,
|
||||
m_ip_ihl=m_ip_ihl,
|
||||
m_ip_dscp=m_ip_dscp,
|
||||
m_ip_ecn=m_ip_ecn,
|
||||
m_ip_length=m_ip_length,
|
||||
m_ip_identification=m_ip_identification,
|
||||
m_ip_flags=m_ip_flags,
|
||||
m_ip_fragment_offset=m_ip_fragment_offset,
|
||||
m_ip_ttl=m_ip_ttl,
|
||||
m_ip_protocol=m_ip_protocol,
|
||||
m_ip_header_checksum=m_ip_header_checksum,
|
||||
m_ip_source_ip=m_ip_source_ip,
|
||||
m_ip_dest_ip=m_ip_dest_ip,
|
||||
m_udp_source_port=m_udp_source_port,
|
||||
m_udp_dest_port=m_udp_dest_port,
|
||||
m_udp_length=m_udp_length,
|
||||
m_udp_checksum=m_udp_checksum,
|
||||
m_udp_payload_axis_tdata=m_udp_payload_axis_tdata,
|
||||
m_udp_payload_axis_tkeep=m_udp_payload_axis_tkeep,
|
||||
m_udp_payload_axis_tvalid=m_udp_payload_axis_tvalid,
|
||||
m_udp_payload_axis_tready=m_udp_payload_axis_tready,
|
||||
m_udp_payload_axis_tlast=m_udp_payload_axis_tlast,
|
||||
m_udp_payload_axis_tid=m_udp_payload_axis_tid,
|
||||
m_udp_payload_axis_tdest=m_udp_payload_axis_tdest,
|
||||
m_udp_payload_axis_tuser=m_udp_payload_axis_tuser,
|
||||
|
||||
enable=enable,
|
||||
drop=drop,
|
||||
select=select
|
||||
)
|
||||
|
||||
@ -578,8 +372,8 @@ def bench():
|
||||
|
||||
source.send(test_frame)
|
||||
|
||||
yield sink_0.wait()
|
||||
rx_frame = sink_0.recv()
|
||||
yield sink_list[0].wait()
|
||||
rx_frame = sink_list[0].recv()
|
||||
|
||||
assert rx_frame == test_frame
|
||||
|
||||
@ -617,8 +411,8 @@ def bench():
|
||||
|
||||
source.send(test_frame)
|
||||
|
||||
yield sink_1.wait()
|
||||
rx_frame = sink_1.recv()
|
||||
yield sink_list[1].wait()
|
||||
rx_frame = sink_list[1].recv()
|
||||
|
||||
assert rx_frame == test_frame
|
||||
|
||||
@ -680,13 +474,13 @@ def bench():
|
||||
source.send(test_frame1)
|
||||
source.send(test_frame2)
|
||||
|
||||
yield sink_0.wait()
|
||||
rx_frame = sink_0.recv()
|
||||
yield sink_list[0].wait()
|
||||
rx_frame = sink_list[0].recv()
|
||||
|
||||
assert rx_frame == test_frame1
|
||||
|
||||
yield sink_0.wait()
|
||||
rx_frame = sink_0.recv()
|
||||
yield sink_list[0].wait()
|
||||
rx_frame = sink_list[0].recv()
|
||||
|
||||
assert rx_frame == test_frame2
|
||||
|
||||
@ -749,17 +543,17 @@ def bench():
|
||||
source.send(test_frame2)
|
||||
yield clk.posedge
|
||||
|
||||
while input_udp_payload_tvalid or input_udp_hdr_valid:
|
||||
while s_udp_payload_axis_tvalid or s_udp_hdr_valid:
|
||||
yield clk.posedge
|
||||
select.next = 2
|
||||
|
||||
yield sink_1.wait()
|
||||
rx_frame = sink_1.recv()
|
||||
yield sink_list[1].wait()
|
||||
rx_frame = sink_list[1].recv()
|
||||
|
||||
assert rx_frame == test_frame1
|
||||
|
||||
yield sink_2.wait()
|
||||
rx_frame = sink_2.recv()
|
||||
yield sink_list[2].wait()
|
||||
rx_frame = sink_list[2].recv()
|
||||
|
||||
assert rx_frame == test_frame2
|
||||
|
||||
@ -822,7 +616,7 @@ def bench():
|
||||
source.send(test_frame2)
|
||||
yield clk.posedge
|
||||
|
||||
while input_udp_payload_tvalid or input_udp_hdr_valid:
|
||||
while s_udp_payload_axis_tvalid or s_udp_hdr_valid:
|
||||
source_pause.next = True
|
||||
yield clk.posedge
|
||||
yield clk.posedge
|
||||
@ -831,13 +625,13 @@ def bench():
|
||||
yield clk.posedge
|
||||
select.next = 2
|
||||
|
||||
yield sink_1.wait()
|
||||
rx_frame = sink_1.recv()
|
||||
yield sink_list[1].wait()
|
||||
rx_frame = sink_list[1].recv()
|
||||
|
||||
assert rx_frame == test_frame1
|
||||
|
||||
yield sink_2.wait()
|
||||
rx_frame = sink_2.recv()
|
||||
yield sink_list[2].wait()
|
||||
rx_frame = sink_list[2].recv()
|
||||
|
||||
assert rx_frame == test_frame2
|
||||
|
||||
@ -900,33 +694,120 @@ def bench():
|
||||
source.send(test_frame2)
|
||||
yield clk.posedge
|
||||
|
||||
while input_udp_payload_tvalid or input_udp_hdr_valid:
|
||||
sink_0_pause.next = True
|
||||
sink_1_pause.next = True
|
||||
sink_2_pause.next = True
|
||||
sink_3_pause.next = True
|
||||
while s_udp_payload_axis_tvalid or s_udp_hdr_valid:
|
||||
sink_pause_list[0].next = True
|
||||
sink_pause_list[1].next = True
|
||||
sink_pause_list[2].next = True
|
||||
sink_pause_list[3].next = True
|
||||
yield clk.posedge
|
||||
yield clk.posedge
|
||||
yield clk.posedge
|
||||
sink_0_pause.next = False
|
||||
sink_1_pause.next = False
|
||||
sink_2_pause.next = False
|
||||
sink_3_pause.next = False
|
||||
sink_pause_list[0].next = False
|
||||
sink_pause_list[1].next = False
|
||||
sink_pause_list[2].next = False
|
||||
sink_pause_list[3].next = False
|
||||
yield clk.posedge
|
||||
select.next = 2
|
||||
|
||||
yield sink_1.wait()
|
||||
rx_frame = sink_1.recv()
|
||||
yield sink_list[1].wait()
|
||||
rx_frame = sink_list[1].recv()
|
||||
|
||||
assert rx_frame == test_frame1
|
||||
|
||||
yield sink_2.wait()
|
||||
rx_frame = sink_2.recv()
|
||||
yield sink_list[2].wait()
|
||||
rx_frame = sink_list[2].recv()
|
||||
|
||||
assert rx_frame == test_frame2
|
||||
|
||||
yield delay(100)
|
||||
|
||||
yield clk.posedge
|
||||
print("test 7: enable")
|
||||
current_test.next = 7
|
||||
|
||||
enable.next = False
|
||||
select.next = 0
|
||||
|
||||
test_frame = udp_ep.UDPFrame()
|
||||
test_frame.eth_dest_mac = 0xDAD1D2D3D4D5
|
||||
test_frame.eth_src_mac = 0x5A5152535455
|
||||
test_frame.eth_type = 0x8000
|
||||
test_frame.ip_version = 4
|
||||
test_frame.ip_ihl = 5
|
||||
test_frame.ip_dscp = 0
|
||||
test_frame.ip_ecn = 0
|
||||
test_frame.ip_length = None
|
||||
test_frame.ip_identification = 0
|
||||
test_frame.ip_flags = 2
|
||||
test_frame.ip_fragment_offset = 0
|
||||
test_frame.ip_ttl = 64
|
||||
test_frame.ip_protocol = 0x11
|
||||
test_frame.ip_header_checksum = None
|
||||
test_frame.ip_source_ip = 0xc0a80165
|
||||
test_frame.ip_dest_ip = 0xc0a80164
|
||||
test_frame.udp_source_port = 1
|
||||
test_frame.udp_dest_port = 2
|
||||
test_frame.udp_length = None
|
||||
test_frame.udp_checksum = None
|
||||
test_frame.payload = bytearray(range(32))
|
||||
test_frame.build()
|
||||
|
||||
source.send(test_frame)
|
||||
|
||||
yield delay(500)
|
||||
|
||||
assert sink_list[0].empty()
|
||||
|
||||
enable.next = True
|
||||
|
||||
yield sink_list[0].wait()
|
||||
rx_frame = sink_list[0].recv()
|
||||
|
||||
assert rx_frame == test_frame
|
||||
|
||||
yield delay(100)
|
||||
|
||||
yield clk.posedge
|
||||
print("test 8: drop")
|
||||
current_test.next = 8
|
||||
|
||||
drop.next = True
|
||||
select.next = 0
|
||||
|
||||
test_frame = udp_ep.UDPFrame()
|
||||
test_frame.eth_dest_mac = 0xDAD1D2D3D4D5
|
||||
test_frame.eth_src_mac = 0x5A5152535455
|
||||
test_frame.eth_type = 0x8000
|
||||
test_frame.ip_version = 4
|
||||
test_frame.ip_ihl = 5
|
||||
test_frame.ip_dscp = 0
|
||||
test_frame.ip_ecn = 0
|
||||
test_frame.ip_length = None
|
||||
test_frame.ip_identification = 0
|
||||
test_frame.ip_flags = 2
|
||||
test_frame.ip_fragment_offset = 0
|
||||
test_frame.ip_ttl = 64
|
||||
test_frame.ip_protocol = 0x11
|
||||
test_frame.ip_header_checksum = None
|
||||
test_frame.ip_source_ip = 0xc0a80165
|
||||
test_frame.ip_dest_ip = 0xc0a80164
|
||||
test_frame.udp_source_port = 1
|
||||
test_frame.udp_dest_port = 2
|
||||
test_frame.udp_length = None
|
||||
test_frame.udp_checksum = None
|
||||
test_frame.payload = bytearray(range(32))
|
||||
test_frame.build()
|
||||
|
||||
source.send(test_frame)
|
||||
|
||||
yield delay(500)
|
||||
|
||||
assert sink_list[0].empty()
|
||||
|
||||
drop.next = False
|
||||
|
||||
yield delay(100)
|
||||
|
||||
raise StopSimulation
|
||||
|
||||
return instances()
|
||||
|
@ -27,157 +27,95 @@ THE SOFTWARE.
|
||||
`timescale 1ns / 1ps
|
||||
|
||||
/*
|
||||
* Testbench for udp_demux_4
|
||||
* Testbench for udp_demux
|
||||
*/
|
||||
module test_udp_demux_4;
|
||||
|
||||
// Parameters
|
||||
parameter M_COUNT = 4;
|
||||
parameter DATA_WIDTH = 8;
|
||||
parameter KEEP_ENABLE = (DATA_WIDTH>8);
|
||||
parameter KEEP_WIDTH = (DATA_WIDTH/8);
|
||||
parameter ID_ENABLE = 1;
|
||||
parameter ID_WIDTH = 8;
|
||||
parameter DEST_ENABLE = 1;
|
||||
parameter DEST_WIDTH = 8;
|
||||
parameter USER_ENABLE = 1;
|
||||
parameter USER_WIDTH = 1;
|
||||
|
||||
// Inputs
|
||||
reg clk = 0;
|
||||
reg rst = 0;
|
||||
reg [7:0] current_test = 0;
|
||||
|
||||
reg input_udp_hdr_valid = 0;
|
||||
reg [47:0] input_eth_dest_mac = 0;
|
||||
reg [47:0] input_eth_src_mac = 0;
|
||||
reg [15:0] input_eth_type = 0;
|
||||
reg [3:0] input_ip_version = 0;
|
||||
reg [3:0] input_ip_ihl = 0;
|
||||
reg [5:0] input_ip_dscp = 0;
|
||||
reg [1:0] input_ip_ecn = 0;
|
||||
reg [15:0] input_ip_length = 0;
|
||||
reg [15:0] input_ip_identification = 0;
|
||||
reg [2:0] input_ip_flags = 0;
|
||||
reg [12:0] input_ip_fragment_offset = 0;
|
||||
reg [7:0] input_ip_ttl = 0;
|
||||
reg [7:0] input_ip_protocol = 0;
|
||||
reg [15:0] input_ip_header_checksum = 0;
|
||||
reg [31:0] input_ip_source_ip = 0;
|
||||
reg [31:0] input_ip_dest_ip = 0;
|
||||
reg [15:0] input_udp_source_port = 0;
|
||||
reg [15:0] input_udp_dest_port = 0;
|
||||
reg [15:0] input_udp_length = 0;
|
||||
reg [15:0] input_udp_checksum = 0;
|
||||
reg [7:0] input_udp_payload_tdata = 0;
|
||||
reg input_udp_payload_tvalid = 0;
|
||||
reg input_udp_payload_tlast = 0;
|
||||
reg input_udp_payload_tuser = 0;
|
||||
reg s_udp_hdr_valid = 0;
|
||||
reg [47:0] s_eth_dest_mac = 0;
|
||||
reg [47:0] s_eth_src_mac = 0;
|
||||
reg [15:0] s_eth_type = 0;
|
||||
reg [3:0] s_ip_version = 0;
|
||||
reg [3:0] s_ip_ihl = 0;
|
||||
reg [5:0] s_ip_dscp = 0;
|
||||
reg [1:0] s_ip_ecn = 0;
|
||||
reg [15:0] s_ip_length = 0;
|
||||
reg [15:0] s_ip_identification = 0;
|
||||
reg [2:0] s_ip_flags = 0;
|
||||
reg [12:0] s_ip_fragment_offset = 0;
|
||||
reg [7:0] s_ip_ttl = 0;
|
||||
reg [7:0] s_ip_protocol = 0;
|
||||
reg [15:0] s_ip_header_checksum = 0;
|
||||
reg [31:0] s_ip_source_ip = 0;
|
||||
reg [31:0] s_ip_dest_ip = 0;
|
||||
reg [15:0] s_udp_source_port = 0;
|
||||
reg [15:0] s_udp_dest_port = 0;
|
||||
reg [15:0] s_udp_length = 0;
|
||||
reg [15:0] s_udp_checksum = 0;
|
||||
reg [DATA_WIDTH-1:0] s_udp_payload_axis_tdata = 0;
|
||||
reg [KEEP_WIDTH-1:0] s_udp_payload_axis_tkeep = 0;
|
||||
reg s_udp_payload_axis_tvalid = 0;
|
||||
reg s_udp_payload_axis_tlast = 0;
|
||||
reg [ID_WIDTH-1:0] s_udp_payload_axis_tid = 0;
|
||||
reg [DEST_WIDTH-1:0] s_udp_payload_axis_tdest = 0;
|
||||
reg [USER_WIDTH-1:0] s_udp_payload_axis_tuser = 0;
|
||||
|
||||
reg output_0_udp_hdr_ready = 0;
|
||||
reg output_0_udp_payload_tready = 0;
|
||||
reg output_1_udp_hdr_ready = 0;
|
||||
reg output_1_udp_payload_tready = 0;
|
||||
reg output_2_udp_hdr_ready = 0;
|
||||
reg output_2_udp_payload_tready = 0;
|
||||
reg output_3_udp_hdr_ready = 0;
|
||||
reg output_3_udp_payload_tready = 0;
|
||||
reg [M_COUNT-1:0] m_udp_hdr_ready = 0;
|
||||
reg [M_COUNT-1:0] m_udp_payload_axis_tready = 0;
|
||||
|
||||
reg enable = 0;
|
||||
reg drop = 0;
|
||||
reg [1:0] select = 0;
|
||||
|
||||
// Outputs
|
||||
wire input_udp_hdr_ready;
|
||||
wire input_udp_payload_tready;
|
||||
wire s_udp_hdr_ready;
|
||||
wire s_udp_payload_axis_tready;
|
||||
|
||||
wire output_0_udp_hdr_valid;
|
||||
wire [47:0] output_0_eth_dest_mac;
|
||||
wire [47:0] output_0_eth_src_mac;
|
||||
wire [15:0] output_0_eth_type;
|
||||
wire [3:0] output_0_ip_version;
|
||||
wire [3:0] output_0_ip_ihl;
|
||||
wire [5:0] output_0_ip_dscp;
|
||||
wire [1:0] output_0_ip_ecn;
|
||||
wire [15:0] output_0_ip_length;
|
||||
wire [15:0] output_0_ip_identification;
|
||||
wire [2:0] output_0_ip_flags;
|
||||
wire [12:0] output_0_ip_fragment_offset;
|
||||
wire [7:0] output_0_ip_ttl;
|
||||
wire [7:0] output_0_ip_protocol;
|
||||
wire [15:0] output_0_ip_header_checksum;
|
||||
wire [31:0] output_0_ip_source_ip;
|
||||
wire [31:0] output_0_ip_dest_ip;
|
||||
wire [15:0] output_0_udp_source_port;
|
||||
wire [15:0] output_0_udp_dest_port;
|
||||
wire [15:0] output_0_udp_length;
|
||||
wire [15:0] output_0_udp_checksum;
|
||||
wire [7:0] output_0_udp_payload_tdata;
|
||||
wire output_0_udp_payload_tvalid;
|
||||
wire output_0_udp_payload_tlast;
|
||||
wire output_0_udp_payload_tuser;
|
||||
wire output_1_udp_hdr_valid;
|
||||
wire [47:0] output_1_eth_dest_mac;
|
||||
wire [47:0] output_1_eth_src_mac;
|
||||
wire [15:0] output_1_eth_type;
|
||||
wire [3:0] output_1_ip_version;
|
||||
wire [3:0] output_1_ip_ihl;
|
||||
wire [5:0] output_1_ip_dscp;
|
||||
wire [1:0] output_1_ip_ecn;
|
||||
wire [15:0] output_1_ip_length;
|
||||
wire [15:0] output_1_ip_identification;
|
||||
wire [2:0] output_1_ip_flags;
|
||||
wire [12:0] output_1_ip_fragment_offset;
|
||||
wire [7:0] output_1_ip_ttl;
|
||||
wire [7:0] output_1_ip_protocol;
|
||||
wire [15:0] output_1_ip_header_checksum;
|
||||
wire [31:0] output_1_ip_source_ip;
|
||||
wire [31:0] output_1_ip_dest_ip;
|
||||
wire [15:0] output_1_udp_source_port;
|
||||
wire [15:0] output_1_udp_dest_port;
|
||||
wire [15:0] output_1_udp_length;
|
||||
wire [15:0] output_1_udp_checksum;
|
||||
wire [7:0] output_1_udp_payload_tdata;
|
||||
wire output_1_udp_payload_tvalid;
|
||||
wire output_1_udp_payload_tlast;
|
||||
wire output_1_udp_payload_tuser;
|
||||
wire output_2_udp_hdr_valid;
|
||||
wire [47:0] output_2_eth_dest_mac;
|
||||
wire [47:0] output_2_eth_src_mac;
|
||||
wire [15:0] output_2_eth_type;
|
||||
wire [3:0] output_2_ip_version;
|
||||
wire [3:0] output_2_ip_ihl;
|
||||
wire [5:0] output_2_ip_dscp;
|
||||
wire [1:0] output_2_ip_ecn;
|
||||
wire [15:0] output_2_ip_length;
|
||||
wire [15:0] output_2_ip_identification;
|
||||
wire [2:0] output_2_ip_flags;
|
||||
wire [12:0] output_2_ip_fragment_offset;
|
||||
wire [7:0] output_2_ip_ttl;
|
||||
wire [7:0] output_2_ip_protocol;
|
||||
wire [15:0] output_2_ip_header_checksum;
|
||||
wire [31:0] output_2_ip_source_ip;
|
||||
wire [31:0] output_2_ip_dest_ip;
|
||||
wire [15:0] output_2_udp_source_port;
|
||||
wire [15:0] output_2_udp_dest_port;
|
||||
wire [15:0] output_2_udp_length;
|
||||
wire [15:0] output_2_udp_checksum;
|
||||
wire [7:0] output_2_udp_payload_tdata;
|
||||
wire output_2_udp_payload_tvalid;
|
||||
wire output_2_udp_payload_tlast;
|
||||
wire output_2_udp_payload_tuser;
|
||||
wire output_3_udp_hdr_valid;
|
||||
wire [47:0] output_3_eth_dest_mac;
|
||||
wire [47:0] output_3_eth_src_mac;
|
||||
wire [15:0] output_3_eth_type;
|
||||
wire [3:0] output_3_ip_version;
|
||||
wire [3:0] output_3_ip_ihl;
|
||||
wire [5:0] output_3_ip_dscp;
|
||||
wire [1:0] output_3_ip_ecn;
|
||||
wire [15:0] output_3_ip_length;
|
||||
wire [15:0] output_3_ip_identification;
|
||||
wire [2:0] output_3_ip_flags;
|
||||
wire [12:0] output_3_ip_fragment_offset;
|
||||
wire [7:0] output_3_ip_ttl;
|
||||
wire [7:0] output_3_ip_protocol;
|
||||
wire [15:0] output_3_ip_header_checksum;
|
||||
wire [31:0] output_3_ip_source_ip;
|
||||
wire [31:0] output_3_ip_dest_ip;
|
||||
wire [15:0] output_3_udp_source_port;
|
||||
wire [15:0] output_3_udp_dest_port;
|
||||
wire [15:0] output_3_udp_length;
|
||||
wire [15:0] output_3_udp_checksum;
|
||||
wire [7:0] output_3_udp_payload_tdata;
|
||||
wire output_3_udp_payload_tvalid;
|
||||
wire output_3_udp_payload_tlast;
|
||||
wire output_3_udp_payload_tuser;
|
||||
wire [M_COUNT-1:0] m_udp_hdr_valid;
|
||||
wire [M_COUNT*48-1:0] m_eth_dest_mac;
|
||||
wire [M_COUNT*48-1:0] m_eth_src_mac;
|
||||
wire [M_COUNT*16-1:0] m_eth_type;
|
||||
wire [M_COUNT*4-1:0] m_ip_version;
|
||||
wire [M_COUNT*4-1:0] m_ip_ihl;
|
||||
wire [M_COUNT*6-1:0] m_ip_dscp;
|
||||
wire [M_COUNT*2-1:0] m_ip_ecn;
|
||||
wire [M_COUNT*16-1:0] m_ip_length;
|
||||
wire [M_COUNT*16-1:0] m_ip_identification;
|
||||
wire [M_COUNT*3-1:0] m_ip_flags;
|
||||
wire [M_COUNT*13-1:0] m_ip_fragment_offset;
|
||||
wire [M_COUNT*8-1:0] m_ip_ttl;
|
||||
wire [M_COUNT*8-1:0] m_ip_protocol;
|
||||
wire [M_COUNT*16-1:0] m_ip_header_checksum;
|
||||
wire [M_COUNT*32-1:0] m_ip_source_ip;
|
||||
wire [M_COUNT*32-1:0] m_ip_dest_ip;
|
||||
wire [M_COUNT*16-1:0] m_udp_source_port;
|
||||
wire [M_COUNT*16-1:0] m_udp_dest_port;
|
||||
wire [M_COUNT*16-1:0] m_udp_length;
|
||||
wire [M_COUNT*16-1:0] m_udp_checksum;
|
||||
wire [M_COUNT*DATA_WIDTH-1:0] m_udp_payload_axis_tdata;
|
||||
wire [M_COUNT*KEEP_WIDTH-1:0] m_udp_payload_axis_tkeep;
|
||||
wire [M_COUNT-1:0] m_udp_payload_axis_tvalid;
|
||||
wire [M_COUNT-1:0] m_udp_payload_axis_tlast;
|
||||
wire [M_COUNT*ID_WIDTH-1:0] m_udp_payload_axis_tid;
|
||||
wire [M_COUNT*DEST_WIDTH-1:0] m_udp_payload_axis_tdest;
|
||||
wire [M_COUNT*USER_WIDTH-1:0] m_udp_payload_axis_tuser;
|
||||
|
||||
initial begin
|
||||
// myhdl integration
|
||||
@ -185,145 +123,71 @@ initial begin
|
||||
clk,
|
||||
rst,
|
||||
current_test,
|
||||
input_udp_hdr_valid,
|
||||
input_eth_dest_mac,
|
||||
input_eth_src_mac,
|
||||
input_eth_type,
|
||||
input_ip_version,
|
||||
input_ip_ihl,
|
||||
input_ip_dscp,
|
||||
input_ip_ecn,
|
||||
input_ip_length,
|
||||
input_ip_identification,
|
||||
input_ip_flags,
|
||||
input_ip_fragment_offset,
|
||||
input_ip_ttl,
|
||||
input_ip_protocol,
|
||||
input_ip_header_checksum,
|
||||
input_ip_source_ip,
|
||||
input_ip_dest_ip,
|
||||
input_udp_source_port,
|
||||
input_udp_dest_port,
|
||||
input_udp_length,
|
||||
input_udp_checksum,
|
||||
input_udp_payload_tdata,
|
||||
input_udp_payload_tvalid,
|
||||
input_udp_payload_tlast,
|
||||
input_udp_payload_tuser,
|
||||
output_0_udp_hdr_ready,
|
||||
output_0_udp_payload_tready,
|
||||
output_1_udp_hdr_ready,
|
||||
output_1_udp_payload_tready,
|
||||
output_2_udp_hdr_ready,
|
||||
output_2_udp_payload_tready,
|
||||
output_3_udp_hdr_ready,
|
||||
output_3_udp_payload_tready,
|
||||
s_udp_hdr_valid,
|
||||
s_eth_dest_mac,
|
||||
s_eth_src_mac,
|
||||
s_eth_type,
|
||||
s_ip_version,
|
||||
s_ip_ihl,
|
||||
s_ip_dscp,
|
||||
s_ip_ecn,
|
||||
s_ip_length,
|
||||
s_ip_identification,
|
||||
s_ip_flags,
|
||||
s_ip_fragment_offset,
|
||||
s_ip_ttl,
|
||||
s_ip_protocol,
|
||||
s_ip_header_checksum,
|
||||
s_ip_source_ip,
|
||||
s_ip_dest_ip,
|
||||
s_udp_source_port,
|
||||
s_udp_dest_port,
|
||||
s_udp_length,
|
||||
s_udp_checksum,
|
||||
s_udp_payload_axis_tdata,
|
||||
s_udp_payload_axis_tkeep,
|
||||
s_udp_payload_axis_tvalid,
|
||||
s_udp_payload_axis_tlast,
|
||||
s_udp_payload_axis_tid,
|
||||
s_udp_payload_axis_tdest,
|
||||
s_udp_payload_axis_tuser,
|
||||
m_udp_hdr_ready,
|
||||
m_udp_payload_axis_tready,
|
||||
enable,
|
||||
drop,
|
||||
select
|
||||
);
|
||||
$to_myhdl(
|
||||
input_udp_hdr_ready,
|
||||
input_udp_payload_tready,
|
||||
output_0_udp_hdr_valid,
|
||||
output_0_eth_dest_mac,
|
||||
output_0_eth_src_mac,
|
||||
output_0_eth_type,
|
||||
output_0_ip_version,
|
||||
output_0_ip_ihl,
|
||||
output_0_ip_dscp,
|
||||
output_0_ip_ecn,
|
||||
output_0_ip_length,
|
||||
output_0_ip_identification,
|
||||
output_0_ip_flags,
|
||||
output_0_ip_fragment_offset,
|
||||
output_0_ip_ttl,
|
||||
output_0_ip_protocol,
|
||||
output_0_ip_header_checksum,
|
||||
output_0_ip_source_ip,
|
||||
output_0_ip_dest_ip,
|
||||
output_0_udp_source_port,
|
||||
output_0_udp_dest_port,
|
||||
output_0_udp_length,
|
||||
output_0_udp_checksum,
|
||||
output_0_udp_payload_tdata,
|
||||
output_0_udp_payload_tvalid,
|
||||
output_0_udp_payload_tlast,
|
||||
output_0_udp_payload_tuser,
|
||||
output_1_udp_hdr_valid,
|
||||
output_1_eth_dest_mac,
|
||||
output_1_eth_src_mac,
|
||||
output_1_eth_type,
|
||||
output_1_ip_version,
|
||||
output_1_ip_ihl,
|
||||
output_1_ip_dscp,
|
||||
output_1_ip_ecn,
|
||||
output_1_ip_length,
|
||||
output_1_ip_identification,
|
||||
output_1_ip_flags,
|
||||
output_1_ip_fragment_offset,
|
||||
output_1_ip_ttl,
|
||||
output_1_ip_protocol,
|
||||
output_1_ip_header_checksum,
|
||||
output_1_ip_source_ip,
|
||||
output_1_ip_dest_ip,
|
||||
output_1_udp_source_port,
|
||||
output_1_udp_dest_port,
|
||||
output_1_udp_length,
|
||||
output_1_udp_checksum,
|
||||
output_1_udp_payload_tdata,
|
||||
output_1_udp_payload_tvalid,
|
||||
output_1_udp_payload_tlast,
|
||||
output_1_udp_payload_tuser,
|
||||
output_2_udp_hdr_valid,
|
||||
output_2_eth_dest_mac,
|
||||
output_2_eth_src_mac,
|
||||
output_2_eth_type,
|
||||
output_2_ip_version,
|
||||
output_2_ip_ihl,
|
||||
output_2_ip_dscp,
|
||||
output_2_ip_ecn,
|
||||
output_2_ip_length,
|
||||
output_2_ip_identification,
|
||||
output_2_ip_flags,
|
||||
output_2_ip_fragment_offset,
|
||||
output_2_ip_ttl,
|
||||
output_2_ip_protocol,
|
||||
output_2_ip_header_checksum,
|
||||
output_2_ip_source_ip,
|
||||
output_2_ip_dest_ip,
|
||||
output_2_udp_source_port,
|
||||
output_2_udp_dest_port,
|
||||
output_2_udp_length,
|
||||
output_2_udp_checksum,
|
||||
output_2_udp_payload_tdata,
|
||||
output_2_udp_payload_tvalid,
|
||||
output_2_udp_payload_tlast,
|
||||
output_2_udp_payload_tuser,
|
||||
output_3_udp_hdr_valid,
|
||||
output_3_eth_dest_mac,
|
||||
output_3_eth_src_mac,
|
||||
output_3_eth_type,
|
||||
output_3_ip_version,
|
||||
output_3_ip_ihl,
|
||||
output_3_ip_dscp,
|
||||
output_3_ip_ecn,
|
||||
output_3_ip_length,
|
||||
output_3_ip_identification,
|
||||
output_3_ip_flags,
|
||||
output_3_ip_fragment_offset,
|
||||
output_3_ip_ttl,
|
||||
output_3_ip_protocol,
|
||||
output_3_ip_header_checksum,
|
||||
output_3_ip_source_ip,
|
||||
output_3_ip_dest_ip,
|
||||
output_3_udp_source_port,
|
||||
output_3_udp_dest_port,
|
||||
output_3_udp_length,
|
||||
output_3_udp_checksum,
|
||||
output_3_udp_payload_tdata,
|
||||
output_3_udp_payload_tvalid,
|
||||
output_3_udp_payload_tlast,
|
||||
output_3_udp_payload_tuser
|
||||
s_udp_hdr_ready,
|
||||
s_udp_payload_axis_tready,
|
||||
m_udp_hdr_valid,
|
||||
m_eth_dest_mac,
|
||||
m_eth_src_mac,
|
||||
m_eth_type,
|
||||
m_ip_version,
|
||||
m_ip_ihl,
|
||||
m_ip_dscp,
|
||||
m_ip_ecn,
|
||||
m_ip_length,
|
||||
m_ip_identification,
|
||||
m_ip_flags,
|
||||
m_ip_fragment_offset,
|
||||
m_ip_ttl,
|
||||
m_ip_protocol,
|
||||
m_ip_header_checksum,
|
||||
m_ip_source_ip,
|
||||
m_ip_dest_ip,
|
||||
m_udp_source_port,
|
||||
m_udp_dest_port,
|
||||
m_udp_length,
|
||||
m_udp_checksum,
|
||||
m_udp_payload_axis_tdata,
|
||||
m_udp_payload_axis_tkeep,
|
||||
m_udp_payload_axis_tvalid,
|
||||
m_udp_payload_axis_tlast,
|
||||
m_udp_payload_axis_tid,
|
||||
m_udp_payload_axis_tdest,
|
||||
m_udp_payload_axis_tuser
|
||||
);
|
||||
|
||||
// dump file
|
||||
@ -331,149 +195,86 @@ initial begin
|
||||
$dumpvars(0, test_udp_demux_4);
|
||||
end
|
||||
|
||||
udp_demux_4
|
||||
udp_demux #(
|
||||
.M_COUNT(M_COUNT),
|
||||
.DATA_WIDTH(DATA_WIDTH),
|
||||
.KEEP_ENABLE(KEEP_ENABLE),
|
||||
.KEEP_WIDTH(KEEP_WIDTH),
|
||||
.ID_ENABLE(ID_ENABLE),
|
||||
.ID_WIDTH(ID_WIDTH),
|
||||
.DEST_ENABLE(DEST_ENABLE),
|
||||
.DEST_WIDTH(DEST_WIDTH),
|
||||
.USER_ENABLE(USER_ENABLE),
|
||||
.USER_WIDTH(USER_WIDTH)
|
||||
)
|
||||
UUT (
|
||||
.clk(clk),
|
||||
.rst(rst),
|
||||
// UDP frame input
|
||||
.input_udp_hdr_valid(input_udp_hdr_valid),
|
||||
.input_udp_hdr_ready(input_udp_hdr_ready),
|
||||
.input_eth_dest_mac(input_eth_dest_mac),
|
||||
.input_eth_src_mac(input_eth_src_mac),
|
||||
.input_eth_type(input_eth_type),
|
||||
.input_ip_version(input_ip_version),
|
||||
.input_ip_ihl(input_ip_ihl),
|
||||
.input_ip_dscp(input_ip_dscp),
|
||||
.input_ip_ecn(input_ip_ecn),
|
||||
.input_ip_length(input_ip_length),
|
||||
.input_ip_identification(input_ip_identification),
|
||||
.input_ip_flags(input_ip_flags),
|
||||
.input_ip_fragment_offset(input_ip_fragment_offset),
|
||||
.input_ip_ttl(input_ip_ttl),
|
||||
.input_ip_protocol(input_ip_protocol),
|
||||
.input_ip_header_checksum(input_ip_header_checksum),
|
||||
.input_ip_source_ip(input_ip_source_ip),
|
||||
.input_ip_dest_ip(input_ip_dest_ip),
|
||||
.input_udp_source_port(input_udp_source_port),
|
||||
.input_udp_dest_port(input_udp_dest_port),
|
||||
.input_udp_length(input_udp_length),
|
||||
.input_udp_checksum(input_udp_checksum),
|
||||
.input_udp_payload_tdata(input_udp_payload_tdata),
|
||||
.input_udp_payload_tvalid(input_udp_payload_tvalid),
|
||||
.input_udp_payload_tready(input_udp_payload_tready),
|
||||
.input_udp_payload_tlast(input_udp_payload_tlast),
|
||||
.input_udp_payload_tuser(input_udp_payload_tuser),
|
||||
.s_udp_hdr_valid(s_udp_hdr_valid),
|
||||
.s_udp_hdr_ready(s_udp_hdr_ready),
|
||||
.s_eth_dest_mac(s_eth_dest_mac),
|
||||
.s_eth_src_mac(s_eth_src_mac),
|
||||
.s_eth_type(s_eth_type),
|
||||
.s_ip_version(s_ip_version),
|
||||
.s_ip_ihl(s_ip_ihl),
|
||||
.s_ip_dscp(s_ip_dscp),
|
||||
.s_ip_ecn(s_ip_ecn),
|
||||
.s_ip_length(s_ip_length),
|
||||
.s_ip_identification(s_ip_identification),
|
||||
.s_ip_flags(s_ip_flags),
|
||||
.s_ip_fragment_offset(s_ip_fragment_offset),
|
||||
.s_ip_ttl(s_ip_ttl),
|
||||
.s_ip_protocol(s_ip_protocol),
|
||||
.s_ip_header_checksum(s_ip_header_checksum),
|
||||
.s_ip_source_ip(s_ip_source_ip),
|
||||
.s_ip_dest_ip(s_ip_dest_ip),
|
||||
.s_udp_source_port(s_udp_source_port),
|
||||
.s_udp_dest_port(s_udp_dest_port),
|
||||
.s_udp_length(s_udp_length),
|
||||
.s_udp_checksum(s_udp_checksum),
|
||||
.s_udp_payload_axis_tdata(s_udp_payload_axis_tdata),
|
||||
.s_udp_payload_axis_tkeep(s_udp_payload_axis_tkeep),
|
||||
.s_udp_payload_axis_tvalid(s_udp_payload_axis_tvalid),
|
||||
.s_udp_payload_axis_tready(s_udp_payload_axis_tready),
|
||||
.s_udp_payload_axis_tlast(s_udp_payload_axis_tlast),
|
||||
.s_udp_payload_axis_tid(s_udp_payload_axis_tid),
|
||||
.s_udp_payload_axis_tdest(s_udp_payload_axis_tdest),
|
||||
.s_udp_payload_axis_tuser(s_udp_payload_axis_tuser),
|
||||
// UDP frame outputs
|
||||
.output_0_udp_hdr_valid(output_0_udp_hdr_valid),
|
||||
.output_0_udp_hdr_ready(output_0_udp_hdr_ready),
|
||||
.output_0_eth_dest_mac(output_0_eth_dest_mac),
|
||||
.output_0_eth_src_mac(output_0_eth_src_mac),
|
||||
.output_0_eth_type(output_0_eth_type),
|
||||
.output_0_ip_version(output_0_ip_version),
|
||||
.output_0_ip_ihl(output_0_ip_ihl),
|
||||
.output_0_ip_dscp(output_0_ip_dscp),
|
||||
.output_0_ip_ecn(output_0_ip_ecn),
|
||||
.output_0_ip_length(output_0_ip_length),
|
||||
.output_0_ip_identification(output_0_ip_identification),
|
||||
.output_0_ip_flags(output_0_ip_flags),
|
||||
.output_0_ip_fragment_offset(output_0_ip_fragment_offset),
|
||||
.output_0_ip_ttl(output_0_ip_ttl),
|
||||
.output_0_ip_protocol(output_0_ip_protocol),
|
||||
.output_0_ip_header_checksum(output_0_ip_header_checksum),
|
||||
.output_0_ip_source_ip(output_0_ip_source_ip),
|
||||
.output_0_ip_dest_ip(output_0_ip_dest_ip),
|
||||
.output_0_udp_source_port(output_0_udp_source_port),
|
||||
.output_0_udp_dest_port(output_0_udp_dest_port),
|
||||
.output_0_udp_length(output_0_udp_length),
|
||||
.output_0_udp_checksum(output_0_udp_checksum),
|
||||
.output_0_udp_payload_tdata(output_0_udp_payload_tdata),
|
||||
.output_0_udp_payload_tvalid(output_0_udp_payload_tvalid),
|
||||
.output_0_udp_payload_tready(output_0_udp_payload_tready),
|
||||
.output_0_udp_payload_tlast(output_0_udp_payload_tlast),
|
||||
.output_0_udp_payload_tuser(output_0_udp_payload_tuser),
|
||||
.output_1_udp_hdr_valid(output_1_udp_hdr_valid),
|
||||
.output_1_udp_hdr_ready(output_1_udp_hdr_ready),
|
||||
.output_1_eth_dest_mac(output_1_eth_dest_mac),
|
||||
.output_1_eth_src_mac(output_1_eth_src_mac),
|
||||
.output_1_eth_type(output_1_eth_type),
|
||||
.output_1_ip_version(output_1_ip_version),
|
||||
.output_1_ip_ihl(output_1_ip_ihl),
|
||||
.output_1_ip_dscp(output_1_ip_dscp),
|
||||
.output_1_ip_ecn(output_1_ip_ecn),
|
||||
.output_1_ip_length(output_1_ip_length),
|
||||
.output_1_ip_identification(output_1_ip_identification),
|
||||
.output_1_ip_flags(output_1_ip_flags),
|
||||
.output_1_ip_fragment_offset(output_1_ip_fragment_offset),
|
||||
.output_1_ip_ttl(output_1_ip_ttl),
|
||||
.output_1_ip_protocol(output_1_ip_protocol),
|
||||
.output_1_ip_header_checksum(output_1_ip_header_checksum),
|
||||
.output_1_ip_source_ip(output_1_ip_source_ip),
|
||||
.output_1_ip_dest_ip(output_1_ip_dest_ip),
|
||||
.output_1_udp_source_port(output_1_udp_source_port),
|
||||
.output_1_udp_dest_port(output_1_udp_dest_port),
|
||||
.output_1_udp_length(output_1_udp_length),
|
||||
.output_1_udp_checksum(output_1_udp_checksum),
|
||||
.output_1_udp_payload_tdata(output_1_udp_payload_tdata),
|
||||
.output_1_udp_payload_tvalid(output_1_udp_payload_tvalid),
|
||||
.output_1_udp_payload_tready(output_1_udp_payload_tready),
|
||||
.output_1_udp_payload_tlast(output_1_udp_payload_tlast),
|
||||
.output_1_udp_payload_tuser(output_1_udp_payload_tuser),
|
||||
.output_2_udp_hdr_valid(output_2_udp_hdr_valid),
|
||||
.output_2_udp_hdr_ready(output_2_udp_hdr_ready),
|
||||
.output_2_eth_dest_mac(output_2_eth_dest_mac),
|
||||
.output_2_eth_src_mac(output_2_eth_src_mac),
|
||||
.output_2_eth_type(output_2_eth_type),
|
||||
.output_2_ip_version(output_2_ip_version),
|
||||
.output_2_ip_ihl(output_2_ip_ihl),
|
||||
.output_2_ip_dscp(output_2_ip_dscp),
|
||||
.output_2_ip_ecn(output_2_ip_ecn),
|
||||
.output_2_ip_length(output_2_ip_length),
|
||||
.output_2_ip_identification(output_2_ip_identification),
|
||||
.output_2_ip_flags(output_2_ip_flags),
|
||||
.output_2_ip_fragment_offset(output_2_ip_fragment_offset),
|
||||
.output_2_ip_ttl(output_2_ip_ttl),
|
||||
.output_2_ip_protocol(output_2_ip_protocol),
|
||||
.output_2_ip_header_checksum(output_2_ip_header_checksum),
|
||||
.output_2_ip_source_ip(output_2_ip_source_ip),
|
||||
.output_2_ip_dest_ip(output_2_ip_dest_ip),
|
||||
.output_2_udp_source_port(output_2_udp_source_port),
|
||||
.output_2_udp_dest_port(output_2_udp_dest_port),
|
||||
.output_2_udp_length(output_2_udp_length),
|
||||
.output_2_udp_checksum(output_2_udp_checksum),
|
||||
.output_2_udp_payload_tdata(output_2_udp_payload_tdata),
|
||||
.output_2_udp_payload_tvalid(output_2_udp_payload_tvalid),
|
||||
.output_2_udp_payload_tready(output_2_udp_payload_tready),
|
||||
.output_2_udp_payload_tlast(output_2_udp_payload_tlast),
|
||||
.output_2_udp_payload_tuser(output_2_udp_payload_tuser),
|
||||
.output_3_udp_hdr_valid(output_3_udp_hdr_valid),
|
||||
.output_3_udp_hdr_ready(output_3_udp_hdr_ready),
|
||||
.output_3_eth_dest_mac(output_3_eth_dest_mac),
|
||||
.output_3_eth_src_mac(output_3_eth_src_mac),
|
||||
.output_3_eth_type(output_3_eth_type),
|
||||
.output_3_ip_version(output_3_ip_version),
|
||||
.output_3_ip_ihl(output_3_ip_ihl),
|
||||
.output_3_ip_dscp(output_3_ip_dscp),
|
||||
.output_3_ip_ecn(output_3_ip_ecn),
|
||||
.output_3_ip_length(output_3_ip_length),
|
||||
.output_3_ip_identification(output_3_ip_identification),
|
||||
.output_3_ip_flags(output_3_ip_flags),
|
||||
.output_3_ip_fragment_offset(output_3_ip_fragment_offset),
|
||||
.output_3_ip_ttl(output_3_ip_ttl),
|
||||
.output_3_ip_protocol(output_3_ip_protocol),
|
||||
.output_3_ip_header_checksum(output_3_ip_header_checksum),
|
||||
.output_3_ip_source_ip(output_3_ip_source_ip),
|
||||
.output_3_ip_dest_ip(output_3_ip_dest_ip),
|
||||
.output_3_udp_source_port(output_3_udp_source_port),
|
||||
.output_3_udp_dest_port(output_3_udp_dest_port),
|
||||
.output_3_udp_length(output_3_udp_length),
|
||||
.output_3_udp_checksum(output_3_udp_checksum),
|
||||
.output_3_udp_payload_tdata(output_3_udp_payload_tdata),
|
||||
.output_3_udp_payload_tvalid(output_3_udp_payload_tvalid),
|
||||
.output_3_udp_payload_tready(output_3_udp_payload_tready),
|
||||
.output_3_udp_payload_tlast(output_3_udp_payload_tlast),
|
||||
.output_3_udp_payload_tuser(output_3_udp_payload_tuser),
|
||||
.m_udp_hdr_valid(m_udp_hdr_valid),
|
||||
.m_udp_hdr_ready(m_udp_hdr_ready),
|
||||
.m_eth_dest_mac(m_eth_dest_mac),
|
||||
.m_eth_src_mac(m_eth_src_mac),
|
||||
.m_eth_type(m_eth_type),
|
||||
.m_ip_version(m_ip_version),
|
||||
.m_ip_ihl(m_ip_ihl),
|
||||
.m_ip_dscp(m_ip_dscp),
|
||||
.m_ip_ecn(m_ip_ecn),
|
||||
.m_ip_length(m_ip_length),
|
||||
.m_ip_identification(m_ip_identification),
|
||||
.m_ip_flags(m_ip_flags),
|
||||
.m_ip_fragment_offset(m_ip_fragment_offset),
|
||||
.m_ip_ttl(m_ip_ttl),
|
||||
.m_ip_protocol(m_ip_protocol),
|
||||
.m_ip_header_checksum(m_ip_header_checksum),
|
||||
.m_ip_source_ip(m_ip_source_ip),
|
||||
.m_ip_dest_ip(m_ip_dest_ip),
|
||||
.m_udp_source_port(m_udp_source_port),
|
||||
.m_udp_dest_port(m_udp_dest_port),
|
||||
.m_udp_length(m_udp_length),
|
||||
.m_udp_checksum(m_udp_checksum),
|
||||
.m_udp_payload_axis_tdata(m_udp_payload_axis_tdata),
|
||||
.m_udp_payload_axis_tkeep(m_udp_payload_axis_tkeep),
|
||||
.m_udp_payload_axis_tvalid(m_udp_payload_axis_tvalid),
|
||||
.m_udp_payload_axis_tready(m_udp_payload_axis_tready),
|
||||
.m_udp_payload_axis_tlast(m_udp_payload_axis_tlast),
|
||||
.m_udp_payload_axis_tid(m_udp_payload_axis_tid),
|
||||
.m_udp_payload_axis_tdest(m_udp_payload_axis_tdest),
|
||||
.m_udp_payload_axis_tuser(m_udp_payload_axis_tuser),
|
||||
// Control
|
||||
.enable(enable),
|
||||
.drop(drop),
|
||||
.select(select)
|
||||
);
|
||||
|
||||
|
@ -28,8 +28,8 @@ import os
|
||||
|
||||
import udp_ep
|
||||
|
||||
module = 'udp_demux_64_4'
|
||||
testbench = 'test_%s' % module
|
||||
module = 'udp_demux'
|
||||
testbench = 'test_%s_64_4' % module
|
||||
|
||||
srcs = []
|
||||
|
||||
@ -42,350 +42,208 @@ build_cmd = "iverilog -o %s.vvp %s" % (testbench, src)
|
||||
|
||||
def bench():
|
||||
|
||||
# Parameters
|
||||
M_COUNT = 4
|
||||
DATA_WIDTH = 64
|
||||
KEEP_ENABLE = (DATA_WIDTH>8)
|
||||
KEEP_WIDTH = (DATA_WIDTH/8)
|
||||
ID_ENABLE = 1
|
||||
ID_WIDTH = 8
|
||||
DEST_ENABLE = 1
|
||||
DEST_WIDTH = 8
|
||||
USER_ENABLE = 1
|
||||
USER_WIDTH = 1
|
||||
|
||||
# Inputs
|
||||
clk = Signal(bool(0))
|
||||
rst = Signal(bool(0))
|
||||
current_test = Signal(intbv(0)[8:])
|
||||
|
||||
input_udp_hdr_valid = Signal(bool(0))
|
||||
input_eth_dest_mac = Signal(intbv(0)[48:])
|
||||
input_eth_src_mac = Signal(intbv(0)[48:])
|
||||
input_eth_type = Signal(intbv(0)[16:])
|
||||
input_ip_version = Signal(intbv(0)[4:])
|
||||
input_ip_ihl = Signal(intbv(0)[4:])
|
||||
input_ip_dscp = Signal(intbv(0)[6:])
|
||||
input_ip_ecn = Signal(intbv(0)[2:])
|
||||
input_ip_length = Signal(intbv(0)[16:])
|
||||
input_ip_identification = Signal(intbv(0)[16:])
|
||||
input_ip_flags = Signal(intbv(0)[3:])
|
||||
input_ip_fragment_offset = Signal(intbv(0)[13:])
|
||||
input_ip_ttl = Signal(intbv(0)[8:])
|
||||
input_ip_protocol = Signal(intbv(0)[8:])
|
||||
input_ip_header_checksum = Signal(intbv(0)[16:])
|
||||
input_ip_source_ip = Signal(intbv(0)[32:])
|
||||
input_ip_dest_ip = Signal(intbv(0)[32:])
|
||||
input_udp_source_port = Signal(intbv(0)[16:])
|
||||
input_udp_dest_port = Signal(intbv(0)[16:])
|
||||
input_udp_length = Signal(intbv(0)[16:])
|
||||
input_udp_checksum = Signal(intbv(0)[16:])
|
||||
input_udp_payload_tdata = Signal(intbv(0)[64:])
|
||||
input_udp_payload_tkeep = Signal(intbv(0)[8:])
|
||||
input_udp_payload_tvalid = Signal(bool(0))
|
||||
input_udp_payload_tlast = Signal(bool(0))
|
||||
input_udp_payload_tuser = Signal(bool(0))
|
||||
s_udp_hdr_valid = Signal(bool(0))
|
||||
s_eth_dest_mac = Signal(intbv(0)[48:])
|
||||
s_eth_src_mac = Signal(intbv(0)[48:])
|
||||
s_eth_type = Signal(intbv(0)[16:])
|
||||
s_ip_version = Signal(intbv(0)[4:])
|
||||
s_ip_ihl = Signal(intbv(0)[4:])
|
||||
s_ip_dscp = Signal(intbv(0)[6:])
|
||||
s_ip_ecn = Signal(intbv(0)[2:])
|
||||
s_ip_length = Signal(intbv(0)[16:])
|
||||
s_ip_identification = Signal(intbv(0)[16:])
|
||||
s_ip_flags = Signal(intbv(0)[3:])
|
||||
s_ip_fragment_offset = Signal(intbv(0)[13:])
|
||||
s_ip_ttl = Signal(intbv(0)[8:])
|
||||
s_ip_protocol = Signal(intbv(0)[8:])
|
||||
s_ip_header_checksum = Signal(intbv(0)[16:])
|
||||
s_ip_source_ip = Signal(intbv(0)[32:])
|
||||
s_ip_dest_ip = Signal(intbv(0)[32:])
|
||||
s_udp_source_port = Signal(intbv(0)[16:])
|
||||
s_udp_dest_port = Signal(intbv(0)[16:])
|
||||
s_udp_length = Signal(intbv(0)[16:])
|
||||
s_udp_checksum = Signal(intbv(0)[16:])
|
||||
s_udp_payload_axis_tdata = Signal(intbv(0)[DATA_WIDTH:])
|
||||
s_udp_payload_axis_tkeep = Signal(intbv(1)[KEEP_WIDTH:])
|
||||
s_udp_payload_axis_tvalid = Signal(bool(0))
|
||||
s_udp_payload_axis_tlast = Signal(bool(0))
|
||||
s_udp_payload_axis_tid = Signal(intbv(0)[ID_WIDTH:])
|
||||
s_udp_payload_axis_tdest = Signal(intbv(0)[DEST_WIDTH:])
|
||||
s_udp_payload_axis_tuser = Signal(intbv(0)[USER_WIDTH:])
|
||||
|
||||
output_0_udp_hdr_ready = Signal(bool(0))
|
||||
output_0_udp_payload_tready = Signal(bool(0))
|
||||
output_1_udp_hdr_ready = Signal(bool(0))
|
||||
output_1_udp_payload_tready = Signal(bool(0))
|
||||
output_2_udp_hdr_ready = Signal(bool(0))
|
||||
output_2_udp_payload_tready = Signal(bool(0))
|
||||
output_3_udp_hdr_ready = Signal(bool(0))
|
||||
output_3_udp_payload_tready = Signal(bool(0))
|
||||
m_udp_hdr_ready_list = [Signal(bool(0)) for i in range(M_COUNT)]
|
||||
m_udp_payload_axis_tready_list = [Signal(bool(0)) for i in range(M_COUNT)]
|
||||
|
||||
m_udp_hdr_ready = ConcatSignal(*reversed(m_udp_hdr_ready_list))
|
||||
m_udp_payload_axis_tready = ConcatSignal(*reversed(m_udp_payload_axis_tready_list))
|
||||
|
||||
enable = Signal(bool(0))
|
||||
drop = Signal(bool(0))
|
||||
select = Signal(intbv(0)[2:])
|
||||
|
||||
# Outputs
|
||||
input_udp_hdr_ready = Signal(bool(0))
|
||||
input_udp_payload_tready = Signal(bool(0))
|
||||
s_udp_hdr_ready = Signal(bool(0))
|
||||
s_udp_payload_axis_tready = Signal(bool(0))
|
||||
|
||||
output_0_udp_hdr_valid = Signal(bool(0))
|
||||
output_0_eth_dest_mac = Signal(intbv(0)[48:])
|
||||
output_0_eth_src_mac = Signal(intbv(0)[48:])
|
||||
output_0_eth_type = Signal(intbv(0)[16:])
|
||||
output_0_ip_version = Signal(intbv(0)[4:])
|
||||
output_0_ip_ihl = Signal(intbv(0)[4:])
|
||||
output_0_ip_dscp = Signal(intbv(0)[6:])
|
||||
output_0_ip_ecn = Signal(intbv(0)[2:])
|
||||
output_0_ip_length = Signal(intbv(0)[16:])
|
||||
output_0_ip_identification = Signal(intbv(0)[16:])
|
||||
output_0_ip_flags = Signal(intbv(0)[3:])
|
||||
output_0_ip_fragment_offset = Signal(intbv(0)[13:])
|
||||
output_0_ip_ttl = Signal(intbv(0)[8:])
|
||||
output_0_ip_protocol = Signal(intbv(0)[8:])
|
||||
output_0_ip_header_checksum = Signal(intbv(0)[16:])
|
||||
output_0_ip_source_ip = Signal(intbv(0)[32:])
|
||||
output_0_ip_dest_ip = Signal(intbv(0)[32:])
|
||||
output_0_udp_source_port = Signal(intbv(0)[16:])
|
||||
output_0_udp_dest_port = Signal(intbv(0)[16:])
|
||||
output_0_udp_length = Signal(intbv(0)[16:])
|
||||
output_0_udp_checksum = Signal(intbv(0)[16:])
|
||||
output_0_udp_payload_tdata = Signal(intbv(0)[64:])
|
||||
output_0_udp_payload_tkeep = Signal(intbv(0)[8:])
|
||||
output_0_udp_payload_tvalid = Signal(bool(0))
|
||||
output_0_udp_payload_tlast = Signal(bool(0))
|
||||
output_0_udp_payload_tuser = Signal(bool(0))
|
||||
output_1_udp_hdr_valid = Signal(bool(0))
|
||||
output_1_eth_dest_mac = Signal(intbv(0)[48:])
|
||||
output_1_eth_src_mac = Signal(intbv(0)[48:])
|
||||
output_1_eth_type = Signal(intbv(0)[16:])
|
||||
output_1_ip_version = Signal(intbv(0)[4:])
|
||||
output_1_ip_ihl = Signal(intbv(0)[4:])
|
||||
output_1_ip_dscp = Signal(intbv(0)[6:])
|
||||
output_1_ip_ecn = Signal(intbv(0)[2:])
|
||||
output_1_ip_length = Signal(intbv(0)[16:])
|
||||
output_1_ip_identification = Signal(intbv(0)[16:])
|
||||
output_1_ip_flags = Signal(intbv(0)[3:])
|
||||
output_1_ip_fragment_offset = Signal(intbv(0)[13:])
|
||||
output_1_ip_ttl = Signal(intbv(0)[8:])
|
||||
output_1_ip_protocol = Signal(intbv(0)[8:])
|
||||
output_1_ip_header_checksum = Signal(intbv(0)[16:])
|
||||
output_1_ip_source_ip = Signal(intbv(0)[32:])
|
||||
output_1_ip_dest_ip = Signal(intbv(0)[32:])
|
||||
output_1_udp_source_port = Signal(intbv(0)[16:])
|
||||
output_1_udp_dest_port = Signal(intbv(0)[16:])
|
||||
output_1_udp_length = Signal(intbv(0)[16:])
|
||||
output_1_udp_checksum = Signal(intbv(0)[16:])
|
||||
output_1_udp_payload_tdata = Signal(intbv(0)[64:])
|
||||
output_1_udp_payload_tkeep = Signal(intbv(0)[8:])
|
||||
output_1_udp_payload_tvalid = Signal(bool(0))
|
||||
output_1_udp_payload_tlast = Signal(bool(0))
|
||||
output_1_udp_payload_tuser = Signal(bool(0))
|
||||
output_2_udp_hdr_valid = Signal(bool(0))
|
||||
output_2_eth_dest_mac = Signal(intbv(0)[48:])
|
||||
output_2_eth_src_mac = Signal(intbv(0)[48:])
|
||||
output_2_eth_type = Signal(intbv(0)[16:])
|
||||
output_2_ip_version = Signal(intbv(0)[4:])
|
||||
output_2_ip_ihl = Signal(intbv(0)[4:])
|
||||
output_2_ip_dscp = Signal(intbv(0)[6:])
|
||||
output_2_ip_ecn = Signal(intbv(0)[2:])
|
||||
output_2_ip_length = Signal(intbv(0)[16:])
|
||||
output_2_ip_identification = Signal(intbv(0)[16:])
|
||||
output_2_ip_flags = Signal(intbv(0)[3:])
|
||||
output_2_ip_fragment_offset = Signal(intbv(0)[13:])
|
||||
output_2_ip_ttl = Signal(intbv(0)[8:])
|
||||
output_2_ip_protocol = Signal(intbv(0)[8:])
|
||||
output_2_ip_header_checksum = Signal(intbv(0)[16:])
|
||||
output_2_ip_source_ip = Signal(intbv(0)[32:])
|
||||
output_2_ip_dest_ip = Signal(intbv(0)[32:])
|
||||
output_2_udp_source_port = Signal(intbv(0)[16:])
|
||||
output_2_udp_dest_port = Signal(intbv(0)[16:])
|
||||
output_2_udp_length = Signal(intbv(0)[16:])
|
||||
output_2_udp_checksum = Signal(intbv(0)[16:])
|
||||
output_2_udp_payload_tdata = Signal(intbv(0)[64:])
|
||||
output_2_udp_payload_tkeep = Signal(intbv(0)[8:])
|
||||
output_2_udp_payload_tvalid = Signal(bool(0))
|
||||
output_2_udp_payload_tlast = Signal(bool(0))
|
||||
output_2_udp_payload_tuser = Signal(bool(0))
|
||||
output_3_udp_hdr_valid = Signal(bool(0))
|
||||
output_3_eth_dest_mac = Signal(intbv(0)[48:])
|
||||
output_3_eth_src_mac = Signal(intbv(0)[48:])
|
||||
output_3_eth_type = Signal(intbv(0)[16:])
|
||||
output_3_ip_version = Signal(intbv(0)[4:])
|
||||
output_3_ip_ihl = Signal(intbv(0)[4:])
|
||||
output_3_ip_dscp = Signal(intbv(0)[6:])
|
||||
output_3_ip_ecn = Signal(intbv(0)[2:])
|
||||
output_3_ip_length = Signal(intbv(0)[16:])
|
||||
output_3_ip_identification = Signal(intbv(0)[16:])
|
||||
output_3_ip_flags = Signal(intbv(0)[3:])
|
||||
output_3_ip_fragment_offset = Signal(intbv(0)[13:])
|
||||
output_3_ip_ttl = Signal(intbv(0)[8:])
|
||||
output_3_ip_protocol = Signal(intbv(0)[8:])
|
||||
output_3_ip_header_checksum = Signal(intbv(0)[16:])
|
||||
output_3_ip_source_ip = Signal(intbv(0)[32:])
|
||||
output_3_ip_dest_ip = Signal(intbv(0)[32:])
|
||||
output_3_udp_source_port = Signal(intbv(0)[16:])
|
||||
output_3_udp_dest_port = Signal(intbv(0)[16:])
|
||||
output_3_udp_length = Signal(intbv(0)[16:])
|
||||
output_3_udp_checksum = Signal(intbv(0)[16:])
|
||||
output_3_udp_payload_tdata = Signal(intbv(0)[64:])
|
||||
output_3_udp_payload_tkeep = Signal(intbv(0)[8:])
|
||||
output_3_udp_payload_tvalid = Signal(bool(0))
|
||||
output_3_udp_payload_tlast = Signal(bool(0))
|
||||
output_3_udp_payload_tuser = Signal(bool(0))
|
||||
m_udp_hdr_valid = Signal(intbv(0)[M_COUNT:])
|
||||
m_eth_dest_mac = Signal(intbv(0)[M_COUNT*48:])
|
||||
m_eth_src_mac = Signal(intbv(0)[M_COUNT*48:])
|
||||
m_eth_type = Signal(intbv(0)[M_COUNT*16:])
|
||||
m_ip_version = Signal(intbv(0)[M_COUNT*4:])
|
||||
m_ip_ihl = Signal(intbv(0)[M_COUNT*4:])
|
||||
m_ip_dscp = Signal(intbv(0)[M_COUNT*6:])
|
||||
m_ip_ecn = Signal(intbv(0)[M_COUNT*2:])
|
||||
m_ip_length = Signal(intbv(0)[M_COUNT*16:])
|
||||
m_ip_identification = Signal(intbv(0)[M_COUNT*16:])
|
||||
m_ip_flags = Signal(intbv(0)[M_COUNT*3:])
|
||||
m_ip_fragment_offset = Signal(intbv(0)[M_COUNT*13:])
|
||||
m_ip_ttl = Signal(intbv(0)[M_COUNT*8:])
|
||||
m_ip_protocol = Signal(intbv(0)[M_COUNT*8:])
|
||||
m_ip_header_checksum = Signal(intbv(0)[M_COUNT*16:])
|
||||
m_ip_source_ip = Signal(intbv(0)[M_COUNT*32:])
|
||||
m_ip_dest_ip = Signal(intbv(0)[M_COUNT*32:])
|
||||
m_udp_source_port = Signal(intbv(0)[M_COUNT*16:])
|
||||
m_udp_dest_port = Signal(intbv(0)[M_COUNT*16:])
|
||||
m_udp_length = Signal(intbv(0)[M_COUNT*16:])
|
||||
m_udp_checksum = Signal(intbv(0)[M_COUNT*16:])
|
||||
m_udp_payload_axis_tdata = Signal(intbv(0)[M_COUNT*DATA_WIDTH:])
|
||||
m_udp_payload_axis_tkeep = Signal(intbv(0xf)[M_COUNT*KEEP_WIDTH:])
|
||||
m_udp_payload_axis_tvalid = Signal(intbv(0)[M_COUNT:])
|
||||
m_udp_payload_axis_tlast = Signal(intbv(0)[M_COUNT:])
|
||||
m_udp_payload_axis_tid = Signal(intbv(0)[M_COUNT*ID_WIDTH:])
|
||||
m_udp_payload_axis_tdest = Signal(intbv(0)[M_COUNT*DEST_WIDTH:])
|
||||
m_udp_payload_axis_tuser = Signal(intbv(0)[M_COUNT*USER_WIDTH:])
|
||||
|
||||
m_udp_hdr_valid_list = [m_udp_hdr_valid(i) for i in range(M_COUNT)]
|
||||
m_eth_dest_mac_list = [m_eth_dest_mac((i+1)*48, i*48) for i in range(M_COUNT)]
|
||||
m_eth_src_mac_list = [m_eth_src_mac((i+1)*48, i*48) for i in range(M_COUNT)]
|
||||
m_eth_type_list = [m_eth_type((i+1)*16, i*16) for i in range(M_COUNT)]
|
||||
m_ip_version_list = [m_ip_version((i+1)*4, i*4) for i in range(M_COUNT)]
|
||||
m_ip_ihl_list = [m_ip_ihl((i+1)*4, i*4) for i in range(M_COUNT)]
|
||||
m_ip_dscp_list = [m_ip_dscp((i+1)*6, i*6) for i in range(M_COUNT)]
|
||||
m_ip_ecn_list = [m_ip_ecn((i+1)*2, i*2) for i in range(M_COUNT)]
|
||||
m_ip_length_list = [m_ip_length((i+1)*16, i*16) for i in range(M_COUNT)]
|
||||
m_ip_identification_list = [m_ip_identification((i+1)*16, i*16) for i in range(M_COUNT)]
|
||||
m_ip_flags_list = [m_ip_flags((i+1)*3, i*3) for i in range(M_COUNT)]
|
||||
m_ip_fragment_offset_list = [m_ip_fragment_offset((i+1)*13, i*13) for i in range(M_COUNT)]
|
||||
m_ip_ttl_list = [m_ip_ttl((i+1)*8, i*8) for i in range(M_COUNT)]
|
||||
m_ip_protocol_list = [m_ip_protocol((i+1)*8, i*8) for i in range(M_COUNT)]
|
||||
m_ip_header_checksum_list = [m_ip_header_checksum((i+1)*16, i*16) for i in range(M_COUNT)]
|
||||
m_ip_source_ip_list = [m_ip_source_ip((i+1)*32, i*32) for i in range(M_COUNT)]
|
||||
m_ip_dest_ip_list = [m_ip_dest_ip((i+1)*32, i*32) for i in range(M_COUNT)]
|
||||
m_udp_source_port_list = [m_udp_source_port((i+1)*16, i*16) for i in range(M_COUNT)]
|
||||
m_udp_dest_port_list = [m_udp_dest_port((i+1)*16, i*16) for i in range(M_COUNT)]
|
||||
m_udp_length_list = [m_udp_length((i+1)*16, i*16) for i in range(M_COUNT)]
|
||||
m_udp_checksum_list = [m_udp_checksum((i+1)*16, i*16) for i in range(M_COUNT)]
|
||||
m_udp_payload_axis_tdata_list = [m_udp_payload_axis_tdata((i+1)*DATA_WIDTH, i*DATA_WIDTH) for i in range(M_COUNT)]
|
||||
m_udp_payload_axis_tkeep_list = [m_udp_payload_axis_tkeep((i+1)*KEEP_WIDTH, i*KEEP_WIDTH) for i in range(M_COUNT)]
|
||||
m_udp_payload_axis_tvalid_list = [m_udp_payload_axis_tvalid(i) for i in range(M_COUNT)]
|
||||
m_udp_payload_axis_tlast_list = [m_udp_payload_axis_tlast(i) for i in range(M_COUNT)]
|
||||
m_udp_payload_axis_tid_list = [m_udp_payload_axis_tid((i+1)*ID_WIDTH, i*ID_WIDTH) for i in range(M_COUNT)]
|
||||
m_udp_payload_axis_tdest_list = [m_udp_payload_axis_tdest((i+1)*DEST_WIDTH, i*DEST_WIDTH) for i in range(M_COUNT)]
|
||||
m_udp_payload_axis_tuser_list = [m_udp_payload_axis_tuser((i+1)*USER_WIDTH, i*USER_WIDTH) for i in range(M_COUNT)]
|
||||
|
||||
# sources and sinks
|
||||
source_pause = Signal(bool(0))
|
||||
sink_0_pause = Signal(bool(0))
|
||||
sink_1_pause = Signal(bool(0))
|
||||
sink_2_pause = Signal(bool(0))
|
||||
sink_3_pause = Signal(bool(0))
|
||||
sink_pause_list = []
|
||||
sink_list = []
|
||||
sink_logic_list = []
|
||||
|
||||
source = udp_ep.UDPFrameSource()
|
||||
|
||||
source_logic = source.create_logic(
|
||||
clk,
|
||||
rst,
|
||||
udp_hdr_ready=input_udp_hdr_ready,
|
||||
udp_hdr_valid=input_udp_hdr_valid,
|
||||
eth_dest_mac=input_eth_dest_mac,
|
||||
eth_src_mac=input_eth_src_mac,
|
||||
eth_type=input_eth_type,
|
||||
ip_version=input_ip_version,
|
||||
ip_ihl=input_ip_ihl,
|
||||
ip_dscp=input_ip_dscp,
|
||||
ip_ecn=input_ip_ecn,
|
||||
ip_length=input_ip_length,
|
||||
ip_identification=input_ip_identification,
|
||||
ip_flags=input_ip_flags,
|
||||
ip_fragment_offset=input_ip_fragment_offset,
|
||||
ip_ttl=input_ip_ttl,
|
||||
ip_protocol=input_ip_protocol,
|
||||
ip_header_checksum=input_ip_header_checksum,
|
||||
ip_source_ip=input_ip_source_ip,
|
||||
ip_dest_ip=input_ip_dest_ip,
|
||||
udp_source_port=input_udp_source_port,
|
||||
udp_dest_port=input_udp_dest_port,
|
||||
udp_length=input_udp_length,
|
||||
udp_checksum=input_udp_checksum,
|
||||
udp_payload_tdata=input_udp_payload_tdata,
|
||||
udp_payload_tkeep=input_udp_payload_tkeep,
|
||||
udp_payload_tvalid=input_udp_payload_tvalid,
|
||||
udp_payload_tready=input_udp_payload_tready,
|
||||
udp_payload_tlast=input_udp_payload_tlast,
|
||||
udp_payload_tuser=input_udp_payload_tuser,
|
||||
udp_hdr_ready=s_udp_hdr_ready,
|
||||
udp_hdr_valid=s_udp_hdr_valid,
|
||||
eth_dest_mac=s_eth_dest_mac,
|
||||
eth_src_mac=s_eth_src_mac,
|
||||
eth_type=s_eth_type,
|
||||
ip_version=s_ip_version,
|
||||
ip_ihl=s_ip_ihl,
|
||||
ip_dscp=s_ip_dscp,
|
||||
ip_ecn=s_ip_ecn,
|
||||
ip_length=s_ip_length,
|
||||
ip_identification=s_ip_identification,
|
||||
ip_flags=s_ip_flags,
|
||||
ip_fragment_offset=s_ip_fragment_offset,
|
||||
ip_ttl=s_ip_ttl,
|
||||
ip_protocol=s_ip_protocol,
|
||||
ip_header_checksum=s_ip_header_checksum,
|
||||
ip_source_ip=s_ip_source_ip,
|
||||
ip_dest_ip=s_ip_dest_ip,
|
||||
udp_source_port=s_udp_source_port,
|
||||
udp_dest_port=s_udp_dest_port,
|
||||
udp_length=s_udp_length,
|
||||
udp_checksum=s_udp_checksum,
|
||||
udp_payload_tdata=s_udp_payload_axis_tdata,
|
||||
udp_payload_tkeep=s_udp_payload_axis_tkeep,
|
||||
udp_payload_tvalid=s_udp_payload_axis_tvalid,
|
||||
udp_payload_tready=s_udp_payload_axis_tready,
|
||||
udp_payload_tlast=s_udp_payload_axis_tlast,
|
||||
udp_payload_tuser=s_udp_payload_axis_tuser,
|
||||
pause=source_pause,
|
||||
name='source'
|
||||
)
|
||||
|
||||
sink_0 = udp_ep.UDPFrameSink()
|
||||
for k in range(M_COUNT):
|
||||
s = udp_ep.UDPFrameSink()
|
||||
p = Signal(bool(0))
|
||||
|
||||
sink_0_logic = sink_0.create_logic(
|
||||
clk,
|
||||
rst,
|
||||
udp_hdr_ready=output_0_udp_hdr_ready,
|
||||
udp_hdr_valid=output_0_udp_hdr_valid,
|
||||
eth_dest_mac=output_0_eth_dest_mac,
|
||||
eth_src_mac=output_0_eth_src_mac,
|
||||
eth_type=output_0_eth_type,
|
||||
ip_version=output_0_ip_version,
|
||||
ip_ihl=output_0_ip_ihl,
|
||||
ip_dscp=output_0_ip_dscp,
|
||||
ip_ecn=output_0_ip_ecn,
|
||||
ip_length=output_0_ip_length,
|
||||
ip_identification=output_0_ip_identification,
|
||||
ip_flags=output_0_ip_flags,
|
||||
ip_fragment_offset=output_0_ip_fragment_offset,
|
||||
ip_ttl=output_0_ip_ttl,
|
||||
ip_protocol=output_0_ip_protocol,
|
||||
ip_header_checksum=output_0_ip_header_checksum,
|
||||
ip_source_ip=output_0_ip_source_ip,
|
||||
ip_dest_ip=output_0_ip_dest_ip,
|
||||
udp_source_port=output_0_udp_source_port,
|
||||
udp_dest_port=output_0_udp_dest_port,
|
||||
udp_length=output_0_udp_length,
|
||||
udp_checksum=output_0_udp_checksum,
|
||||
udp_payload_tdata=output_0_udp_payload_tdata,
|
||||
udp_payload_tkeep=output_0_udp_payload_tkeep,
|
||||
udp_payload_tvalid=output_0_udp_payload_tvalid,
|
||||
udp_payload_tready=output_0_udp_payload_tready,
|
||||
udp_payload_tlast=output_0_udp_payload_tlast,
|
||||
udp_payload_tuser=output_0_udp_payload_tuser,
|
||||
pause=sink_0_pause,
|
||||
name='sink_0'
|
||||
)
|
||||
sink_list.append(s)
|
||||
sink_pause_list.append(p)
|
||||
|
||||
sink_1 = udp_ep.UDPFrameSink()
|
||||
|
||||
sink_1_logic = sink_1.create_logic(
|
||||
clk,
|
||||
rst,
|
||||
udp_hdr_ready=output_1_udp_hdr_ready,
|
||||
udp_hdr_valid=output_1_udp_hdr_valid,
|
||||
eth_dest_mac=output_1_eth_dest_mac,
|
||||
eth_src_mac=output_1_eth_src_mac,
|
||||
eth_type=output_1_eth_type,
|
||||
ip_version=output_1_ip_version,
|
||||
ip_ihl=output_1_ip_ihl,
|
||||
ip_dscp=output_1_ip_dscp,
|
||||
ip_ecn=output_1_ip_ecn,
|
||||
ip_length=output_1_ip_length,
|
||||
ip_identification=output_1_ip_identification,
|
||||
ip_flags=output_1_ip_flags,
|
||||
ip_fragment_offset=output_1_ip_fragment_offset,
|
||||
ip_ttl=output_1_ip_ttl,
|
||||
ip_protocol=output_1_ip_protocol,
|
||||
ip_header_checksum=output_1_ip_header_checksum,
|
||||
ip_source_ip=output_1_ip_source_ip,
|
||||
ip_dest_ip=output_1_ip_dest_ip,
|
||||
udp_source_port=output_1_udp_source_port,
|
||||
udp_dest_port=output_1_udp_dest_port,
|
||||
udp_length=output_1_udp_length,
|
||||
udp_checksum=output_1_udp_checksum,
|
||||
udp_payload_tdata=output_1_udp_payload_tdata,
|
||||
udp_payload_tkeep=output_1_udp_payload_tkeep,
|
||||
udp_payload_tvalid=output_1_udp_payload_tvalid,
|
||||
udp_payload_tready=output_1_udp_payload_tready,
|
||||
udp_payload_tlast=output_1_udp_payload_tlast,
|
||||
udp_payload_tuser=output_1_udp_payload_tuser,
|
||||
pause=sink_1_pause,
|
||||
name='sink_1'
|
||||
)
|
||||
|
||||
sink_2 = udp_ep.UDPFrameSink()
|
||||
|
||||
sink_2_logic = sink_2.create_logic(
|
||||
clk,
|
||||
rst,
|
||||
udp_hdr_ready=output_2_udp_hdr_ready,
|
||||
udp_hdr_valid=output_2_udp_hdr_valid,
|
||||
eth_dest_mac=output_2_eth_dest_mac,
|
||||
eth_src_mac=output_2_eth_src_mac,
|
||||
eth_type=output_2_eth_type,
|
||||
ip_version=output_2_ip_version,
|
||||
ip_ihl=output_2_ip_ihl,
|
||||
ip_dscp=output_2_ip_dscp,
|
||||
ip_ecn=output_2_ip_ecn,
|
||||
ip_length=output_2_ip_length,
|
||||
ip_identification=output_2_ip_identification,
|
||||
ip_flags=output_2_ip_flags,
|
||||
ip_fragment_offset=output_2_ip_fragment_offset,
|
||||
ip_ttl=output_2_ip_ttl,
|
||||
ip_protocol=output_2_ip_protocol,
|
||||
ip_header_checksum=output_2_ip_header_checksum,
|
||||
ip_source_ip=output_2_ip_source_ip,
|
||||
ip_dest_ip=output_2_ip_dest_ip,
|
||||
udp_source_port=output_2_udp_source_port,
|
||||
udp_dest_port=output_2_udp_dest_port,
|
||||
udp_length=output_2_udp_length,
|
||||
udp_checksum=output_2_udp_checksum,
|
||||
udp_payload_tdata=output_2_udp_payload_tdata,
|
||||
udp_payload_tkeep=output_2_udp_payload_tkeep,
|
||||
udp_payload_tvalid=output_2_udp_payload_tvalid,
|
||||
udp_payload_tready=output_2_udp_payload_tready,
|
||||
udp_payload_tlast=output_2_udp_payload_tlast,
|
||||
udp_payload_tuser=output_2_udp_payload_tuser,
|
||||
pause=sink_2_pause,
|
||||
name='sink_2'
|
||||
)
|
||||
|
||||
sink_3 = udp_ep.UDPFrameSink()
|
||||
|
||||
sink_3_logic = sink_3.create_logic(
|
||||
clk,
|
||||
rst,
|
||||
udp_hdr_ready=output_3_udp_hdr_ready,
|
||||
udp_hdr_valid=output_3_udp_hdr_valid,
|
||||
eth_dest_mac=output_3_eth_dest_mac,
|
||||
eth_src_mac=output_3_eth_src_mac,
|
||||
eth_type=output_3_eth_type,
|
||||
ip_version=output_3_ip_version,
|
||||
ip_ihl=output_3_ip_ihl,
|
||||
ip_dscp=output_3_ip_dscp,
|
||||
ip_ecn=output_3_ip_ecn,
|
||||
ip_length=output_3_ip_length,
|
||||
ip_identification=output_3_ip_identification,
|
||||
ip_flags=output_3_ip_flags,
|
||||
ip_fragment_offset=output_3_ip_fragment_offset,
|
||||
ip_ttl=output_3_ip_ttl,
|
||||
ip_protocol=output_3_ip_protocol,
|
||||
ip_header_checksum=output_3_ip_header_checksum,
|
||||
ip_source_ip=output_3_ip_source_ip,
|
||||
ip_dest_ip=output_3_ip_dest_ip,
|
||||
udp_source_port=output_3_udp_source_port,
|
||||
udp_dest_port=output_3_udp_dest_port,
|
||||
udp_length=output_3_udp_length,
|
||||
udp_checksum=output_3_udp_checksum,
|
||||
udp_payload_tdata=output_3_udp_payload_tdata,
|
||||
udp_payload_tkeep=output_3_udp_payload_tkeep,
|
||||
udp_payload_tvalid=output_3_udp_payload_tvalid,
|
||||
udp_payload_tready=output_3_udp_payload_tready,
|
||||
udp_payload_tlast=output_3_udp_payload_tlast,
|
||||
udp_payload_tuser=output_3_udp_payload_tuser,
|
||||
pause=sink_3_pause,
|
||||
name='sink_3'
|
||||
)
|
||||
sink_logic_list.append(s.create_logic(
|
||||
clk,
|
||||
rst,
|
||||
udp_hdr_ready=m_udp_hdr_ready_list[k],
|
||||
udp_hdr_valid=m_udp_hdr_valid_list[k],
|
||||
eth_dest_mac=m_eth_dest_mac_list[k],
|
||||
eth_src_mac=m_eth_src_mac_list[k],
|
||||
eth_type=m_eth_type_list[k],
|
||||
ip_version=m_ip_version_list[k],
|
||||
ip_ihl=m_ip_ihl_list[k],
|
||||
ip_dscp=m_ip_dscp_list[k],
|
||||
ip_ecn=m_ip_ecn_list[k],
|
||||
ip_length=m_ip_length_list[k],
|
||||
ip_identification=m_ip_identification_list[k],
|
||||
ip_flags=m_ip_flags_list[k],
|
||||
ip_fragment_offset=m_ip_fragment_offset_list[k],
|
||||
ip_ttl=m_ip_ttl_list[k],
|
||||
ip_protocol=m_ip_protocol_list[k],
|
||||
ip_header_checksum=m_ip_header_checksum_list[k],
|
||||
ip_source_ip=m_ip_source_ip_list[k],
|
||||
ip_dest_ip=m_ip_dest_ip_list[k],
|
||||
udp_source_port=m_udp_source_port_list[k],
|
||||
udp_dest_port=m_udp_dest_port_list[k],
|
||||
udp_length=m_udp_length_list[k],
|
||||
udp_checksum=m_udp_checksum_list[k],
|
||||
udp_payload_tdata=m_udp_payload_axis_tdata_list[k],
|
||||
udp_payload_tkeep=m_udp_payload_axis_tkeep_list[k],
|
||||
udp_payload_tvalid=m_udp_payload_axis_tvalid_list[k],
|
||||
udp_payload_tready=m_udp_payload_axis_tready_list[k],
|
||||
udp_payload_tlast=m_udp_payload_axis_tlast_list[k],
|
||||
udp_payload_tuser=m_udp_payload_axis_tuser_list[k],
|
||||
pause=p,
|
||||
name='sink_%d' % k
|
||||
))
|
||||
|
||||
# DUT
|
||||
if os.system(build_cmd):
|
||||
@ -397,149 +255,70 @@ def bench():
|
||||
rst=rst,
|
||||
current_test=current_test,
|
||||
|
||||
input_udp_hdr_valid=input_udp_hdr_valid,
|
||||
input_udp_hdr_ready=input_udp_hdr_ready,
|
||||
input_eth_dest_mac=input_eth_dest_mac,
|
||||
input_eth_src_mac=input_eth_src_mac,
|
||||
input_eth_type=input_eth_type,
|
||||
input_ip_version=input_ip_version,
|
||||
input_ip_ihl=input_ip_ihl,
|
||||
input_ip_dscp=input_ip_dscp,
|
||||
input_ip_ecn=input_ip_ecn,
|
||||
input_ip_length=input_ip_length,
|
||||
input_ip_identification=input_ip_identification,
|
||||
input_ip_flags=input_ip_flags,
|
||||
input_ip_fragment_offset=input_ip_fragment_offset,
|
||||
input_ip_ttl=input_ip_ttl,
|
||||
input_ip_protocol=input_ip_protocol,
|
||||
input_ip_header_checksum=input_ip_header_checksum,
|
||||
input_ip_source_ip=input_ip_source_ip,
|
||||
input_ip_dest_ip=input_ip_dest_ip,
|
||||
input_udp_source_port=input_udp_source_port,
|
||||
input_udp_dest_port=input_udp_dest_port,
|
||||
input_udp_length=input_udp_length,
|
||||
input_udp_checksum=input_udp_checksum,
|
||||
input_udp_payload_tdata=input_udp_payload_tdata,
|
||||
input_udp_payload_tkeep=input_udp_payload_tkeep,
|
||||
input_udp_payload_tvalid=input_udp_payload_tvalid,
|
||||
input_udp_payload_tready=input_udp_payload_tready,
|
||||
input_udp_payload_tlast=input_udp_payload_tlast,
|
||||
input_udp_payload_tuser=input_udp_payload_tuser,
|
||||
s_udp_hdr_valid=s_udp_hdr_valid,
|
||||
s_udp_hdr_ready=s_udp_hdr_ready,
|
||||
s_eth_dest_mac=s_eth_dest_mac,
|
||||
s_eth_src_mac=s_eth_src_mac,
|
||||
s_eth_type=s_eth_type,
|
||||
s_ip_version=s_ip_version,
|
||||
s_ip_ihl=s_ip_ihl,
|
||||
s_ip_dscp=s_ip_dscp,
|
||||
s_ip_ecn=s_ip_ecn,
|
||||
s_ip_length=s_ip_length,
|
||||
s_ip_identification=s_ip_identification,
|
||||
s_ip_flags=s_ip_flags,
|
||||
s_ip_fragment_offset=s_ip_fragment_offset,
|
||||
s_ip_ttl=s_ip_ttl,
|
||||
s_ip_protocol=s_ip_protocol,
|
||||
s_ip_header_checksum=s_ip_header_checksum,
|
||||
s_ip_source_ip=s_ip_source_ip,
|
||||
s_ip_dest_ip=s_ip_dest_ip,
|
||||
s_udp_source_port=s_udp_source_port,
|
||||
s_udp_dest_port=s_udp_dest_port,
|
||||
s_udp_length=s_udp_length,
|
||||
s_udp_checksum=s_udp_checksum,
|
||||
s_udp_payload_axis_tdata=s_udp_payload_axis_tdata,
|
||||
s_udp_payload_axis_tkeep=s_udp_payload_axis_tkeep,
|
||||
s_udp_payload_axis_tvalid=s_udp_payload_axis_tvalid,
|
||||
s_udp_payload_axis_tready=s_udp_payload_axis_tready,
|
||||
s_udp_payload_axis_tlast=s_udp_payload_axis_tlast,
|
||||
s_udp_payload_axis_tid=s_udp_payload_axis_tid,
|
||||
s_udp_payload_axis_tdest=s_udp_payload_axis_tdest,
|
||||
s_udp_payload_axis_tuser=s_udp_payload_axis_tuser,
|
||||
|
||||
output_0_udp_hdr_valid=output_0_udp_hdr_valid,
|
||||
output_0_udp_hdr_ready=output_0_udp_hdr_ready,
|
||||
output_0_eth_dest_mac=output_0_eth_dest_mac,
|
||||
output_0_eth_src_mac=output_0_eth_src_mac,
|
||||
output_0_eth_type=output_0_eth_type,
|
||||
output_0_ip_version=output_0_ip_version,
|
||||
output_0_ip_ihl=output_0_ip_ihl,
|
||||
output_0_ip_dscp=output_0_ip_dscp,
|
||||
output_0_ip_ecn=output_0_ip_ecn,
|
||||
output_0_ip_length=output_0_ip_length,
|
||||
output_0_ip_identification=output_0_ip_identification,
|
||||
output_0_ip_flags=output_0_ip_flags,
|
||||
output_0_ip_fragment_offset=output_0_ip_fragment_offset,
|
||||
output_0_ip_ttl=output_0_ip_ttl,
|
||||
output_0_ip_protocol=output_0_ip_protocol,
|
||||
output_0_ip_header_checksum=output_0_ip_header_checksum,
|
||||
output_0_ip_source_ip=output_0_ip_source_ip,
|
||||
output_0_ip_dest_ip=output_0_ip_dest_ip,
|
||||
output_0_udp_source_port=output_0_udp_source_port,
|
||||
output_0_udp_dest_port=output_0_udp_dest_port,
|
||||
output_0_udp_length=output_0_udp_length,
|
||||
output_0_udp_checksum=output_0_udp_checksum,
|
||||
output_0_udp_payload_tdata=output_0_udp_payload_tdata,
|
||||
output_0_udp_payload_tkeep=output_0_udp_payload_tkeep,
|
||||
output_0_udp_payload_tvalid=output_0_udp_payload_tvalid,
|
||||
output_0_udp_payload_tready=output_0_udp_payload_tready,
|
||||
output_0_udp_payload_tlast=output_0_udp_payload_tlast,
|
||||
output_0_udp_payload_tuser=output_0_udp_payload_tuser,
|
||||
output_1_udp_hdr_valid=output_1_udp_hdr_valid,
|
||||
output_1_udp_hdr_ready=output_1_udp_hdr_ready,
|
||||
output_1_eth_dest_mac=output_1_eth_dest_mac,
|
||||
output_1_eth_src_mac=output_1_eth_src_mac,
|
||||
output_1_eth_type=output_1_eth_type,
|
||||
output_1_ip_version=output_1_ip_version,
|
||||
output_1_ip_ihl=output_1_ip_ihl,
|
||||
output_1_ip_dscp=output_1_ip_dscp,
|
||||
output_1_ip_ecn=output_1_ip_ecn,
|
||||
output_1_ip_length=output_1_ip_length,
|
||||
output_1_ip_identification=output_1_ip_identification,
|
||||
output_1_ip_flags=output_1_ip_flags,
|
||||
output_1_ip_fragment_offset=output_1_ip_fragment_offset,
|
||||
output_1_ip_ttl=output_1_ip_ttl,
|
||||
output_1_ip_protocol=output_1_ip_protocol,
|
||||
output_1_ip_header_checksum=output_1_ip_header_checksum,
|
||||
output_1_ip_source_ip=output_1_ip_source_ip,
|
||||
output_1_ip_dest_ip=output_1_ip_dest_ip,
|
||||
output_1_udp_source_port=output_1_udp_source_port,
|
||||
output_1_udp_dest_port=output_1_udp_dest_port,
|
||||
output_1_udp_length=output_1_udp_length,
|
||||
output_1_udp_checksum=output_1_udp_checksum,
|
||||
output_1_udp_payload_tdata=output_1_udp_payload_tdata,
|
||||
output_1_udp_payload_tkeep=output_1_udp_payload_tkeep,
|
||||
output_1_udp_payload_tvalid=output_1_udp_payload_tvalid,
|
||||
output_1_udp_payload_tready=output_1_udp_payload_tready,
|
||||
output_1_udp_payload_tlast=output_1_udp_payload_tlast,
|
||||
output_1_udp_payload_tuser=output_1_udp_payload_tuser,
|
||||
output_2_udp_hdr_valid=output_2_udp_hdr_valid,
|
||||
output_2_udp_hdr_ready=output_2_udp_hdr_ready,
|
||||
output_2_eth_dest_mac=output_2_eth_dest_mac,
|
||||
output_2_eth_src_mac=output_2_eth_src_mac,
|
||||
output_2_eth_type=output_2_eth_type,
|
||||
output_2_ip_version=output_2_ip_version,
|
||||
output_2_ip_ihl=output_2_ip_ihl,
|
||||
output_2_ip_dscp=output_2_ip_dscp,
|
||||
output_2_ip_ecn=output_2_ip_ecn,
|
||||
output_2_ip_length=output_2_ip_length,
|
||||
output_2_ip_identification=output_2_ip_identification,
|
||||
output_2_ip_flags=output_2_ip_flags,
|
||||
output_2_ip_fragment_offset=output_2_ip_fragment_offset,
|
||||
output_2_ip_ttl=output_2_ip_ttl,
|
||||
output_2_ip_protocol=output_2_ip_protocol,
|
||||
output_2_ip_header_checksum=output_2_ip_header_checksum,
|
||||
output_2_ip_source_ip=output_2_ip_source_ip,
|
||||
output_2_ip_dest_ip=output_2_ip_dest_ip,
|
||||
output_2_udp_source_port=output_2_udp_source_port,
|
||||
output_2_udp_dest_port=output_2_udp_dest_port,
|
||||
output_2_udp_length=output_2_udp_length,
|
||||
output_2_udp_checksum=output_2_udp_checksum,
|
||||
output_2_udp_payload_tdata=output_2_udp_payload_tdata,
|
||||
output_2_udp_payload_tkeep=output_2_udp_payload_tkeep,
|
||||
output_2_udp_payload_tvalid=output_2_udp_payload_tvalid,
|
||||
output_2_udp_payload_tready=output_2_udp_payload_tready,
|
||||
output_2_udp_payload_tlast=output_2_udp_payload_tlast,
|
||||
output_2_udp_payload_tuser=output_2_udp_payload_tuser,
|
||||
output_3_udp_hdr_valid=output_3_udp_hdr_valid,
|
||||
output_3_udp_hdr_ready=output_3_udp_hdr_ready,
|
||||
output_3_eth_dest_mac=output_3_eth_dest_mac,
|
||||
output_3_eth_src_mac=output_3_eth_src_mac,
|
||||
output_3_eth_type=output_3_eth_type,
|
||||
output_3_ip_version=output_3_ip_version,
|
||||
output_3_ip_ihl=output_3_ip_ihl,
|
||||
output_3_ip_dscp=output_3_ip_dscp,
|
||||
output_3_ip_ecn=output_3_ip_ecn,
|
||||
output_3_ip_length=output_3_ip_length,
|
||||
output_3_ip_identification=output_3_ip_identification,
|
||||
output_3_ip_flags=output_3_ip_flags,
|
||||
output_3_ip_fragment_offset=output_3_ip_fragment_offset,
|
||||
output_3_ip_ttl=output_3_ip_ttl,
|
||||
output_3_ip_protocol=output_3_ip_protocol,
|
||||
output_3_ip_header_checksum=output_3_ip_header_checksum,
|
||||
output_3_ip_source_ip=output_3_ip_source_ip,
|
||||
output_3_ip_dest_ip=output_3_ip_dest_ip,
|
||||
output_3_udp_source_port=output_3_udp_source_port,
|
||||
output_3_udp_dest_port=output_3_udp_dest_port,
|
||||
output_3_udp_length=output_3_udp_length,
|
||||
output_3_udp_checksum=output_3_udp_checksum,
|
||||
output_3_udp_payload_tdata=output_3_udp_payload_tdata,
|
||||
output_3_udp_payload_tkeep=output_3_udp_payload_tkeep,
|
||||
output_3_udp_payload_tvalid=output_3_udp_payload_tvalid,
|
||||
output_3_udp_payload_tready=output_3_udp_payload_tready,
|
||||
output_3_udp_payload_tlast=output_3_udp_payload_tlast,
|
||||
output_3_udp_payload_tuser=output_3_udp_payload_tuser,
|
||||
m_udp_hdr_valid=m_udp_hdr_valid,
|
||||
m_udp_hdr_ready=m_udp_hdr_ready,
|
||||
m_eth_dest_mac=m_eth_dest_mac,
|
||||
m_eth_src_mac=m_eth_src_mac,
|
||||
m_eth_type=m_eth_type,
|
||||
m_ip_version=m_ip_version,
|
||||
m_ip_ihl=m_ip_ihl,
|
||||
m_ip_dscp=m_ip_dscp,
|
||||
m_ip_ecn=m_ip_ecn,
|
||||
m_ip_length=m_ip_length,
|
||||
m_ip_identification=m_ip_identification,
|
||||
m_ip_flags=m_ip_flags,
|
||||
m_ip_fragment_offset=m_ip_fragment_offset,
|
||||
m_ip_ttl=m_ip_ttl,
|
||||
m_ip_protocol=m_ip_protocol,
|
||||
m_ip_header_checksum=m_ip_header_checksum,
|
||||
m_ip_source_ip=m_ip_source_ip,
|
||||
m_ip_dest_ip=m_ip_dest_ip,
|
||||
m_udp_source_port=m_udp_source_port,
|
||||
m_udp_dest_port=m_udp_dest_port,
|
||||
m_udp_length=m_udp_length,
|
||||
m_udp_checksum=m_udp_checksum,
|
||||
m_udp_payload_axis_tdata=m_udp_payload_axis_tdata,
|
||||
m_udp_payload_axis_tkeep=m_udp_payload_axis_tkeep,
|
||||
m_udp_payload_axis_tvalid=m_udp_payload_axis_tvalid,
|
||||
m_udp_payload_axis_tready=m_udp_payload_axis_tready,
|
||||
m_udp_payload_axis_tlast=m_udp_payload_axis_tlast,
|
||||
m_udp_payload_axis_tid=m_udp_payload_axis_tid,
|
||||
m_udp_payload_axis_tdest=m_udp_payload_axis_tdest,
|
||||
m_udp_payload_axis_tuser=m_udp_payload_axis_tuser,
|
||||
|
||||
enable=enable,
|
||||
drop=drop,
|
||||
select=select
|
||||
)
|
||||
|
||||
@ -593,8 +372,8 @@ def bench():
|
||||
|
||||
source.send(test_frame)
|
||||
|
||||
yield sink_0.wait()
|
||||
rx_frame = sink_0.recv()
|
||||
yield sink_list[0].wait()
|
||||
rx_frame = sink_list[0].recv()
|
||||
|
||||
assert rx_frame == test_frame
|
||||
|
||||
@ -632,8 +411,8 @@ def bench():
|
||||
|
||||
source.send(test_frame)
|
||||
|
||||
yield sink_1.wait()
|
||||
rx_frame = sink_1.recv()
|
||||
yield sink_list[1].wait()
|
||||
rx_frame = sink_list[1].recv()
|
||||
|
||||
assert rx_frame == test_frame
|
||||
|
||||
@ -695,13 +474,13 @@ def bench():
|
||||
source.send(test_frame1)
|
||||
source.send(test_frame2)
|
||||
|
||||
yield sink_0.wait()
|
||||
rx_frame = sink_0.recv()
|
||||
yield sink_list[0].wait()
|
||||
rx_frame = sink_list[0].recv()
|
||||
|
||||
assert rx_frame == test_frame1
|
||||
|
||||
yield sink_0.wait()
|
||||
rx_frame = sink_0.recv()
|
||||
yield sink_list[0].wait()
|
||||
rx_frame = sink_list[0].recv()
|
||||
|
||||
assert rx_frame == test_frame2
|
||||
|
||||
@ -764,17 +543,17 @@ def bench():
|
||||
source.send(test_frame2)
|
||||
yield clk.posedge
|
||||
|
||||
while input_udp_payload_tvalid or input_udp_hdr_valid:
|
||||
while s_udp_payload_axis_tvalid or s_udp_hdr_valid:
|
||||
yield clk.posedge
|
||||
select.next = 2
|
||||
|
||||
yield sink_1.wait()
|
||||
rx_frame = sink_1.recv()
|
||||
yield sink_list[1].wait()
|
||||
rx_frame = sink_list[1].recv()
|
||||
|
||||
assert rx_frame == test_frame1
|
||||
|
||||
yield sink_2.wait()
|
||||
rx_frame = sink_2.recv()
|
||||
yield sink_list[2].wait()
|
||||
rx_frame = sink_list[2].recv()
|
||||
|
||||
assert rx_frame == test_frame2
|
||||
|
||||
@ -837,7 +616,7 @@ def bench():
|
||||
source.send(test_frame2)
|
||||
yield clk.posedge
|
||||
|
||||
while input_udp_payload_tvalid or input_udp_hdr_valid:
|
||||
while s_udp_payload_axis_tvalid or s_udp_hdr_valid:
|
||||
source_pause.next = True
|
||||
yield clk.posedge
|
||||
yield clk.posedge
|
||||
@ -846,13 +625,13 @@ def bench():
|
||||
yield clk.posedge
|
||||
select.next = 2
|
||||
|
||||
yield sink_1.wait()
|
||||
rx_frame = sink_1.recv()
|
||||
yield sink_list[1].wait()
|
||||
rx_frame = sink_list[1].recv()
|
||||
|
||||
assert rx_frame == test_frame1
|
||||
|
||||
yield sink_2.wait()
|
||||
rx_frame = sink_2.recv()
|
||||
yield sink_list[2].wait()
|
||||
rx_frame = sink_list[2].recv()
|
||||
|
||||
assert rx_frame == test_frame2
|
||||
|
||||
@ -915,33 +694,120 @@ def bench():
|
||||
source.send(test_frame2)
|
||||
yield clk.posedge
|
||||
|
||||
while input_udp_payload_tvalid or input_udp_hdr_valid:
|
||||
sink_0_pause.next = True
|
||||
sink_1_pause.next = True
|
||||
sink_2_pause.next = True
|
||||
sink_3_pause.next = True
|
||||
while s_udp_payload_axis_tvalid or s_udp_hdr_valid:
|
||||
sink_pause_list[0].next = True
|
||||
sink_pause_list[1].next = True
|
||||
sink_pause_list[2].next = True
|
||||
sink_pause_list[3].next = True
|
||||
yield clk.posedge
|
||||
yield clk.posedge
|
||||
yield clk.posedge
|
||||
sink_0_pause.next = False
|
||||
sink_1_pause.next = False
|
||||
sink_2_pause.next = False
|
||||
sink_3_pause.next = False
|
||||
sink_pause_list[0].next = False
|
||||
sink_pause_list[1].next = False
|
||||
sink_pause_list[2].next = False
|
||||
sink_pause_list[3].next = False
|
||||
yield clk.posedge
|
||||
select.next = 2
|
||||
|
||||
yield sink_1.wait()
|
||||
rx_frame = sink_1.recv()
|
||||
yield sink_list[1].wait()
|
||||
rx_frame = sink_list[1].recv()
|
||||
|
||||
assert rx_frame == test_frame1
|
||||
|
||||
yield sink_2.wait()
|
||||
rx_frame = sink_2.recv()
|
||||
yield sink_list[2].wait()
|
||||
rx_frame = sink_list[2].recv()
|
||||
|
||||
assert rx_frame == test_frame2
|
||||
|
||||
yield delay(100)
|
||||
|
||||
yield clk.posedge
|
||||
print("test 7: enable")
|
||||
current_test.next = 7
|
||||
|
||||
enable.next = False
|
||||
select.next = 0
|
||||
|
||||
test_frame = udp_ep.UDPFrame()
|
||||
test_frame.eth_dest_mac = 0xDAD1D2D3D4D5
|
||||
test_frame.eth_src_mac = 0x5A5152535455
|
||||
test_frame.eth_type = 0x8000
|
||||
test_frame.ip_version = 4
|
||||
test_frame.ip_ihl = 5
|
||||
test_frame.ip_dscp = 0
|
||||
test_frame.ip_ecn = 0
|
||||
test_frame.ip_length = None
|
||||
test_frame.ip_identification = 0
|
||||
test_frame.ip_flags = 2
|
||||
test_frame.ip_fragment_offset = 0
|
||||
test_frame.ip_ttl = 64
|
||||
test_frame.ip_protocol = 0x11
|
||||
test_frame.ip_header_checksum = None
|
||||
test_frame.ip_source_ip = 0xc0a80165
|
||||
test_frame.ip_dest_ip = 0xc0a80164
|
||||
test_frame.udp_source_port = 1
|
||||
test_frame.udp_dest_port = 2
|
||||
test_frame.udp_length = None
|
||||
test_frame.udp_checksum = None
|
||||
test_frame.payload = bytearray(range(32))
|
||||
test_frame.build()
|
||||
|
||||
source.send(test_frame)
|
||||
|
||||
yield delay(500)
|
||||
|
||||
assert sink_list[0].empty()
|
||||
|
||||
enable.next = True
|
||||
|
||||
yield sink_list[0].wait()
|
||||
rx_frame = sink_list[0].recv()
|
||||
|
||||
assert rx_frame == test_frame
|
||||
|
||||
yield delay(100)
|
||||
|
||||
yield clk.posedge
|
||||
print("test 8: drop")
|
||||
current_test.next = 8
|
||||
|
||||
drop.next = True
|
||||
select.next = 0
|
||||
|
||||
test_frame = udp_ep.UDPFrame()
|
||||
test_frame.eth_dest_mac = 0xDAD1D2D3D4D5
|
||||
test_frame.eth_src_mac = 0x5A5152535455
|
||||
test_frame.eth_type = 0x8000
|
||||
test_frame.ip_version = 4
|
||||
test_frame.ip_ihl = 5
|
||||
test_frame.ip_dscp = 0
|
||||
test_frame.ip_ecn = 0
|
||||
test_frame.ip_length = None
|
||||
test_frame.ip_identification = 0
|
||||
test_frame.ip_flags = 2
|
||||
test_frame.ip_fragment_offset = 0
|
||||
test_frame.ip_ttl = 64
|
||||
test_frame.ip_protocol = 0x11
|
||||
test_frame.ip_header_checksum = None
|
||||
test_frame.ip_source_ip = 0xc0a80165
|
||||
test_frame.ip_dest_ip = 0xc0a80164
|
||||
test_frame.udp_source_port = 1
|
||||
test_frame.udp_dest_port = 2
|
||||
test_frame.udp_length = None
|
||||
test_frame.udp_checksum = None
|
||||
test_frame.payload = bytearray(range(32))
|
||||
test_frame.build()
|
||||
|
||||
source.send(test_frame)
|
||||
|
||||
yield delay(500)
|
||||
|
||||
assert sink_list[0].empty()
|
||||
|
||||
drop.next = False
|
||||
|
||||
yield delay(100)
|
||||
|
||||
raise StopSimulation
|
||||
|
||||
return instances()
|
||||
|
@ -27,162 +27,95 @@ THE SOFTWARE.
|
||||
`timescale 1ns / 1ps
|
||||
|
||||
/*
|
||||
* Testbench for udp_demux_64_4
|
||||
* Testbench for udp_demux
|
||||
*/
|
||||
module test_udp_demux_64_4;
|
||||
|
||||
// Parameters
|
||||
parameter M_COUNT = 4;
|
||||
parameter DATA_WIDTH = 64;
|
||||
parameter KEEP_ENABLE = (DATA_WIDTH>8);
|
||||
parameter KEEP_WIDTH = (DATA_WIDTH/8);
|
||||
parameter ID_ENABLE = 1;
|
||||
parameter ID_WIDTH = 8;
|
||||
parameter DEST_ENABLE = 1;
|
||||
parameter DEST_WIDTH = 8;
|
||||
parameter USER_ENABLE = 1;
|
||||
parameter USER_WIDTH = 1;
|
||||
|
||||
// Inputs
|
||||
reg clk = 0;
|
||||
reg rst = 0;
|
||||
reg [7:0] current_test = 0;
|
||||
|
||||
reg input_udp_hdr_valid = 0;
|
||||
reg [47:0] input_eth_dest_mac = 0;
|
||||
reg [47:0] input_eth_src_mac = 0;
|
||||
reg [15:0] input_eth_type = 0;
|
||||
reg [3:0] input_ip_version = 0;
|
||||
reg [3:0] input_ip_ihl = 0;
|
||||
reg [5:0] input_ip_dscp = 0;
|
||||
reg [1:0] input_ip_ecn = 0;
|
||||
reg [15:0] input_ip_length = 0;
|
||||
reg [15:0] input_ip_identification = 0;
|
||||
reg [2:0] input_ip_flags = 0;
|
||||
reg [12:0] input_ip_fragment_offset = 0;
|
||||
reg [7:0] input_ip_ttl = 0;
|
||||
reg [7:0] input_ip_protocol = 0;
|
||||
reg [15:0] input_ip_header_checksum = 0;
|
||||
reg [31:0] input_ip_source_ip = 0;
|
||||
reg [31:0] input_ip_dest_ip = 0;
|
||||
reg [15:0] input_udp_source_port = 0;
|
||||
reg [15:0] input_udp_dest_port = 0;
|
||||
reg [15:0] input_udp_length = 0;
|
||||
reg [15:0] input_udp_checksum = 0;
|
||||
reg [63:0] input_udp_payload_tdata = 0;
|
||||
reg [7:0] input_udp_payload_tkeep = 0;
|
||||
reg input_udp_payload_tvalid = 0;
|
||||
reg input_udp_payload_tlast = 0;
|
||||
reg input_udp_payload_tuser = 0;
|
||||
reg s_udp_hdr_valid = 0;
|
||||
reg [47:0] s_eth_dest_mac = 0;
|
||||
reg [47:0] s_eth_src_mac = 0;
|
||||
reg [15:0] s_eth_type = 0;
|
||||
reg [3:0] s_ip_version = 0;
|
||||
reg [3:0] s_ip_ihl = 0;
|
||||
reg [5:0] s_ip_dscp = 0;
|
||||
reg [1:0] s_ip_ecn = 0;
|
||||
reg [15:0] s_ip_length = 0;
|
||||
reg [15:0] s_ip_identification = 0;
|
||||
reg [2:0] s_ip_flags = 0;
|
||||
reg [12:0] s_ip_fragment_offset = 0;
|
||||
reg [7:0] s_ip_ttl = 0;
|
||||
reg [7:0] s_ip_protocol = 0;
|
||||
reg [15:0] s_ip_header_checksum = 0;
|
||||
reg [31:0] s_ip_source_ip = 0;
|
||||
reg [31:0] s_ip_dest_ip = 0;
|
||||
reg [15:0] s_udp_source_port = 0;
|
||||
reg [15:0] s_udp_dest_port = 0;
|
||||
reg [15:0] s_udp_length = 0;
|
||||
reg [15:0] s_udp_checksum = 0;
|
||||
reg [DATA_WIDTH-1:0] s_udp_payload_axis_tdata = 0;
|
||||
reg [KEEP_WIDTH-1:0] s_udp_payload_axis_tkeep = 0;
|
||||
reg s_udp_payload_axis_tvalid = 0;
|
||||
reg s_udp_payload_axis_tlast = 0;
|
||||
reg [ID_WIDTH-1:0] s_udp_payload_axis_tid = 0;
|
||||
reg [DEST_WIDTH-1:0] s_udp_payload_axis_tdest = 0;
|
||||
reg [USER_WIDTH-1:0] s_udp_payload_axis_tuser = 0;
|
||||
|
||||
reg output_0_udp_hdr_ready = 0;
|
||||
reg output_0_udp_payload_tready = 0;
|
||||
reg output_1_udp_hdr_ready = 0;
|
||||
reg output_1_udp_payload_tready = 0;
|
||||
reg output_2_udp_hdr_ready = 0;
|
||||
reg output_2_udp_payload_tready = 0;
|
||||
reg output_3_udp_hdr_ready = 0;
|
||||
reg output_3_udp_payload_tready = 0;
|
||||
reg [M_COUNT-1:0] m_udp_hdr_ready = 0;
|
||||
reg [M_COUNT-1:0] m_udp_payload_axis_tready = 0;
|
||||
|
||||
reg enable = 0;
|
||||
reg drop = 0;
|
||||
reg [1:0] select = 0;
|
||||
|
||||
// Outputs
|
||||
wire input_udp_hdr_ready;
|
||||
wire input_udp_payload_tready;
|
||||
wire s_udp_hdr_ready;
|
||||
wire s_udp_payload_axis_tready;
|
||||
|
||||
wire output_0_udp_hdr_valid;
|
||||
wire [47:0] output_0_eth_dest_mac;
|
||||
wire [47:0] output_0_eth_src_mac;
|
||||
wire [15:0] output_0_eth_type;
|
||||
wire [3:0] output_0_ip_version;
|
||||
wire [3:0] output_0_ip_ihl;
|
||||
wire [5:0] output_0_ip_dscp;
|
||||
wire [1:0] output_0_ip_ecn;
|
||||
wire [15:0] output_0_ip_length;
|
||||
wire [15:0] output_0_ip_identification;
|
||||
wire [2:0] output_0_ip_flags;
|
||||
wire [12:0] output_0_ip_fragment_offset;
|
||||
wire [7:0] output_0_ip_ttl;
|
||||
wire [7:0] output_0_ip_protocol;
|
||||
wire [15:0] output_0_ip_header_checksum;
|
||||
wire [31:0] output_0_ip_source_ip;
|
||||
wire [31:0] output_0_ip_dest_ip;
|
||||
wire [15:0] output_0_udp_source_port;
|
||||
wire [15:0] output_0_udp_dest_port;
|
||||
wire [15:0] output_0_udp_length;
|
||||
wire [15:0] output_0_udp_checksum;
|
||||
wire [63:0] output_0_udp_payload_tdata;
|
||||
wire [7:0] output_0_udp_payload_tkeep;
|
||||
wire output_0_udp_payload_tvalid;
|
||||
wire output_0_udp_payload_tlast;
|
||||
wire output_0_udp_payload_tuser;
|
||||
wire output_1_udp_hdr_valid;
|
||||
wire [47:0] output_1_eth_dest_mac;
|
||||
wire [47:0] output_1_eth_src_mac;
|
||||
wire [15:0] output_1_eth_type;
|
||||
wire [3:0] output_1_ip_version;
|
||||
wire [3:0] output_1_ip_ihl;
|
||||
wire [5:0] output_1_ip_dscp;
|
||||
wire [1:0] output_1_ip_ecn;
|
||||
wire [15:0] output_1_ip_length;
|
||||
wire [15:0] output_1_ip_identification;
|
||||
wire [2:0] output_1_ip_flags;
|
||||
wire [12:0] output_1_ip_fragment_offset;
|
||||
wire [7:0] output_1_ip_ttl;
|
||||
wire [7:0] output_1_ip_protocol;
|
||||
wire [15:0] output_1_ip_header_checksum;
|
||||
wire [31:0] output_1_ip_source_ip;
|
||||
wire [31:0] output_1_ip_dest_ip;
|
||||
wire [15:0] output_1_udp_source_port;
|
||||
wire [15:0] output_1_udp_dest_port;
|
||||
wire [15:0] output_1_udp_length;
|
||||
wire [15:0] output_1_udp_checksum;
|
||||
wire [63:0] output_1_udp_payload_tdata;
|
||||
wire [7:0] output_1_udp_payload_tkeep;
|
||||
wire output_1_udp_payload_tvalid;
|
||||
wire output_1_udp_payload_tlast;
|
||||
wire output_1_udp_payload_tuser;
|
||||
wire output_2_udp_hdr_valid;
|
||||
wire [47:0] output_2_eth_dest_mac;
|
||||
wire [47:0] output_2_eth_src_mac;
|
||||
wire [15:0] output_2_eth_type;
|
||||
wire [3:0] output_2_ip_version;
|
||||
wire [3:0] output_2_ip_ihl;
|
||||
wire [5:0] output_2_ip_dscp;
|
||||
wire [1:0] output_2_ip_ecn;
|
||||
wire [15:0] output_2_ip_length;
|
||||
wire [15:0] output_2_ip_identification;
|
||||
wire [2:0] output_2_ip_flags;
|
||||
wire [12:0] output_2_ip_fragment_offset;
|
||||
wire [7:0] output_2_ip_ttl;
|
||||
wire [7:0] output_2_ip_protocol;
|
||||
wire [15:0] output_2_ip_header_checksum;
|
||||
wire [31:0] output_2_ip_source_ip;
|
||||
wire [31:0] output_2_ip_dest_ip;
|
||||
wire [15:0] output_2_udp_source_port;
|
||||
wire [15:0] output_2_udp_dest_port;
|
||||
wire [15:0] output_2_udp_length;
|
||||
wire [15:0] output_2_udp_checksum;
|
||||
wire [63:0] output_2_udp_payload_tdata;
|
||||
wire [7:0] output_2_udp_payload_tkeep;
|
||||
wire output_2_udp_payload_tvalid;
|
||||
wire output_2_udp_payload_tlast;
|
||||
wire output_2_udp_payload_tuser;
|
||||
wire output_3_udp_hdr_valid;
|
||||
wire [47:0] output_3_eth_dest_mac;
|
||||
wire [47:0] output_3_eth_src_mac;
|
||||
wire [15:0] output_3_eth_type;
|
||||
wire [3:0] output_3_ip_version;
|
||||
wire [3:0] output_3_ip_ihl;
|
||||
wire [5:0] output_3_ip_dscp;
|
||||
wire [1:0] output_3_ip_ecn;
|
||||
wire [15:0] output_3_ip_length;
|
||||
wire [15:0] output_3_ip_identification;
|
||||
wire [2:0] output_3_ip_flags;
|
||||
wire [12:0] output_3_ip_fragment_offset;
|
||||
wire [7:0] output_3_ip_ttl;
|
||||
wire [7:0] output_3_ip_protocol;
|
||||
wire [15:0] output_3_ip_header_checksum;
|
||||
wire [31:0] output_3_ip_source_ip;
|
||||
wire [31:0] output_3_ip_dest_ip;
|
||||
wire [15:0] output_3_udp_source_port;
|
||||
wire [15:0] output_3_udp_dest_port;
|
||||
wire [15:0] output_3_udp_length;
|
||||
wire [15:0] output_3_udp_checksum;
|
||||
wire [63:0] output_3_udp_payload_tdata;
|
||||
wire [7:0] output_3_udp_payload_tkeep;
|
||||
wire output_3_udp_payload_tvalid;
|
||||
wire output_3_udp_payload_tlast;
|
||||
wire output_3_udp_payload_tuser;
|
||||
wire [M_COUNT-1:0] m_udp_hdr_valid;
|
||||
wire [M_COUNT*48-1:0] m_eth_dest_mac;
|
||||
wire [M_COUNT*48-1:0] m_eth_src_mac;
|
||||
wire [M_COUNT*16-1:0] m_eth_type;
|
||||
wire [M_COUNT*4-1:0] m_ip_version;
|
||||
wire [M_COUNT*4-1:0] m_ip_ihl;
|
||||
wire [M_COUNT*6-1:0] m_ip_dscp;
|
||||
wire [M_COUNT*2-1:0] m_ip_ecn;
|
||||
wire [M_COUNT*16-1:0] m_ip_length;
|
||||
wire [M_COUNT*16-1:0] m_ip_identification;
|
||||
wire [M_COUNT*3-1:0] m_ip_flags;
|
||||
wire [M_COUNT*13-1:0] m_ip_fragment_offset;
|
||||
wire [M_COUNT*8-1:0] m_ip_ttl;
|
||||
wire [M_COUNT*8-1:0] m_ip_protocol;
|
||||
wire [M_COUNT*16-1:0] m_ip_header_checksum;
|
||||
wire [M_COUNT*32-1:0] m_ip_source_ip;
|
||||
wire [M_COUNT*32-1:0] m_ip_dest_ip;
|
||||
wire [M_COUNT*16-1:0] m_udp_source_port;
|
||||
wire [M_COUNT*16-1:0] m_udp_dest_port;
|
||||
wire [M_COUNT*16-1:0] m_udp_length;
|
||||
wire [M_COUNT*16-1:0] m_udp_checksum;
|
||||
wire [M_COUNT*DATA_WIDTH-1:0] m_udp_payload_axis_tdata;
|
||||
wire [M_COUNT*KEEP_WIDTH-1:0] m_udp_payload_axis_tkeep;
|
||||
wire [M_COUNT-1:0] m_udp_payload_axis_tvalid;
|
||||
wire [M_COUNT-1:0] m_udp_payload_axis_tlast;
|
||||
wire [M_COUNT*ID_WIDTH-1:0] m_udp_payload_axis_tid;
|
||||
wire [M_COUNT*DEST_WIDTH-1:0] m_udp_payload_axis_tdest;
|
||||
wire [M_COUNT*USER_WIDTH-1:0] m_udp_payload_axis_tuser;
|
||||
|
||||
initial begin
|
||||
// myhdl integration
|
||||
@ -190,150 +123,71 @@ initial begin
|
||||
clk,
|
||||
rst,
|
||||
current_test,
|
||||
input_udp_hdr_valid,
|
||||
input_eth_dest_mac,
|
||||
input_eth_src_mac,
|
||||
input_eth_type,
|
||||
input_ip_version,
|
||||
input_ip_ihl,
|
||||
input_ip_dscp,
|
||||
input_ip_ecn,
|
||||
input_ip_length,
|
||||
input_ip_identification,
|
||||
input_ip_flags,
|
||||
input_ip_fragment_offset,
|
||||
input_ip_ttl,
|
||||
input_ip_protocol,
|
||||
input_ip_header_checksum,
|
||||
input_ip_source_ip,
|
||||
input_ip_dest_ip,
|
||||
input_udp_source_port,
|
||||
input_udp_dest_port,
|
||||
input_udp_length,
|
||||
input_udp_checksum,
|
||||
input_udp_payload_tdata,
|
||||
input_udp_payload_tkeep,
|
||||
input_udp_payload_tvalid,
|
||||
input_udp_payload_tlast,
|
||||
input_udp_payload_tuser,
|
||||
output_0_udp_hdr_ready,
|
||||
output_0_udp_payload_tready,
|
||||
output_1_udp_hdr_ready,
|
||||
output_1_udp_payload_tready,
|
||||
output_2_udp_hdr_ready,
|
||||
output_2_udp_payload_tready,
|
||||
output_3_udp_hdr_ready,
|
||||
output_3_udp_payload_tready,
|
||||
s_udp_hdr_valid,
|
||||
s_eth_dest_mac,
|
||||
s_eth_src_mac,
|
||||
s_eth_type,
|
||||
s_ip_version,
|
||||
s_ip_ihl,
|
||||
s_ip_dscp,
|
||||
s_ip_ecn,
|
||||
s_ip_length,
|
||||
s_ip_identification,
|
||||
s_ip_flags,
|
||||
s_ip_fragment_offset,
|
||||
s_ip_ttl,
|
||||
s_ip_protocol,
|
||||
s_ip_header_checksum,
|
||||
s_ip_source_ip,
|
||||
s_ip_dest_ip,
|
||||
s_udp_source_port,
|
||||
s_udp_dest_port,
|
||||
s_udp_length,
|
||||
s_udp_checksum,
|
||||
s_udp_payload_axis_tdata,
|
||||
s_udp_payload_axis_tkeep,
|
||||
s_udp_payload_axis_tvalid,
|
||||
s_udp_payload_axis_tlast,
|
||||
s_udp_payload_axis_tid,
|
||||
s_udp_payload_axis_tdest,
|
||||
s_udp_payload_axis_tuser,
|
||||
m_udp_hdr_ready,
|
||||
m_udp_payload_axis_tready,
|
||||
enable,
|
||||
drop,
|
||||
select
|
||||
);
|
||||
$to_myhdl(
|
||||
input_udp_hdr_ready,
|
||||
input_udp_payload_tready,
|
||||
output_0_udp_hdr_valid,
|
||||
output_0_eth_dest_mac,
|
||||
output_0_eth_src_mac,
|
||||
output_0_eth_type,
|
||||
output_0_ip_version,
|
||||
output_0_ip_ihl,
|
||||
output_0_ip_dscp,
|
||||
output_0_ip_ecn,
|
||||
output_0_ip_length,
|
||||
output_0_ip_identification,
|
||||
output_0_ip_flags,
|
||||
output_0_ip_fragment_offset,
|
||||
output_0_ip_ttl,
|
||||
output_0_ip_protocol,
|
||||
output_0_ip_header_checksum,
|
||||
output_0_ip_source_ip,
|
||||
output_0_ip_dest_ip,
|
||||
output_0_udp_source_port,
|
||||
output_0_udp_dest_port,
|
||||
output_0_udp_length,
|
||||
output_0_udp_checksum,
|
||||
output_0_udp_payload_tdata,
|
||||
output_0_udp_payload_tkeep,
|
||||
output_0_udp_payload_tvalid,
|
||||
output_0_udp_payload_tlast,
|
||||
output_0_udp_payload_tuser,
|
||||
output_1_udp_hdr_valid,
|
||||
output_1_eth_dest_mac,
|
||||
output_1_eth_src_mac,
|
||||
output_1_eth_type,
|
||||
output_1_ip_version,
|
||||
output_1_ip_ihl,
|
||||
output_1_ip_dscp,
|
||||
output_1_ip_ecn,
|
||||
output_1_ip_length,
|
||||
output_1_ip_identification,
|
||||
output_1_ip_flags,
|
||||
output_1_ip_fragment_offset,
|
||||
output_1_ip_ttl,
|
||||
output_1_ip_protocol,
|
||||
output_1_ip_header_checksum,
|
||||
output_1_ip_source_ip,
|
||||
output_1_ip_dest_ip,
|
||||
output_1_udp_source_port,
|
||||
output_1_udp_dest_port,
|
||||
output_1_udp_length,
|
||||
output_1_udp_checksum,
|
||||
output_1_udp_payload_tdata,
|
||||
output_1_udp_payload_tkeep,
|
||||
output_1_udp_payload_tvalid,
|
||||
output_1_udp_payload_tlast,
|
||||
output_1_udp_payload_tuser,
|
||||
output_2_udp_hdr_valid,
|
||||
output_2_eth_dest_mac,
|
||||
output_2_eth_src_mac,
|
||||
output_2_eth_type,
|
||||
output_2_ip_version,
|
||||
output_2_ip_ihl,
|
||||
output_2_ip_dscp,
|
||||
output_2_ip_ecn,
|
||||
output_2_ip_length,
|
||||
output_2_ip_identification,
|
||||
output_2_ip_flags,
|
||||
output_2_ip_fragment_offset,
|
||||
output_2_ip_ttl,
|
||||
output_2_ip_protocol,
|
||||
output_2_ip_header_checksum,
|
||||
output_2_ip_source_ip,
|
||||
output_2_ip_dest_ip,
|
||||
output_2_udp_source_port,
|
||||
output_2_udp_dest_port,
|
||||
output_2_udp_length,
|
||||
output_2_udp_checksum,
|
||||
output_2_udp_payload_tdata,
|
||||
output_2_udp_payload_tkeep,
|
||||
output_2_udp_payload_tvalid,
|
||||
output_2_udp_payload_tlast,
|
||||
output_2_udp_payload_tuser,
|
||||
output_3_udp_hdr_valid,
|
||||
output_3_eth_dest_mac,
|
||||
output_3_eth_src_mac,
|
||||
output_3_eth_type,
|
||||
output_3_ip_version,
|
||||
output_3_ip_ihl,
|
||||
output_3_ip_dscp,
|
||||
output_3_ip_ecn,
|
||||
output_3_ip_length,
|
||||
output_3_ip_identification,
|
||||
output_3_ip_flags,
|
||||
output_3_ip_fragment_offset,
|
||||
output_3_ip_ttl,
|
||||
output_3_ip_protocol,
|
||||
output_3_ip_header_checksum,
|
||||
output_3_ip_source_ip,
|
||||
output_3_ip_dest_ip,
|
||||
output_3_udp_source_port,
|
||||
output_3_udp_dest_port,
|
||||
output_3_udp_length,
|
||||
output_3_udp_checksum,
|
||||
output_3_udp_payload_tdata,
|
||||
output_3_udp_payload_tkeep,
|
||||
output_3_udp_payload_tvalid,
|
||||
output_3_udp_payload_tlast,
|
||||
output_3_udp_payload_tuser
|
||||
s_udp_hdr_ready,
|
||||
s_udp_payload_axis_tready,
|
||||
m_udp_hdr_valid,
|
||||
m_eth_dest_mac,
|
||||
m_eth_src_mac,
|
||||
m_eth_type,
|
||||
m_ip_version,
|
||||
m_ip_ihl,
|
||||
m_ip_dscp,
|
||||
m_ip_ecn,
|
||||
m_ip_length,
|
||||
m_ip_identification,
|
||||
m_ip_flags,
|
||||
m_ip_fragment_offset,
|
||||
m_ip_ttl,
|
||||
m_ip_protocol,
|
||||
m_ip_header_checksum,
|
||||
m_ip_source_ip,
|
||||
m_ip_dest_ip,
|
||||
m_udp_source_port,
|
||||
m_udp_dest_port,
|
||||
m_udp_length,
|
||||
m_udp_checksum,
|
||||
m_udp_payload_axis_tdata,
|
||||
m_udp_payload_axis_tkeep,
|
||||
m_udp_payload_axis_tvalid,
|
||||
m_udp_payload_axis_tlast,
|
||||
m_udp_payload_axis_tid,
|
||||
m_udp_payload_axis_tdest,
|
||||
m_udp_payload_axis_tuser
|
||||
);
|
||||
|
||||
// dump file
|
||||
@ -341,154 +195,86 @@ initial begin
|
||||
$dumpvars(0, test_udp_demux_64_4);
|
||||
end
|
||||
|
||||
udp_demux_64_4
|
||||
udp_demux #(
|
||||
.M_COUNT(M_COUNT),
|
||||
.DATA_WIDTH(DATA_WIDTH),
|
||||
.KEEP_ENABLE(KEEP_ENABLE),
|
||||
.KEEP_WIDTH(KEEP_WIDTH),
|
||||
.ID_ENABLE(ID_ENABLE),
|
||||
.ID_WIDTH(ID_WIDTH),
|
||||
.DEST_ENABLE(DEST_ENABLE),
|
||||
.DEST_WIDTH(DEST_WIDTH),
|
||||
.USER_ENABLE(USER_ENABLE),
|
||||
.USER_WIDTH(USER_WIDTH)
|
||||
)
|
||||
UUT (
|
||||
.clk(clk),
|
||||
.rst(rst),
|
||||
// UDP frame input
|
||||
.input_udp_hdr_valid(input_udp_hdr_valid),
|
||||
.input_udp_hdr_ready(input_udp_hdr_ready),
|
||||
.input_eth_dest_mac(input_eth_dest_mac),
|
||||
.input_eth_src_mac(input_eth_src_mac),
|
||||
.input_eth_type(input_eth_type),
|
||||
.input_ip_version(input_ip_version),
|
||||
.input_ip_ihl(input_ip_ihl),
|
||||
.input_ip_dscp(input_ip_dscp),
|
||||
.input_ip_ecn(input_ip_ecn),
|
||||
.input_ip_length(input_ip_length),
|
||||
.input_ip_identification(input_ip_identification),
|
||||
.input_ip_flags(input_ip_flags),
|
||||
.input_ip_fragment_offset(input_ip_fragment_offset),
|
||||
.input_ip_ttl(input_ip_ttl),
|
||||
.input_ip_protocol(input_ip_protocol),
|
||||
.input_ip_header_checksum(input_ip_header_checksum),
|
||||
.input_ip_source_ip(input_ip_source_ip),
|
||||
.input_ip_dest_ip(input_ip_dest_ip),
|
||||
.input_udp_source_port(input_udp_source_port),
|
||||
.input_udp_dest_port(input_udp_dest_port),
|
||||
.input_udp_length(input_udp_length),
|
||||
.input_udp_checksum(input_udp_checksum),
|
||||
.input_udp_payload_tdata(input_udp_payload_tdata),
|
||||
.input_udp_payload_tkeep(input_udp_payload_tkeep),
|
||||
.input_udp_payload_tvalid(input_udp_payload_tvalid),
|
||||
.input_udp_payload_tready(input_udp_payload_tready),
|
||||
.input_udp_payload_tlast(input_udp_payload_tlast),
|
||||
.input_udp_payload_tuser(input_udp_payload_tuser),
|
||||
.s_udp_hdr_valid(s_udp_hdr_valid),
|
||||
.s_udp_hdr_ready(s_udp_hdr_ready),
|
||||
.s_eth_dest_mac(s_eth_dest_mac),
|
||||
.s_eth_src_mac(s_eth_src_mac),
|
||||
.s_eth_type(s_eth_type),
|
||||
.s_ip_version(s_ip_version),
|
||||
.s_ip_ihl(s_ip_ihl),
|
||||
.s_ip_dscp(s_ip_dscp),
|
||||
.s_ip_ecn(s_ip_ecn),
|
||||
.s_ip_length(s_ip_length),
|
||||
.s_ip_identification(s_ip_identification),
|
||||
.s_ip_flags(s_ip_flags),
|
||||
.s_ip_fragment_offset(s_ip_fragment_offset),
|
||||
.s_ip_ttl(s_ip_ttl),
|
||||
.s_ip_protocol(s_ip_protocol),
|
||||
.s_ip_header_checksum(s_ip_header_checksum),
|
||||
.s_ip_source_ip(s_ip_source_ip),
|
||||
.s_ip_dest_ip(s_ip_dest_ip),
|
||||
.s_udp_source_port(s_udp_source_port),
|
||||
.s_udp_dest_port(s_udp_dest_port),
|
||||
.s_udp_length(s_udp_length),
|
||||
.s_udp_checksum(s_udp_checksum),
|
||||
.s_udp_payload_axis_tdata(s_udp_payload_axis_tdata),
|
||||
.s_udp_payload_axis_tkeep(s_udp_payload_axis_tkeep),
|
||||
.s_udp_payload_axis_tvalid(s_udp_payload_axis_tvalid),
|
||||
.s_udp_payload_axis_tready(s_udp_payload_axis_tready),
|
||||
.s_udp_payload_axis_tlast(s_udp_payload_axis_tlast),
|
||||
.s_udp_payload_axis_tid(s_udp_payload_axis_tid),
|
||||
.s_udp_payload_axis_tdest(s_udp_payload_axis_tdest),
|
||||
.s_udp_payload_axis_tuser(s_udp_payload_axis_tuser),
|
||||
// UDP frame outputs
|
||||
.output_0_udp_hdr_valid(output_0_udp_hdr_valid),
|
||||
.output_0_udp_hdr_ready(output_0_udp_hdr_ready),
|
||||
.output_0_eth_dest_mac(output_0_eth_dest_mac),
|
||||
.output_0_eth_src_mac(output_0_eth_src_mac),
|
||||
.output_0_eth_type(output_0_eth_type),
|
||||
.output_0_ip_version(output_0_ip_version),
|
||||
.output_0_ip_ihl(output_0_ip_ihl),
|
||||
.output_0_ip_dscp(output_0_ip_dscp),
|
||||
.output_0_ip_ecn(output_0_ip_ecn),
|
||||
.output_0_ip_length(output_0_ip_length),
|
||||
.output_0_ip_identification(output_0_ip_identification),
|
||||
.output_0_ip_flags(output_0_ip_flags),
|
||||
.output_0_ip_fragment_offset(output_0_ip_fragment_offset),
|
||||
.output_0_ip_ttl(output_0_ip_ttl),
|
||||
.output_0_ip_protocol(output_0_ip_protocol),
|
||||
.output_0_ip_header_checksum(output_0_ip_header_checksum),
|
||||
.output_0_ip_source_ip(output_0_ip_source_ip),
|
||||
.output_0_ip_dest_ip(output_0_ip_dest_ip),
|
||||
.output_0_udp_source_port(output_0_udp_source_port),
|
||||
.output_0_udp_dest_port(output_0_udp_dest_port),
|
||||
.output_0_udp_length(output_0_udp_length),
|
||||
.output_0_udp_checksum(output_0_udp_checksum),
|
||||
.output_0_udp_payload_tdata(output_0_udp_payload_tdata),
|
||||
.output_0_udp_payload_tkeep(output_0_udp_payload_tkeep),
|
||||
.output_0_udp_payload_tvalid(output_0_udp_payload_tvalid),
|
||||
.output_0_udp_payload_tready(output_0_udp_payload_tready),
|
||||
.output_0_udp_payload_tlast(output_0_udp_payload_tlast),
|
||||
.output_0_udp_payload_tuser(output_0_udp_payload_tuser),
|
||||
.output_1_udp_hdr_valid(output_1_udp_hdr_valid),
|
||||
.output_1_udp_hdr_ready(output_1_udp_hdr_ready),
|
||||
.output_1_eth_dest_mac(output_1_eth_dest_mac),
|
||||
.output_1_eth_src_mac(output_1_eth_src_mac),
|
||||
.output_1_eth_type(output_1_eth_type),
|
||||
.output_1_ip_version(output_1_ip_version),
|
||||
.output_1_ip_ihl(output_1_ip_ihl),
|
||||
.output_1_ip_dscp(output_1_ip_dscp),
|
||||
.output_1_ip_ecn(output_1_ip_ecn),
|
||||
.output_1_ip_length(output_1_ip_length),
|
||||
.output_1_ip_identification(output_1_ip_identification),
|
||||
.output_1_ip_flags(output_1_ip_flags),
|
||||
.output_1_ip_fragment_offset(output_1_ip_fragment_offset),
|
||||
.output_1_ip_ttl(output_1_ip_ttl),
|
||||
.output_1_ip_protocol(output_1_ip_protocol),
|
||||
.output_1_ip_header_checksum(output_1_ip_header_checksum),
|
||||
.output_1_ip_source_ip(output_1_ip_source_ip),
|
||||
.output_1_ip_dest_ip(output_1_ip_dest_ip),
|
||||
.output_1_udp_source_port(output_1_udp_source_port),
|
||||
.output_1_udp_dest_port(output_1_udp_dest_port),
|
||||
.output_1_udp_length(output_1_udp_length),
|
||||
.output_1_udp_checksum(output_1_udp_checksum),
|
||||
.output_1_udp_payload_tdata(output_1_udp_payload_tdata),
|
||||
.output_1_udp_payload_tkeep(output_1_udp_payload_tkeep),
|
||||
.output_1_udp_payload_tvalid(output_1_udp_payload_tvalid),
|
||||
.output_1_udp_payload_tready(output_1_udp_payload_tready),
|
||||
.output_1_udp_payload_tlast(output_1_udp_payload_tlast),
|
||||
.output_1_udp_payload_tuser(output_1_udp_payload_tuser),
|
||||
.output_2_udp_hdr_valid(output_2_udp_hdr_valid),
|
||||
.output_2_udp_hdr_ready(output_2_udp_hdr_ready),
|
||||
.output_2_eth_dest_mac(output_2_eth_dest_mac),
|
||||
.output_2_eth_src_mac(output_2_eth_src_mac),
|
||||
.output_2_eth_type(output_2_eth_type),
|
||||
.output_2_ip_version(output_2_ip_version),
|
||||
.output_2_ip_ihl(output_2_ip_ihl),
|
||||
.output_2_ip_dscp(output_2_ip_dscp),
|
||||
.output_2_ip_ecn(output_2_ip_ecn),
|
||||
.output_2_ip_length(output_2_ip_length),
|
||||
.output_2_ip_identification(output_2_ip_identification),
|
||||
.output_2_ip_flags(output_2_ip_flags),
|
||||
.output_2_ip_fragment_offset(output_2_ip_fragment_offset),
|
||||
.output_2_ip_ttl(output_2_ip_ttl),
|
||||
.output_2_ip_protocol(output_2_ip_protocol),
|
||||
.output_2_ip_header_checksum(output_2_ip_header_checksum),
|
||||
.output_2_ip_source_ip(output_2_ip_source_ip),
|
||||
.output_2_ip_dest_ip(output_2_ip_dest_ip),
|
||||
.output_2_udp_source_port(output_2_udp_source_port),
|
||||
.output_2_udp_dest_port(output_2_udp_dest_port),
|
||||
.output_2_udp_length(output_2_udp_length),
|
||||
.output_2_udp_checksum(output_2_udp_checksum),
|
||||
.output_2_udp_payload_tdata(output_2_udp_payload_tdata),
|
||||
.output_2_udp_payload_tkeep(output_2_udp_payload_tkeep),
|
||||
.output_2_udp_payload_tvalid(output_2_udp_payload_tvalid),
|
||||
.output_2_udp_payload_tready(output_2_udp_payload_tready),
|
||||
.output_2_udp_payload_tlast(output_2_udp_payload_tlast),
|
||||
.output_2_udp_payload_tuser(output_2_udp_payload_tuser),
|
||||
.output_3_udp_hdr_valid(output_3_udp_hdr_valid),
|
||||
.output_3_udp_hdr_ready(output_3_udp_hdr_ready),
|
||||
.output_3_eth_dest_mac(output_3_eth_dest_mac),
|
||||
.output_3_eth_src_mac(output_3_eth_src_mac),
|
||||
.output_3_eth_type(output_3_eth_type),
|
||||
.output_3_ip_version(output_3_ip_version),
|
||||
.output_3_ip_ihl(output_3_ip_ihl),
|
||||
.output_3_ip_dscp(output_3_ip_dscp),
|
||||
.output_3_ip_ecn(output_3_ip_ecn),
|
||||
.output_3_ip_length(output_3_ip_length),
|
||||
.output_3_ip_identification(output_3_ip_identification),
|
||||
.output_3_ip_flags(output_3_ip_flags),
|
||||
.output_3_ip_fragment_offset(output_3_ip_fragment_offset),
|
||||
.output_3_ip_ttl(output_3_ip_ttl),
|
||||
.output_3_ip_protocol(output_3_ip_protocol),
|
||||
.output_3_ip_header_checksum(output_3_ip_header_checksum),
|
||||
.output_3_ip_source_ip(output_3_ip_source_ip),
|
||||
.output_3_ip_dest_ip(output_3_ip_dest_ip),
|
||||
.output_3_udp_source_port(output_3_udp_source_port),
|
||||
.output_3_udp_dest_port(output_3_udp_dest_port),
|
||||
.output_3_udp_length(output_3_udp_length),
|
||||
.output_3_udp_checksum(output_3_udp_checksum),
|
||||
.output_3_udp_payload_tdata(output_3_udp_payload_tdata),
|
||||
.output_3_udp_payload_tkeep(output_3_udp_payload_tkeep),
|
||||
.output_3_udp_payload_tvalid(output_3_udp_payload_tvalid),
|
||||
.output_3_udp_payload_tready(output_3_udp_payload_tready),
|
||||
.output_3_udp_payload_tlast(output_3_udp_payload_tlast),
|
||||
.output_3_udp_payload_tuser(output_3_udp_payload_tuser),
|
||||
.m_udp_hdr_valid(m_udp_hdr_valid),
|
||||
.m_udp_hdr_ready(m_udp_hdr_ready),
|
||||
.m_eth_dest_mac(m_eth_dest_mac),
|
||||
.m_eth_src_mac(m_eth_src_mac),
|
||||
.m_eth_type(m_eth_type),
|
||||
.m_ip_version(m_ip_version),
|
||||
.m_ip_ihl(m_ip_ihl),
|
||||
.m_ip_dscp(m_ip_dscp),
|
||||
.m_ip_ecn(m_ip_ecn),
|
||||
.m_ip_length(m_ip_length),
|
||||
.m_ip_identification(m_ip_identification),
|
||||
.m_ip_flags(m_ip_flags),
|
||||
.m_ip_fragment_offset(m_ip_fragment_offset),
|
||||
.m_ip_ttl(m_ip_ttl),
|
||||
.m_ip_protocol(m_ip_protocol),
|
||||
.m_ip_header_checksum(m_ip_header_checksum),
|
||||
.m_ip_source_ip(m_ip_source_ip),
|
||||
.m_ip_dest_ip(m_ip_dest_ip),
|
||||
.m_udp_source_port(m_udp_source_port),
|
||||
.m_udp_dest_port(m_udp_dest_port),
|
||||
.m_udp_length(m_udp_length),
|
||||
.m_udp_checksum(m_udp_checksum),
|
||||
.m_udp_payload_axis_tdata(m_udp_payload_axis_tdata),
|
||||
.m_udp_payload_axis_tkeep(m_udp_payload_axis_tkeep),
|
||||
.m_udp_payload_axis_tvalid(m_udp_payload_axis_tvalid),
|
||||
.m_udp_payload_axis_tready(m_udp_payload_axis_tready),
|
||||
.m_udp_payload_axis_tlast(m_udp_payload_axis_tlast),
|
||||
.m_udp_payload_axis_tid(m_udp_payload_axis_tid),
|
||||
.m_udp_payload_axis_tdest(m_udp_payload_axis_tdest),
|
||||
.m_udp_payload_axis_tuser(m_udp_payload_axis_tuser),
|
||||
// Control
|
||||
.enable(enable),
|
||||
.drop(drop),
|
||||
.select(select)
|
||||
);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user