data/full_repos/permissive/168753118/testbench/modules/FWD/FWD_tb.v
1: b'%Warning-STMTDLY: data/full_repos/permissive/168753118/testbench/modules/FWD/FWD_tb.v:99: Unsupported: Ignoring delay on this delayed statement.\n    #period;\n    ^\n                  ... Use "/* verilator lint_off STMTDLY */" and lint_on around source to disable this message.\n%Error: data/full_repos/permissive/168753118/testbench/modules/FWD/FWD_tb.v:123: syntax error, unexpected \'@\'\n   @eachvec;\n   ^\n%Error: Exiting due to 1 error(s), 1 warning(s)\n        ... See the manual and https://verilator.org for more assistance.\n'
module FWD_tb;


	parameter XLEN = 32;


	reg eachvec;


	reg [4:0] fwd_if_ra_addr_in;
  reg [4:0] fwd_if_rb_addr_in;
  reg [4:0] fwd_id_rd_addr_in;


	reg [1:0] fwd_mux_sel_golden;


	reg fwd_mux_sel_result;


	wire [1:0] fwd_mux_sel_out;


	localparam period = 5;


	integer golden, inputs, results, status;


	FORWARDING_UNIT fwd0 (
    .fwd_if_ra_addr_in(fwd_if_ra_addr_in),
    .fwd_if_rb_addr_in(fwd_if_rb_addr_in),
    .fwd_id_rd_addr_in(fwd_id_rd_addr_in),
    .fwd_mux_sel_out(fwd_mux_sel_out)
	);


	initial begin


			$display("Opening golden file");
			golden = $fopen("./out/FWD_outputs.txt", "r");


			$display("Opening inputs file");
			inputs = $fopen("./out/FWD_inputs.txt", "r");


			$display("Opening results file");
			results = $fopen("./out/FWD_results.txt", "w");


			if (golden == `NULL) begin
				$display("Golden file was NULL");
				$finish;
			end


			if(inputs == `NULL) begin
				$display("Inputs file was NULL");
			end


			if(results == `NULL) begin
				$display("Results file was NULL");
			end


			while(!$feof(inputs)) begin


				status = $fscanf(
					inputs,
					"%d %d %d",
					fwd_if_ra_addr_in,
					fwd_if_rb_addr_in,
					fwd_id_rd_addr_in
				);


				status = $fscanf(
					golden,
					"%d",
					fwd_mux_sel_golden
				);


				#period;


				if (fwd_mux_sel_out == fwd_mux_sel_golden)
					fwd_mux_sel_result = 1'b1;
				else begin
					fwd_mux_sel_result = 1'b0;
				end


				$fwrite(
					results,
					"%d\n",
					fwd_mux_sel_result
				);

			end

			$display("Simulation has ended");

			$fclose(golden);
			$fclose(inputs);
			$fclose(results);

			@eachvec;
			$finish;

		end
endmodule
module FWD_tb;



	parameter XLEN = 32;


	reg eachvec;


	reg [4:0] fwd_if_ra_addr_in;
  reg [4:0] fwd_if_rb_addr_in;
  reg [4:0] fwd_id_rd_addr_in;


	reg [1:0] fwd_mux_sel_golden;


	reg fwd_mux_sel_result;


	wire [1:0] fwd_mux_sel_out;


	localparam period = 5;


	integer golden, inputs, results, status;


	FORWARDING_UNIT fwd0 (
    .fwd_if_ra_addr_in(fwd_if_ra_addr_in),
    .fwd_if_rb_addr_in(fwd_if_rb_addr_in),
    .fwd_id_rd_addr_in(fwd_id_rd_addr_in),
    .fwd_mux_sel_out(fwd_mux_sel_out)
	);


	initial begin


			$display("Opening golden file");
			golden = $fopen("./out/FWD_outputs.txt", "r");


			$display("Opening inputs file");
			inputs = $fopen("./out/FWD_inputs.txt", "r");


			$display("Opening results file");
			results = $fopen("./out/FWD_results.txt", "w");


			if (golden == `NULL) begin
				$display("Golden file was NULL");
				$finish;
			end


			if(inputs == `NULL) begin
				$display("Inputs file was NULL");
			end


			if(results == `NULL) begin
				$display("Results file was NULL");
			end


			while(!$feof(inputs)) begin


				status = $fscanf(
					inputs,
					"%d %d %d",
					fwd_if_ra_addr_in,
					fwd_if_rb_addr_in,
					fwd_id_rd_addr_in
				);


				status = $fscanf(
					golden,
					"%d",
					fwd_mux_sel_golden
				);


				#period;


				if (fwd_mux_sel_out == fwd_mux_sel_golden)
					fwd_mux_sel_result = 1'b1;
				else begin
					fwd_mux_sel_result = 1'b0;
				end


				$fwrite(
					results,
					"%d\n",
					fwd_mux_sel_result
				);

			end

			$display("Simulation has ended");

			$fclose(golden);
			$fclose(inputs);
			$fclose(results);

			@eachvec;
			$finish;

		end
endmodule