`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company: 
// Engineer: 
// 
// Create Date:    10:02:35 04/20/2020 
// Design Name: 
// Module Name:    PulseGen 
// Project Name: 
// Target Devices: 
// Tool versions: 
// Description: 
//
// Dependencies: 
//
// Revision: 
// Revision 0.01 - File Created
// Additional Comments: 
//
//////////////////////////////////////////////////////////////////////////////////
module	PulseGenTb();	

//================================================================================
//	PARAMETERS
	parameter	CmdRegWidth	=	32;
	
	localparam	[CmdRegWidth-25:0]	ModeBurst	=	8'd4;	
	localparam	[CmdRegWidth-25:0]	ModeCont	=	8'd5;	
	localparam	[CmdRegWidth-25:0]	ModeSingle	=	8'd1;	
	localparam	[CmdRegWidth-25:0]	ModeDouble	=	8'd2;	
	localparam	[CmdRegWidth-25:0]	ModeTripple	=	8'd3;	
	localparam	[CmdRegWidth-25:0]	ModeDisable	=	8'd0;	
	localparam	[CmdRegWidth-1:0]	P1Del_i		=	32'd5;	
	localparam	[CmdRegWidth-1:0]	P2Del_i		=	32'd6;	
	localparam	[CmdRegWidth-1:0]	P3Del_i		=	32'd7;
	
	localparam	[CmdRegWidth-1:0]	P1Width_i	=	32'd1;	
	localparam	[CmdRegWidth-1:0]	P2Width_i	=	32'd1;	
	localparam	[CmdRegWidth-1:0]	P3Width_i	=	32'd1;
	
//================================================================================
//  REG/WIRE
	reg		Clk50;	
	reg		Rst;	
	reg		EnPulse;	
	reg		EnPulseR;	
	reg		OpMode;	
	reg		[CmdRegWidth-1:0]	PulsePeriod;	
	reg		StartMeasEvent;	

	reg		[CmdRegWidth-25:0]	Mode;
//================================================================================
//  ASSIGNMENTS

//================================================================================
//  CODING

	always	#10 Clk50	=	~Clk50;

	initial begin
		Clk50	=	1'b1;
		Rst		=	1'b1;
		OpMode	=	1'b0;
		PulsePeriod		=	32'd0;
		StartMeasEvent	=	1'b0;
		EnPulse	=	1'b0;
		// Mode	=	ModeSingle;
		// Mode	=	ModeDouble;
		Mode	=	ModeTripple;
		// Mode	=	ModeBurst;
		#50
		Rst		=	1'b0;
		PulsePeriod		=	32'd20;
		#20
		EnPulse	=	1'b1;
		#20	
		EnPulse	=	1'b0;
		#100
		StartMeasEvent	=	1'b1;
		#5000
		Mode	=	ModeDisable;
	end	

	always	@(posedge	Clk50)	begin
		EnPulseR	<=	EnPulse;
	end
	
PulseGen	
#(	
	.CmdRegWidth	(32),
	// .GenMode		("GATING")
	.GenMode		("MODULATOR")
)
PulseGenInst
(
	.Rst_i		(Rst),
	.Clk_i		(Clk50),
	.EnPulse_i	(EnPulseR),
	.PulsePol_i	(1'b0),
	.EnEdge_i	(1'b0),
	
	.Mode_i		(Mode),
	.P1Del_i	(P1Del_i),
	.P2Del_i	(P2Del_i),
	.P3Del_i	(P3Del_i),
	.P1Width_i	(P1Width_i),
	.P2Width_i	(P2Width_i),
	.P3Width_i	(P3Width_i),
	
	.Pulse_o	()
);	
endmodule











