data/full_repos/permissive/105681119/src/control_unit.v
1: b'%Error: data/full_repos/permissive/105681119/src/control_unit.v:42: Cannot find include file: definition.v\n`include "definition.v" \n         ^~~~~~~~~~~~~~\n        ... Looked in:\n             data/full_repos/permissive/105681119/src,data/full_repos/permissive/105681119/definition.v\n             data/full_repos/permissive/105681119/src,data/full_repos/permissive/105681119/definition.v.v\n             data/full_repos/permissive/105681119/src,data/full_repos/permissive/105681119/definition.v.sv\n             definition.v\n             definition.v.v\n             definition.v.sv\n             obj_dir/definition.v\n             obj_dir/definition.v.v\n             obj_dir/definition.v.sv\n%Error: data/full_repos/permissive/105681119/src/control_unit.v:47: Define or directive not defined: \'`ALU_FUNCT_INDEX_LIMIT\'\n input [`ALU_FUNCT_INDEX_LIMIT:0] OPCODE, FUNCT;\n        ^~~~~~~~~~~~~~~~~~~~~~\n%Error: data/full_repos/permissive/105681119/src/control_unit.v:47: syntax error, unexpected \':\', expecting TYPE-IDENTIFIER\n input [`ALU_FUNCT_INDEX_LIMIT:0] OPCODE, FUNCT;\n                              ^\n%Error: data/full_repos/permissive/105681119/src/control_unit.v:49: Define or directive not defined: \'`DATA_INDEX_LIMIT\'\n input [`DATA_INDEX_LIMIT:0] DATA_R1, DATA_R2;\n        ^~~~~~~~~~~~~~~~~\n%Error: data/full_repos/permissive/105681119/src/control_unit.v:49: syntax error, unexpected \':\', expecting TYPE-IDENTIFIER\n input [`DATA_INDEX_LIMIT:0] DATA_R1, DATA_R2;\n                         ^\n%Error: data/full_repos/permissive/105681119/src/control_unit.v:53: Define or directive not defined: \'`DATA_INDEX_LIMIT\'\n output reg [`DATA_INDEX_LIMIT:0] ALU_OP1, ALU_OP2;\n             ^~~~~~~~~~~~~~~~~\n%Error: data/full_repos/permissive/105681119/src/control_unit.v:53: syntax error, unexpected \':\', expecting TYPE-IDENTIFIER\n output reg [`DATA_INDEX_LIMIT:0] ALU_OP1, ALU_OP2;\n                              ^\n%Error: data/full_repos/permissive/105681119/src/control_unit.v:54: Define or directive not defined: \'`ALU_FUNCT_INDEX_LIMIT\'\n output reg [`ALU_FUNCT_INDEX_LIMIT:0] ALU_CODE;\n             ^~~~~~~~~~~~~~~~~~~~~~\n%Error: data/full_repos/permissive/105681119/src/control_unit.v:54: syntax error, unexpected \':\', expecting TYPE-IDENTIFIER\n output reg [`ALU_FUNCT_INDEX_LIMIT:0] ALU_CODE;\n                                   ^\n%Error: data/full_repos/permissive/105681119/src/control_unit.v:61: Define or directive not defined: \'`STATE_IDLE\'\n  state = `STATE_IDLE;\n          ^~~~~~~~~~~\n%Error: data/full_repos/permissive/105681119/src/control_unit.v:61: syntax error, unexpected \';\', expecting TYPE-IDENTIFIER\n  state = `STATE_IDLE;\n                     ^\n%Error: data/full_repos/permissive/105681119/src/control_unit.v:67: Define or directive not defined: \'`STATE_FETCH\'\n   state = `STATE_FETCH;\n           ^~~~~~~~~~~~\n%Error: data/full_repos/permissive/105681119/src/control_unit.v:67: syntax error, unexpected \';\', expecting TYPE-IDENTIFIER\n   state = `STATE_FETCH;\n                       ^\n%Error: data/full_repos/permissive/105681119/src/control_unit.v:72: Define or directive not defined: \'`STATE_FETCH\'\n    `STATE_FETCH: begin\n    ^~~~~~~~~~~~\n%Error: data/full_repos/permissive/105681119/src/control_unit.v:72: syntax error, unexpected \':\', expecting endcase\n    `STATE_FETCH: begin\n                ^\n%Error: data/full_repos/permissive/105681119/src/control_unit.v:73: Define or directive not defined: \'`NOP\'\n     if (OPCODE !== `NOP) begin \n                    ^~~~\n%Error: data/full_repos/permissive/105681119/src/control_unit.v:74: Define or directive not defined: \'`STATE_DECODE\'\n      state = `STATE_DECODE;\n              ^~~~~~~~~~~~~\n%Error: data/full_repos/permissive/105681119/src/control_unit.v:80: Define or directive not defined: \'`STATE_DECODE\'\n    `STATE_DECODE: begin\n    ^~~~~~~~~~~~~\n%Error: data/full_repos/permissive/105681119/src/control_unit.v:80: syntax error, unexpected begin, expecting IDENTIFIER or PACKAGE-IDENTIFIER or TYPE-IDENTIFIER or new\n    `STATE_DECODE: begin\n                   ^~~~~\n%Error: data/full_repos/permissive/105681119/src/control_unit.v:81: Define or directive not defined: \'`STATE_EXECUTE\'\n     state = `STATE_EXECUTE;\n             ^~~~~~~~~~~~~~\n%Error: data/full_repos/permissive/105681119/src/control_unit.v:83: Define or directive not defined: \'`ALU_FUNCT_WIDTH\'\n     ALU_OP2 = ((FUNCT === `ALU_FUNCT_WIDTH\'h01) || \n                           ^~~~~~~~~~~~~~~~\n%Error: data/full_repos/permissive/105681119/src/control_unit.v:84: Define or directive not defined: \'`ALU_FUNCT_WIDTH\'\n          (FUNCT === `ALU_FUNCT_WIDTH\'h02)) ? SHAMT : DATA_R2;\n                     ^~~~~~~~~~~~~~~~\n%Error: data/full_repos/permissive/105681119/src/control_unit.v:88: Define or directive not defined: \'`STATE_EXECUTE\'\n    `STATE_EXECUTE: begin\n    ^~~~~~~~~~~~~~\n%Error: data/full_repos/permissive/105681119/src/control_unit.v:88: syntax error, unexpected begin, expecting IDENTIFIER or PACKAGE-IDENTIFIER or TYPE-IDENTIFIER or new\n    `STATE_EXECUTE: begin\n                    ^~~~~\n%Error: data/full_repos/permissive/105681119/src/control_unit.v:89: Define or directive not defined: \'`STATE_IDLE\'\n     state = `STATE_IDLE;\n             ^~~~~~~~~~~\n%Error: data/full_repos/permissive/105681119/src/control_unit.v:94: syntax error, unexpected \':\', expecting clocking\n    default: ;  \n           ^\n%Error: Cannot continue\n'
module CONTROL_UNIT(OPCODE, FUNCT, SHAMT, DATA_R1, DATA_R2, CLK, RST,
					ALU_OP1, ALU_OP2, ALU_CODE, RF_READ, RF_WRITE);

	input [`ALU_FUNCT_INDEX_LIMIT:0] OPCODE, FUNCT;
	input [4:0] SHAMT;
	input [`DATA_INDEX_LIMIT:0] DATA_R1, DATA_R2;
	input CLK, RST;


	output reg [`DATA_INDEX_LIMIT:0] ALU_OP1, ALU_OP2;
	output reg [`ALU_FUNCT_INDEX_LIMIT:0] ALU_CODE;
	output reg RF_READ, RF_WRITE;


	reg [1:0] state;

	initial begin
		state = `STATE_IDLE;
	end

	always @ (negedge RST or posedge CLK) begin

		if (RST === 1'b0) begin
			state = `STATE_FETCH;
		end 
		else begin
			case (state)

				`STATE_FETCH: begin
					if (OPCODE !== `NOP) begin 
						state = `STATE_DECODE;
						RF_READ = 1'b1;
						RF_WRITE = 1'b0;
					end
				end

				`STATE_DECODE: begin
					state = `STATE_EXECUTE;
					ALU_OP1 = DATA_R1;
					ALU_OP2 = ((FUNCT === `ALU_FUNCT_WIDTH'h01) || 
							   (FUNCT === `ALU_FUNCT_WIDTH'h02)) ? SHAMT : DATA_R2;
					ALU_CODE = FUNCT;	
				end

				`STATE_EXECUTE:	begin
					state = `STATE_IDLE;
					RF_READ = 1'b0;
					RF_WRITE = 1'b1;
				end

				default: ;
			endcase
		end
	end
endmodule
module CONTROL_UNIT(OPCODE, FUNCT, SHAMT, DATA_R1, DATA_R2, CLK, RST,
					ALU_OP1, ALU_OP2, ALU_CODE, RF_READ, RF_WRITE);


	input [`ALU_FUNCT_INDEX_LIMIT:0] OPCODE, FUNCT;
	input [4:0] SHAMT;
	input [`DATA_INDEX_LIMIT:0] DATA_R1, DATA_R2;
	input CLK, RST;


	output reg [`DATA_INDEX_LIMIT:0] ALU_OP1, ALU_OP2;
	output reg [`ALU_FUNCT_INDEX_LIMIT:0] ALU_CODE;
	output reg RF_READ, RF_WRITE;


	reg [1:0] state;

	initial begin
		state = `STATE_IDLE;
	end

	always @ (negedge RST or posedge CLK) begin

		if (RST === 1'b0) begin
			state = `STATE_FETCH;
		end 
		else begin
			case (state)

				`STATE_FETCH: begin
					if (OPCODE !== `NOP) begin 
						state = `STATE_DECODE;
						RF_READ = 1'b1;
						RF_WRITE = 1'b0;
					end
				end

				`STATE_DECODE: begin
					state = `STATE_EXECUTE;
					ALU_OP1 = DATA_R1;
					ALU_OP2 = ((FUNCT === `ALU_FUNCT_WIDTH'h01) || 
							   (FUNCT === `ALU_FUNCT_WIDTH'h02)) ? SHAMT : DATA_R2;
					ALU_CODE = FUNCT;	
				end

				`STATE_EXECUTE:	begin
					state = `STATE_IDLE;
					RF_READ = 1'b0;
					RF_WRITE = 1'b1;
				end

				default: ;
			endcase
		end
	end
endmodule