//------------------------------------------------------
//                                                        
//  File          :  stimuli.sv
//  Related Files :                                                     
//  Author(s)     :  Mueller                              
//  Email         :  muelleral82290@th-nuernberg.de       
//  Organization  :  Georg-Simon-Ohm-Hochschule Nuernberg 
//  Notes         :  Stimuli Modul 
//
//------------------------------------------------------
//                   History    
//------------------------------------------------------
//    Version| Author   | Mod. Date  | Changes Made:
//    v1.00  | Mueller  | 11/05/2023 | first code
//------------------------------------------------------

//interface for LED
//reg [2:0]rbg stores rgb values that depend on dip[3:2]

//interface for DIPSCHALER
// dip[3:2] -> select colour, dip[1] -> read ~ 1/write ~ 0, dip[0] -> on ~ 1/off ~ 0

//interface for FRAM
// sck -> 0 ~ cummonication enabled, 1 ~ communication disabled
// clk -> system clock / timer
// miso -> testbench output
// mosi -> testbench input

//testbenchclock replaces the oscillator on the board

// 27.04.23 -> #delay/#oszillatordelay is not set jet
// 09.06.23 -> removed fram_if.fram_port_stim fram_spi from the stimuli parameters, moved to "fram_module"
// 09.06.23 -> oszillatordelay = 1, delay = 5

`timescale 10ns/10ps

module stimuli(led_if.led_port_stim led_stim, dip_if.dip_port_stim dip_stim, clock_if.clock_port_stim clk_stim);

	// generate oszillator signal for the timer block (clock_if)
	reg oszillator;
	
	initial oszillator = 0;

	always
	begin
		#1 oszillator <= ! oszillator;
		clk_stim.clk <= ! oszillator;
	end
	

	initial
	begin

  /*~~~~toplevel is set to off~~~~~~~~*/
  /*~~~~dip[0] is set to 0~~~~~~~~~~~~*/
			dip_stim.dip = 4'b0000;	
		#500		dip_stim.dip = 4'b0010;
		#500		dip_stim.dip = 4'b0100;
		#500		dip_stim.dip = 4'b0110;
		#500		dip_stim.dip = 4'b1000;
		#500		dip_stim.dip = 4'b1010;
		#500		dip_stim.dip = 4'b1100;
		#500		dip_stim.dip = 4'b1110;
  /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/

  /*~~~~toplevel is set to on~~~~~~~~~*/
  /*~~~~dip[0] is set to 1~~~~~~~~~~~~*/

	/*~~fram is set to write~~~~~~~~*/
    /*~~~~dip[1] is set to 0~~~~~~~~*/
		#800		dip_stim.dip = 4'b0001;
		#2000	dip_stim.dip = 4'b0101;
		#2000	dip_stim.dip = 4'b1001;
		#2000	dip_stim.dip = 4'b1101;
	/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/

	/*~~fram is set to read~~~~~~~~~*/
	/*~~~~dip[1] is set to 1~~~~~~~~*/
		#2000	dip_stim.dip = 4'b0011;
		#2000	dip_stim.dip = 4'b0111;
		#2000	dip_stim.dip = 4'b1011;
		#2000	dip_stim.dip = 4'b1111;
	/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/

  /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/

	end

endmodule : stimuli



