data/full_repos/permissive/531279620/resource/src/tb_usb_pd_top.v
1: b'%Warning-STMTDLY: data/full_repos/permissive/531279620/resource/src/tb_usb_pd_top.v:77: Unsupported: Ignoring delay on this delayed statement.\n  #5.0 clk = ~clk;\n  ^\n                  ... Use "/* verilator lint_off STMTDLY */" and lint_on around source to disable this message.\n%Error: data/full_repos/permissive/531279620/resource/src/tb_usb_pd_top.v:81: Unsupported: fork statements\n  fork begin\n  ^~~~\n%Warning-STMTDLY: data/full_repos/permissive/531279620/resource/src/tb_usb_pd_top.v:83: Unsupported: Ignoring delay on this delayed statement.\n   #0 clk = 1\'b0;\n   ^\n%Warning-STMTDLY: data/full_repos/permissive/531279620/resource/src/tb_usb_pd_top.v:94: Unsupported: Ignoring delay on this delayed statement.\n   #1000 nrst <= 1\'b1;\n   ^\n%Warning-STMTDLY: data/full_repos/permissive/531279620/resource/src/tb_usb_pd_top.v:96: Unsupported: Ignoring delay on this delayed statement.\n   #1234 cc1_io = 1\'b0;\n   ^\n%Warning-STMTDLY: data/full_repos/permissive/531279620/resource/src/tb_usb_pd_top.v:98: Unsupported: Ignoring delay on this delayed statement.\n   #10000 start <= 1\'b1;\n   ^\n%Warning-STMTDLY: data/full_repos/permissive/531279620/resource/src/tb_usb_pd_top.v:101: Unsupported: Ignoring delay on this delayed statement.\n   #10 start <= 1\'b0;\n   ^\n%Warning-STMTDLY: data/full_repos/permissive/531279620/resource/src/tb_usb_pd_top.v:102: Unsupported: Ignoring delay on this delayed statement.\n   #100 start <= 1\'b0;\n   ^\n%Error: data/full_repos/permissive/531279620/resource/src/tb_usb_pd_top.v:104: syntax error, unexpected \'@\'\n   @(!busy)\n   ^\n%Warning-STMTDLY: data/full_repos/permissive/531279620/resource/src/tb_usb_pd_top.v:108: Unsupported: Ignoring delay on this delayed statement.\n   #1530000 send_num = 3\'d0;\n   ^\n%Warning-STMTDLY: data/full_repos/permissive/531279620/resource/src/tb_usb_pd_top.v:111: Unsupported: Ignoring delay on this delayed statement.\n   #10000 start <= 1\'b1;\n   ^\n%Warning-STMTDLY: data/full_repos/permissive/531279620/resource/src/tb_usb_pd_top.v:114: Unsupported: Ignoring delay on this delayed statement.\n   #10 start <= 1\'b0;\n   ^\n%Warning-STMTDLY: data/full_repos/permissive/531279620/resource/src/tb_usb_pd_top.v:116: Unsupported: Ignoring delay on this delayed statement.\n   #1530000 send_num = 3\'d0;\n   ^\n%Warning-STMTDLY: data/full_repos/permissive/531279620/resource/src/tb_usb_pd_top.v:120: Unsupported: Ignoring delay on this delayed statement.\n   #10000 start <= 1\'b1;\n   ^\n%Warning-STMTDLY: data/full_repos/permissive/531279620/resource/src/tb_usb_pd_top.v:123: Unsupported: Ignoring delay on this delayed statement.\n   #10 start <= 1\'b0;\n   ^\n%Warning-STMTDLY: data/full_repos/permissive/531279620/resource/src/tb_usb_pd_top.v:124: Unsupported: Ignoring delay on this delayed statement.\n   #100 start <= 1\'b0;\n   ^\n%Error: data/full_repos/permissive/531279620/resource/src/tb_usb_pd_top.v:126: syntax error, unexpected \'@\'\n   @(!busy)\n   ^\n%Error: Exiting due to 3 error(s), 14 warning(s)\n        ... See the manual and https://verilator.org for more assistance.\n'
module tb_usb_pd_top;

	reg		start;
	
	reg		clk;
	reg		nrst;
	
	reg		cc1_io;
	wire	cc1_dout;
	reg		cc2_io;
	reg		cc2_dout;
	
	wire	cc1;
	wire	cc2;
	
	wire	busy;
	
	reg		cc_dummy;
	
	assign cc1 = (cc1_io) ? cc1_dout : cc_dummy;
	assign cc2 = (cc2_io) ? cc2_dout : 1'b0;
	
	usb_pd_top DUT(
		.sys_nrst	(nrst),
		.sys_clk	(clk),
		
		.usb_pd_cc1	(cc1),
		.usb_pd_cc2	(cc2)
	);
	
	reg		[2 : 0]	send_id;
	reg		[2 : 0]	send_num;
	reg		[3 : 0]	send_type;
	
	usb_pd_phy_wr#(
		.system_khz(100000)
	)sender(
		.nrst			(nrst),
		.clock			(clk),
		
		.hdr_sop_hrst	(1'b0),
		.start			(start),
		.busy			(busy),
		

		.send_num		(send_num),

		.send_type		(send_type),
		.send_id		(send_id),
		
		.send_word0		(32'h0801_912C),
		.send_word1		(32'h0002_D12C),
		.send_word2		(32'h0003_C12C),
		.send_word3		(32'h0004_B12C),
		.send_word4		(32'h0006_4145),
		.send_word5		(32'hC8DC_2164),
		.send_word6		(32'd0),
		
		.bmc_dout		(cc1_dout)
	);
	
	always begin
		#5.0 clk = ~clk;
	end
	
	initial begin
		fork begin
			
			#0 clk = 1'b0;
			nrst = 1'b0;
			start = 1'b0;
			cc1_io = 1'b0;
			cc2_io = 1'b0;
			cc2_dout = 1'b0;
			cc_dummy = 1'b1;
			send_num = 3'd6;
			send_type = 4'd1;
			send_id = 3'd0;
			
			#1000 nrst <= 1'b1;
			
			#1234 cc1_io = 1'b0;
			
			#10000 start <= 1'b1;
			cc1_io = 1'b1;
			
			#10 start <= 1'b0;
			#100 start <= 1'b0;
			
			@(!busy)
				#10 cc1_io = 1'b0;
				cc_dummy = 1'bz;
			
			#1530000 send_num = 3'd0;
			cc_dummy = 1'b1;
			
			#10000 start <= 1'b1;
			cc1_io = 1'b1;
			
			#10 start <= 1'b0;
			
			#1530000 send_num = 3'd0;
			send_type = 4'd3;
			send_id = 3'd1;
			
			#10000 start <= 1'b1;
			cc1_io = 1'b1;
			
			#10 start <= 1'b0;
			#100 start <= 1'b0;
			
			@(!busy)
				#10 cc1_io = 1'b0;
				cc_dummy = 1'bz;
			
			
		end join
	end
	
endmodule
module tb_usb_pd_top;


	reg		start;
	
	reg		clk;
	reg		nrst;
	
	reg		cc1_io;
	wire	cc1_dout;
	reg		cc2_io;
	reg		cc2_dout;
	
	wire	cc1;
	wire	cc2;
	
	wire	busy;
	
	reg		cc_dummy;
	
	assign cc1 = (cc1_io) ? cc1_dout : cc_dummy;
	assign cc2 = (cc2_io) ? cc2_dout : 1'b0;
	
	usb_pd_top DUT(
		.sys_nrst	(nrst),
		.sys_clk	(clk),
		
		.usb_pd_cc1	(cc1),
		.usb_pd_cc2	(cc2)
	);
	
	reg		[2 : 0]	send_id;
	reg		[2 : 0]	send_num;
	reg		[3 : 0]	send_type;
	
	usb_pd_phy_wr#(
		.system_khz(100000)
	)sender(
		.nrst			(nrst),
		.clock			(clk),
		
		.hdr_sop_hrst	(1'b0),
		.start			(start),
		.busy			(busy),
		

		.send_num		(send_num),

		.send_type		(send_type),
		.send_id		(send_id),
		
		.send_word0		(32'h0801_912C),
		.send_word1		(32'h0002_D12C),
		.send_word2		(32'h0003_C12C),
		.send_word3		(32'h0004_B12C),
		.send_word4		(32'h0006_4145),
		.send_word5		(32'hC8DC_2164),
		.send_word6		(32'd0),
		
		.bmc_dout		(cc1_dout)
	);
	
	always begin
		#5.0 clk = ~clk;
	end
	
	initial begin
		fork begin
			
			#0 clk = 1'b0;
			nrst = 1'b0;
			start = 1'b0;
			cc1_io = 1'b0;
			cc2_io = 1'b0;
			cc2_dout = 1'b0;
			cc_dummy = 1'b1;
			send_num = 3'd6;
			send_type = 4'd1;
			send_id = 3'd0;
			
			#1000 nrst <= 1'b1;
			
			#1234 cc1_io = 1'b0;
			
			#10000 start <= 1'b1;
			cc1_io = 1'b1;
			
			#10 start <= 1'b0;
			#100 start <= 1'b0;
			
			@(!busy)
				#10 cc1_io = 1'b0;
				cc_dummy = 1'bz;
			
			#1530000 send_num = 3'd0;
			cc_dummy = 1'b1;
			
			#10000 start <= 1'b1;
			cc1_io = 1'b1;
			
			#10 start <= 1'b0;
			
			#1530000 send_num = 3'd0;
			send_type = 4'd3;
			send_id = 3'd1;
			
			#10000 start <= 1'b1;
			cc1_io = 1'b1;
			
			#10 start <= 1'b0;
			#100 start <= 1'b0;
			
			@(!busy)
				#10 cc1_io = 1'b0;
				cc_dummy = 1'bz;
			
			
		end join
	end
	
endmodule