/* * Reads transctions from file in Epiphany Memory Format (EMF) and drives * packet output. * * NOTE: wait comes in one next cycle, this block adjusts for that! * */ `timescale 1ns/1ps module stimulus (/*AUTOARG*/ // Outputs stim_access, stim_packet, stim_count, stim_done, stim_wait, // Inputs clk, nreset, start, dut_wait ); //stimulus parameter PW = 32; //size of packet parameter MAW = 15; parameter MD = 1<0) begin mem_access <= 1'b0; wait_counter[15:0] <= wait_counter[15:0] - 1'b1; end //Use to finish simulation assign stim_done = ~dut_wait & (state[1:0]==`DONE); //Removing delay value //assign stim_packet[PW-1:0] = mem_data[PW+16-1: always @ (posedge clk or negedge nreset) if(~nreset) begin stim_packet_reg <= 'b0; stim_access_reg <= 'b0; end else if(~dut_wait) begin stim_packet_reg <= mem_data[PW+16-1:16]; stim_access_reg <= mem_access; end assign stim_packet = dut_wait ? stim_packet_reg : mem_data[PW+16-1:16]; //assign stim_access = dut_wait ? stim_access_reg : mem_access; assign stim_access = dut_wait ? 1'b0 : mem_access; //TODO: Implement //lfsr? //seed from command line? //walk through the waits:0,1,2,3,4,5,6,7,8,16,32,64,128 cycles //randomize where you start in state machine assign stim_wait = stall_random; //Random wait generator //TODO: make this a module generate if(WAIT) begin reg [15:0] stall_counter; always @ (posedge clk or negedge nreset) if(!nreset) stall_counter[15:0] <= 'b0; else stall_counter[15:0] <= stall_counter+1'b1; assign stall_random = (|stall_counter[6:0]);//(|wait_counter[3:0]);//1'b0; end else begin assign stall_random = 1'b0; end // else: !if(WAIT) endgenerate endmodule // stimulus