diff --git a/Makefile b/Makefile index fa504fc..83998f8 100644 --- a/Makefile +++ b/Makefile @@ -14,7 +14,7 @@ clean: prog: pixelflut.bit openFPGALoader -b arty_a7_35t $< -sim: dvi_tb.vcd +sim: dvi_tb.vcd pingxelflut_tb.vcd pixelflut.bit: pixelflut.frames xc7frames2bit --part_file "$(XRAY_DATABASE_DIR)/artix7/$(PART)/part.yaml" --part_name $(PART) --frm_file $< --output_file $@ @@ -33,3 +33,9 @@ dvi_tb.vcd: dvi_tb.vvp dvi_tb.vvp: dvi_tb.v dvi.v iverilog -o $@ $^ + +pingxelflut_tb.vcd: pingxelflut_tb.vvp + vvp $< + +pingxelflut_tb.vvp: pingxelflut_tb.v pingxelflut.v + iverilog -o $@ $^ diff --git a/pingxelflut.v b/pingxelflut.v index a83bd9b..6792abd 100644 --- a/pingxelflut.v +++ b/pingxelflut.v @@ -1,7 +1,7 @@ module pingxelflut #( parameter MAC_ADDRESS = 48'h02_00_00_00_00_00, - parameter SCREEN_WIDTH = 346, + parameter SCREEN_WIDTH = 346 ) ( input rx_clk, input [3:0] rxd, @@ -11,7 +11,7 @@ module pingxelflut #( output reg bus_clk, output reg [15:0] bus_data, output reg [23:0] bus_addr, - output reg [1:0] bus_sel, + output reg [1:0] bus_sel ); localparam PREAMBLE = 7'b0000000; localparam DEST_0 = 7'b0000001; diff --git a/pingxelflut_state.txt b/pingxelflut_state.txt new file mode 100644 index 0000000..44acadc --- /dev/null +++ b/pingxelflut_state.txt @@ -0,0 +1,64 @@ +0000000 PREAMBLE +0000001 DEST_0 +0000010 DEST_1 +0000011 DEST_2 +0000100 DEST_3 +0000101 DEST_4 +0000110 DEST_5 +0000111 DEST_6 +0001000 DEST_7 +0001001 DEST_8 +0001010 DEST_9 +0001011 DEST_A +0001100 DEST_B +0001101 SRC_0 +0001110 SRC_1 +0001111 SRC_2 +0010000 SRC_3 +0010001 SRC_4 +0010010 SRC_5 +0010011 SRC_6 +0010100 SRC_7 +0010101 SRC_8 +0010110 SRC_9 +0010111 SRC_A +0011000 SRC_B +0011001 ETHER_TYPE_0 +0011010 ETHER_TYPE_1 +0011011 ETHER_TYPE_2 +0011100 ETHER_TYPE_3 +0100000 TRAFFIC_CLASS_0 +0100001 VERSION +0100010 FLOW_LABEL_0 +0100011 TRAFFIC_CLASS_1 +0100100 FLOW_LABEL_1 +0100101 FLOW_LABEL_2 +0100110 FLOW_LABEL_3 +0100111 FLOW_LABEL_4 +0101000 PAYLOAD_LENGTH_0 +0101001 PAYLOAD_LENGTH_1 +0101010 PAYLOAD_LENGTH_2 +0101011 PAYLOAD_LENGTH_3 +0101100 NEXT_HEADER_0 +0101101 NEXT_HEADER_1 +0101110 HOP_LIMIT_0 +0101111 HOP_LIMIT_1 +0110000 SRC_ADDR_0 +1010000 DEST_PREFIX_0 +1100000 X_0 +1100001 X_1 +1100010 X_2 +1100011 X_3 +1100100 Y_0 +1100101 Y_1 +1100110 Y_2 +1100111 Y_3 +1101000 RED_LOW +1101001 RED_HIGH +1101010 GREEN_LOW +1101011 GREEN_HIGH +1101100 BLUE_LOW +1101101 BLUE_HIGH +1101110 PADDING_LOW +1101111 PADDING_HIGH +1111111 IGNORE diff --git a/pingxelflut_tb.hex b/pingxelflut_tb.hex new file mode 100644 index 0000000..ce8d1fa --- /dev/null +++ b/pingxelflut_tb.hex @@ -0,0 +1,129 @@ +d +2 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +6 +8 +d +d +0 +6 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +c +f +0 +0 +3 +2 +2 +4 +0 +0 +0 +0 +0 +0 +0 +0 +f +f +f +f +f +f +f +f +0 +0 +0 +0 +0 +0 +1 +0 +c +f +0 +0 +3 +2 +2 +4 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +f +0 +0 +0 +f +0 +f +f +0 +0 +f +f +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 diff --git a/pingxelflut_tb.v b/pingxelflut_tb.v new file mode 100644 index 0000000..920a5d4 --- /dev/null +++ b/pingxelflut_tb.v @@ -0,0 +1,42 @@ +`timescale 1 ns / 1 ns + +module testbench(); + reg clk = 0; + + always #20 clk = ~clk; + + reg [3:0] rxd; + + wire bus_clk; + wire [15:0] bus_data; + wire [23:0] bus_addr; + wire [1:0] bus_sel; + + pingxelflut eth ( + .rx_clk (clk), + .rxd (rxd), + .rx_dv (1'b1), + .rx_er (1'b0), + + .bus_clk (bus_clk), + .bus_data(bus_data), + .bus_addr(bus_addr), + .bus_sel (bus_sel) + ); + + reg [3:0] test_data [0:128]; + + initial begin + $dumpfile("pingxelflut_tb.vcd"); + $dumpvars(0, testbench); + + $readmemh("pingxelflut_tb.hex", test_data); + + rxd <= test_data[0]; + #10; + for (integer i = 1; i < 129; i = i + 1) #40 rxd <= test_data[i]; + + $finish; + end +endmodule +