// Test fixture that sends a data stream to the FIFO // We generate a pseudo-random string of data according // to a seed. We also generate DataValids at a random // rate according to a second seed. `timescale 1ns / 1ns module fifo_out_tf(/*AUTOARG*/ // Outputs dataValid, data_out, // Inputs clk, reset, takingData ); parameter WIDTH = 32; parameter DATASEED = 187; // Must match fifo_in_tf parameter TESTLENGTH = 10000; // Generate this much data // We generate DataValid RATE/128 % of the time parameter RATE = 70; parameter LASTDATA = 0; // Marks last data sent input clk; input reset; output dataValid; input takingData; output [WIDTH-1:0] data_out; /*AUTOREG*/ // Beginning of automatic regs (for this module's undeclared outputs) reg dataValid; reg [WIDTH-1:0] data_out; // End of automatics reg [15:0] test_count; always @(posedge clk) begin if (reset) begin test_count <= 0; data_out <= DATASEED; dataValid = 0; end else begin if (dataValid & takingData) begin test_count <= test_count + 1; if (test_count >= TESTLENGTH) begin data_out <= LASTDATA; end else begin data_out <= data_out*1234567 + 98765; end end // Set dataValid for the next cycle dataValid <= (($random & 127) < RATE); end end endmodule // fifo_in_tf