data/full_repos/permissive/154223629/opsg_tb.v
 line:73: before: "("
1: b'%Warning-STMTDLY: data/full_repos/permissive/154223629/opsg_tb.v:54: Unsupported: Ignoring delay on this delayed statement.\n   #4 n_wr = 1\'b1;\n   ^\n                  ... Use "/* verilator lint_off STMTDLY */" and lint_on around source to disable this message.\n%Warning-STMTDLY: data/full_repos/permissive/154223629/opsg_tb.v:55: Unsupported: Ignoring delay on this delayed statement.\n   #2 data = 8\'hFF;\n   ^\n%Warning-STMTDLY: data/full_repos/permissive/154223629/opsg_tb.v:59: Unsupported: Ignoring delay on this delayed statement.\n always #2 clk = !clk;\n        ^\n%Error: data/full_repos/permissive/154223629/opsg_tb.v:62: Unsupported or unknown PLI call: $dumpfile\n  $dumpfile("dump.vcd");\n  ^~~~~~~~~\n%Error: data/full_repos/permissive/154223629/opsg_tb.v:63: Unsupported or unknown PLI call: $dumpvars\n  $dumpvars(1);\n  ^~~~~~~~~\n%Warning-STMTDLY: data/full_repos/permissive/154223629/opsg_tb.v:70: Unsupported: Ignoring delay on this delayed statement.\n  #10 n_rst = 1;\n  ^\n%Warning-STMTDLY: data/full_repos/permissive/154223629/opsg_tb.v:73: Unsupported: Ignoring delay on this delayed statement.\n  #100 write_psg(8\'b10000011);\n  ^\n%Warning-STMTDLY: data/full_repos/permissive/154223629/opsg_tb.v:74: Unsupported: Ignoring delay on this delayed statement.\n  #100 write_psg(8\'b10100100);\n  ^\n%Warning-STMTDLY: data/full_repos/permissive/154223629/opsg_tb.v:75: Unsupported: Ignoring delay on this delayed statement.\n  #100 write_psg(8\'b11001000);\n  ^\n%Warning-STMTDLY: data/full_repos/permissive/154223629/opsg_tb.v:78: Unsupported: Ignoring delay on this delayed statement.\n  #100 write_psg(8\'b10010000);\n  ^\n%Warning-STMTDLY: data/full_repos/permissive/154223629/opsg_tb.v:84: Unsupported: Ignoring delay on this delayed statement.\n  #1000\n  ^\n%Warning-STMTDLY: data/full_repos/permissive/154223629/opsg_tb.v:92: Unsupported: Ignoring delay on this delayed statement.\n  #100 write_psg(8\'b10010000);\n  ^\n%Warning-STMTDLY: data/full_repos/permissive/154223629/opsg_tb.v:89: Unsupported: Ignoring delay on this delayed statement.\n  #10000\n  ^\n%Warning-STMTDLY: data/full_repos/permissive/154223629/opsg_tb.v:93: Unsupported: Ignoring delay on this delayed statement.\n  #100 write_psg(8\'b10110001);\n  ^\n%Warning-STMTDLY: data/full_repos/permissive/154223629/opsg_tb.v:94: Unsupported: Ignoring delay on this delayed statement.\n  #100 write_psg(8\'b11010010);\n  ^\n%Warning-STMTDLY: data/full_repos/permissive/154223629/opsg_tb.v:95: Unsupported: Ignoring delay on this delayed statement.\n  #100 write_psg(8\'b11110011);\n  ^\n%Warning-STMTDLY: data/full_repos/permissive/154223629/opsg_tb.v:96: Unsupported: Ignoring delay on this delayed statement.\n  #100 write_psg(8\'b10010100);\n  ^\n%Warning-STMTDLY: data/full_repos/permissive/154223629/opsg_tb.v:97: Unsupported: Ignoring delay on this delayed statement.\n  #100 write_psg(8\'b10110101);\n  ^\n%Warning-STMTDLY: data/full_repos/permissive/154223629/opsg_tb.v:98: Unsupported: Ignoring delay on this delayed statement.\n  #100 write_psg(8\'b11010110);\n  ^\n%Warning-STMTDLY: data/full_repos/permissive/154223629/opsg_tb.v:99: Unsupported: Ignoring delay on this delayed statement.\n  #100 write_psg(8\'b11110111);\n  ^\n%Warning-STMTDLY: data/full_repos/permissive/154223629/opsg_tb.v:101: Unsupported: Ignoring delay on this delayed statement.\n  #100 write_psg(8\'b10011000);\n  ^\n%Warning-STMTDLY: data/full_repos/permissive/154223629/opsg_tb.v:102: Unsupported: Ignoring delay on this delayed statement.\n  #100 write_psg(8\'b10111001);\n  ^\n%Warning-STMTDLY: data/full_repos/permissive/154223629/opsg_tb.v:103: Unsupported: Ignoring delay on this delayed statement.\n  #100 write_psg(8\'b11011010);\n  ^\n%Warning-STMTDLY: data/full_repos/permissive/154223629/opsg_tb.v:104: Unsupported: Ignoring delay on this delayed statement.\n  #100 write_psg(8\'b11111011);\n  ^\n%Warning-STMTDLY: data/full_repos/permissive/154223629/opsg_tb.v:105: Unsupported: Ignoring delay on this delayed statement.\n  #100 write_psg(8\'b10011100);\n  ^\n%Warning-STMTDLY: data/full_repos/permissive/154223629/opsg_tb.v:106: Unsupported: Ignoring delay on this delayed statement.\n  #100 write_psg(8\'b10111101);\n  ^\n%Warning-STMTDLY: data/full_repos/permissive/154223629/opsg_tb.v:107: Unsupported: Ignoring delay on this delayed statement.\n  #100 write_psg(8\'b11011110);\n  ^\n%Warning-STMTDLY: data/full_repos/permissive/154223629/opsg_tb.v:108: Unsupported: Ignoring delay on this delayed statement.\n  #100 write_psg(8\'b11111111);\n  ^\n%Warning-STMTDLY: data/full_repos/permissive/154223629/opsg_tb.v:111: Unsupported: Ignoring delay on this delayed statement.\n  #100 write_psg(8\'b10010000);\n  ^\n%Warning-STMTDLY: data/full_repos/permissive/154223629/opsg_tb.v:112: Unsupported: Ignoring delay on this delayed statement.\n  #100 write_psg(8\'b10110000);\n  ^\n%Warning-STMTDLY: data/full_repos/permissive/154223629/opsg_tb.v:113: Unsupported: Ignoring delay on this delayed statement.\n  #100 write_psg(8\'b11010000);\n  ^\n%Warning-STMTDLY: data/full_repos/permissive/154223629/opsg_tb.v:114: Unsupported: Ignoring delay on this delayed statement.\n  #100 write_psg(8\'b11110000);\n  ^\n%Warning-STMTDLY: data/full_repos/permissive/154223629/opsg_tb.v:117: Unsupported: Ignoring delay on this delayed statement.\n  #1000\n  ^\n%Warning-STMTDLY: data/full_repos/permissive/154223629/opsg_tb.v:120: Unsupported: Ignoring delay on this delayed statement.\n  #100\n  ^\n%Warning-STMTDLY: data/full_repos/permissive/154223629/opsg_tb.v:123: Unsupported: Ignoring delay on this delayed statement.\n  #100\n  ^\n%Warning-STMTDLY: data/full_repos/permissive/154223629/opsg_tb.v:128: Unsupported: Ignoring delay on this delayed statement.\n  #20000\n  ^\n%Warning-STMTDLY: data/full_repos/permissive/154223629/opsg_tb.v:130: Unsupported: Ignoring delay on this delayed statement.\n  #80000\n  ^\n%Warning-STMTDLY: data/full_repos/permissive/154223629/opsg_tb.v:132: Unsupported: Ignoring delay on this delayed statement.\n  #80000\n  ^\n%Warning-STMTDLY: data/full_repos/permissive/154223629/opsg_tb.v:134: Unsupported: Ignoring delay on this delayed statement.\n  #80000\n  ^\n%Warning-STMTDLY: data/full_repos/permissive/154223629/opsg_tb.v:141: Unsupported: Ignoring delay on this delayed statement.\n  #80000 $finish;\n  ^\n%Error: Exiting due to 2 error(s), 38 warning(s)\n        ... See the manual and https://verilator.org for more assistance.\n'
module test;
  
	reg clk, n_rst, n_wr;
	reg [7:0] data;
	wire ch1, ch2, ch3, ch4;
	wire [3:0] audio_bits;
	wire [15:0] audio_left;
	wire [15:0] audio_right;
  


	opsg #(.MAX_VOLUME(2048), .CLK_DIV(1)) opsg_test(
		.clk(clk),
		.n_rst(n_rst),
		.n_wr(n_wr),
		.data(data),
		.ch1(ch1),
		.ch2(ch2),
		.ch3(ch3),
		.ch4(ch4),
		.audio_left(audio_left),
		.audio_right(audio_right)
	);
  

	task write_psg;
		input [7:0] value;
		begin
			data = value;
			n_wr = 1'b0;
			#4 n_wr = 1'b1;
			#2 data = 8'hFF;
		end
	endtask
  
	always #2 clk = !clk;

	initial begin
		$dumpfile("dump.vcd");
		$dumpvars(1);
		
		clk = 0;
		n_rst = 0;
		n_wr = 1;
		data = 8'hFF;
		
		#10 n_rst = 1;


		#100 write_psg(8'b10000011);
		#100 write_psg(8'b10100100);
		#100 write_psg(8'b11001000);
		

		#100 write_psg(8'b10010000);
		write_psg(8'b10111111);
		write_psg(8'b11011111);
		write_psg(8'b11111111);
		

		#1000
		write_psg(8'b10011010);
		write_psg(8'b10111010);
		write_psg(8'b11011010);
		write_psg(8'b11111010);
		#10000
		

		#100 write_psg(8'b10010000);
		#100 write_psg(8'b10110001);
		#100 write_psg(8'b11010010);
		#100 write_psg(8'b11110011);
		#100 write_psg(8'b10010100);
		#100 write_psg(8'b10110101);
		#100 write_psg(8'b11010110);
		#100 write_psg(8'b11110111);
		
		#100 write_psg(8'b10011000);
		#100 write_psg(8'b10111001);
		#100 write_psg(8'b11011010);
		#100 write_psg(8'b11111011);
		#100 write_psg(8'b10011100);
		#100 write_psg(8'b10111101);
		#100 write_psg(8'b11011110);
		#100 write_psg(8'b11111111);
		

		#100 write_psg(8'b10010000);
		#100 write_psg(8'b10110000);
		#100 write_psg(8'b11010000);
		#100 write_psg(8'b11110000);
		

		#1000
		write_psg(8'b10000000);
		write_psg(8'b00000011);
		#100
		write_psg(8'b10100000);
		write_psg(8'b00100110);
		#100
		write_psg(8'b11000000);
		write_psg(8'b01001000);
		

		#20000
		write_psg(8'b11100101);
		#80000
		write_psg(8'b11100100);
		#80000
		write_psg(8'b11100000);
		#80000
		

		write_psg(8'b11000100);
		write_psg(8'b01000000);
		write_psg(8'b11100011);
		
		#80000 $finish;
	end
  
endmodule
module test;

  
	reg clk, n_rst, n_wr;
	reg [7:0] data;
	wire ch1, ch2, ch3, ch4;
	wire [3:0] audio_bits;
	wire [15:0] audio_left;
	wire [15:0] audio_right;
  


	opsg #(.MAX_VOLUME(2048), .CLK_DIV(1)) opsg_test(
		.clk(clk),
		.n_rst(n_rst),
		.n_wr(n_wr),
		.data(data),
		.ch1(ch1),
		.ch2(ch2),
		.ch3(ch3),
		.ch4(ch4),
		.audio_left(audio_left),
		.audio_right(audio_right)
	);
  

	task write_psg;
		input [7:0] value;
		begin
			data = value;
			n_wr = 1'b0;
			#4 n_wr = 1'b1;
			#2 data = 8'hFF;
		end
	endtask
  
	always #2 clk = !clk;

	initial begin
		$dumpfile("dump.vcd");
		$dumpvars(1);
		
		clk = 0;
		n_rst = 0;
		n_wr = 1;
		data = 8'hFF;
		
		#10 n_rst = 1;


		#100 write_psg(8'b10000011);
		#100 write_psg(8'b10100100);
		#100 write_psg(8'b11001000);
		

		#100 write_psg(8'b10010000);
		write_psg(8'b10111111);
		write_psg(8'b11011111);
		write_psg(8'b11111111);
		

		#1000
		write_psg(8'b10011010);
		write_psg(8'b10111010);
		write_psg(8'b11011010);
		write_psg(8'b11111010);
		#10000
		

		#100 write_psg(8'b10010000);
		#100 write_psg(8'b10110001);
		#100 write_psg(8'b11010010);
		#100 write_psg(8'b11110011);
		#100 write_psg(8'b10010100);
		#100 write_psg(8'b10110101);
		#100 write_psg(8'b11010110);
		#100 write_psg(8'b11110111);
		
		#100 write_psg(8'b10011000);
		#100 write_psg(8'b10111001);
		#100 write_psg(8'b11011010);
		#100 write_psg(8'b11111011);
		#100 write_psg(8'b10011100);
		#100 write_psg(8'b10111101);
		#100 write_psg(8'b11011110);
		#100 write_psg(8'b11111111);
		

		#100 write_psg(8'b10010000);
		#100 write_psg(8'b10110000);
		#100 write_psg(8'b11010000);
		#100 write_psg(8'b11110000);
		

		#1000
		write_psg(8'b10000000);
		write_psg(8'b00000011);
		#100
		write_psg(8'b10100000);
		write_psg(8'b00100110);
		#100
		write_psg(8'b11000000);
		write_psg(8'b01001000);
		

		#20000
		write_psg(8'b11100101);
		#80000
		write_psg(8'b11100100);
		#80000
		write_psg(8'b11100000);
		#80000
		

		write_psg(8'b11000100);
		write_psg(8'b01000000);
		write_psg(8'b11100011);
		
		#80000 $finish;
	end
  
endmodule