data/full_repos/permissive/219228794/src/GreenBeret_MAIN.v
None: at end of input
1: b'%Error: data/full_repos/permissive/219228794/src/GreenBeret_MAIN.v:78: Cannot find include file: HIDDEF.i\n`include "HIDDEF.i" \n         ^~~~~~~~~~\n        ... Looked in:\n             data/full_repos/permissive/219228794/src,data/full_repos/permissive/219228794/HIDDEF.i\n             data/full_repos/permissive/219228794/src,data/full_repos/permissive/219228794/HIDDEF.i.v\n             data/full_repos/permissive/219228794/src,data/full_repos/permissive/219228794/HIDDEF.i.sv\n             HIDDEF.i\n             HIDDEF.i.v\n             HIDDEF.i.sv\n             obj_dir/HIDDEF.i\n             obj_dir/HIDDEF.i.v\n             obj_dir/HIDDEF.i.sv\n%Error: data/full_repos/permissive/219228794/src/GreenBeret_MAIN.v:79: Define or directive not defined: \'`none\'\n                                                                     : ... Suggested alternative: \'`inline\'\nwire [7:0] ISYS = ~{`none,`none,`none,`P2ST,`P1ST,`none,`none,`COIN};\n                    ^~~~~\n%Error: data/full_repos/permissive/219228794/src/GreenBeret_MAIN.v:79: syntax error, unexpected \',\', expecting TYPE-IDENTIFIER\nwire [7:0] ISYS = ~{`none,`none,`none,`P2ST,`P1ST,`none,`none,`COIN};\n                         ^\n%Error: data/full_repos/permissive/219228794/src/GreenBeret_MAIN.v:79: Define or directive not defined: \'`none\'\n                                                                     : ... Suggested alternative: \'`inline\'\nwire [7:0] ISYS = ~{`none,`none,`none,`P2ST,`P1ST,`none,`none,`COIN};\n                          ^~~~~\n%Error: data/full_repos/permissive/219228794/src/GreenBeret_MAIN.v:79: Define or directive not defined: \'`none\'\n                                                                     : ... Suggested alternative: \'`inline\'\nwire [7:0] ISYS = ~{`none,`none,`none,`P2ST,`P1ST,`none,`none,`COIN};\n                                ^~~~~\n%Error: data/full_repos/permissive/219228794/src/GreenBeret_MAIN.v:79: Define or directive not defined: \'`P2ST\'\nwire [7:0] ISYS = ~{`none,`none,`none,`P2ST,`P1ST,`none,`none,`COIN};\n                                      ^~~~~\n%Error: data/full_repos/permissive/219228794/src/GreenBeret_MAIN.v:79: Define or directive not defined: \'`P1ST\'\nwire [7:0] ISYS = ~{`none,`none,`none,`P2ST,`P1ST,`none,`none,`COIN};\n                                            ^~~~~\n%Error: data/full_repos/permissive/219228794/src/GreenBeret_MAIN.v:79: Define or directive not defined: \'`none\'\n                                                                     : ... Suggested alternative: \'`inline\'\nwire [7:0] ISYS = ~{`none,`none,`none,`P2ST,`P1ST,`none,`none,`COIN};\n                                                  ^~~~~\n%Error: data/full_repos/permissive/219228794/src/GreenBeret_MAIN.v:79: Define or directive not defined: \'`none\'\n                                                                     : ... Suggested alternative: \'`inline\'\nwire [7:0] ISYS = ~{`none,`none,`none,`P2ST,`P1ST,`none,`none,`COIN};\n                                                        ^~~~~\n%Error: data/full_repos/permissive/219228794/src/GreenBeret_MAIN.v:79: Define or directive not defined: \'`COIN\'\nwire [7:0] ISYS = ~{`none,`none,`none,`P2ST,`P1ST,`none,`none,`COIN};\n                                                              ^~~~~\n%Error: data/full_repos/permissive/219228794/src/GreenBeret_MAIN.v:80: Define or directive not defined: \'`none\'\n                                                                     : ... Suggested alternative: \'`inline\'\nwire [7:0] IP01 = ~{`none,`none,`P1TB,`P1TA,`P1DW,`P1UP,`P1RG,`P1LF};\n                    ^~~~~\n%Error: data/full_repos/permissive/219228794/src/GreenBeret_MAIN.v:80: syntax error, unexpected \',\', expecting TYPE-IDENTIFIER\nwire [7:0] IP01 = ~{`none,`none,`P1TB,`P1TA,`P1DW,`P1UP,`P1RG,`P1LF};\n                         ^\n%Error: data/full_repos/permissive/219228794/src/GreenBeret_MAIN.v:80: Define or directive not defined: \'`none\'\n                                                                     : ... Suggested alternative: \'`inline\'\nwire [7:0] IP01 = ~{`none,`none,`P1TB,`P1TA,`P1DW,`P1UP,`P1RG,`P1LF};\n                          ^~~~~\n%Error: data/full_repos/permissive/219228794/src/GreenBeret_MAIN.v:80: Define or directive not defined: \'`P1TB\'\nwire [7:0] IP01 = ~{`none,`none,`P1TB,`P1TA,`P1DW,`P1UP,`P1RG,`P1LF};\n                                ^~~~~\n%Error: data/full_repos/permissive/219228794/src/GreenBeret_MAIN.v:80: Define or directive not defined: \'`P1TA\'\nwire [7:0] IP01 = ~{`none,`none,`P1TB,`P1TA,`P1DW,`P1UP,`P1RG,`P1LF};\n                                      ^~~~~\n%Error: data/full_repos/permissive/219228794/src/GreenBeret_MAIN.v:80: Define or directive not defined: \'`P1DW\'\nwire [7:0] IP01 = ~{`none,`none,`P1TB,`P1TA,`P1DW,`P1UP,`P1RG,`P1LF};\n                                            ^~~~~\n%Error: data/full_repos/permissive/219228794/src/GreenBeret_MAIN.v:80: Define or directive not defined: \'`P1UP\'\nwire [7:0] IP01 = ~{`none,`none,`P1TB,`P1TA,`P1DW,`P1UP,`P1RG,`P1LF};\n                                                  ^~~~~\n%Error: data/full_repos/permissive/219228794/src/GreenBeret_MAIN.v:80: Define or directive not defined: \'`P1RG\'\nwire [7:0] IP01 = ~{`none,`none,`P1TB,`P1TA,`P1DW,`P1UP,`P1RG,`P1LF};\n                                                        ^~~~~\n%Error: data/full_repos/permissive/219228794/src/GreenBeret_MAIN.v:80: Define or directive not defined: \'`P1LF\'\nwire [7:0] IP01 = ~{`none,`none,`P1TB,`P1TA,`P1DW,`P1UP,`P1RG,`P1LF};\n                                                              ^~~~~\n%Error: data/full_repos/permissive/219228794/src/GreenBeret_MAIN.v:81: Define or directive not defined: \'`none\'\n                                                                     : ... Suggested alternative: \'`inline\'\nwire [7:0] IP02 = ~{`none,`none,`P2TB,`P2TA,`P2DW,`P2UP,`P2RG,`P2LF};\n                    ^~~~~\n%Error: data/full_repos/permissive/219228794/src/GreenBeret_MAIN.v:81: syntax error, unexpected \',\', expecting TYPE-IDENTIFIER\nwire [7:0] IP02 = ~{`none,`none,`P2TB,`P2TA,`P2DW,`P2UP,`P2RG,`P2LF};\n                         ^\n%Error: data/full_repos/permissive/219228794/src/GreenBeret_MAIN.v:81: Define or directive not defined: \'`none\'\n                                                                     : ... Suggested alternative: \'`inline\'\nwire [7:0] IP02 = ~{`none,`none,`P2TB,`P2TA,`P2DW,`P2UP,`P2RG,`P2LF};\n                          ^~~~~\n%Error: data/full_repos/permissive/219228794/src/GreenBeret_MAIN.v:81: Define or directive not defined: \'`P2TB\'\nwire [7:0] IP02 = ~{`none,`none,`P2TB,`P2TA,`P2DW,`P2UP,`P2RG,`P2LF};\n                                ^~~~~\n%Error: data/full_repos/permissive/219228794/src/GreenBeret_MAIN.v:81: Define or directive not defined: \'`P2TA\'\nwire [7:0] IP02 = ~{`none,`none,`P2TB,`P2TA,`P2DW,`P2UP,`P2RG,`P2LF};\n                                      ^~~~~\n%Error: data/full_repos/permissive/219228794/src/GreenBeret_MAIN.v:81: Define or directive not defined: \'`P2DW\'\nwire [7:0] IP02 = ~{`none,`none,`P2TB,`P2TA,`P2DW,`P2UP,`P2RG,`P2LF};\n                                            ^~~~~\n%Error: data/full_repos/permissive/219228794/src/GreenBeret_MAIN.v:81: Define or directive not defined: \'`P2UP\'\nwire [7:0] IP02 = ~{`none,`none,`P2TB,`P2TA,`P2DW,`P2UP,`P2RG,`P2LF};\n                                                  ^~~~~\n%Error: data/full_repos/permissive/219228794/src/GreenBeret_MAIN.v:81: Define or directive not defined: \'`P2RG\'\nwire [7:0] IP02 = ~{`none,`none,`P2TB,`P2TA,`P2DW,`P2UP,`P2RG,`P2LF};\n                                                        ^~~~~\n%Error: data/full_repos/permissive/219228794/src/GreenBeret_MAIN.v:81: Define or directive not defined: \'`P2LF\'\nwire [7:0] IP02 = ~{`none,`none,`P2TB,`P2TA,`P2DW,`P2UP,`P2RG,`P2LF};\n                                                              ^~~~~\n%Error: Exiting due to 28 error(s)\n'
module IRQGEN
(
	input 			RESET,
	input	 [8:0]	PH,
	input	 [8:0]	PV,

	input 			CPUCL,
	input [15:0]	CPUAD,
	input  [7:0]	CPUWD,
	input				CPUWE,

	output reg		cpu_irq,
	output reg		cpu_nmi,

	output reg [2:0] ROMBK
);
	

wire CS_FSCW = (CPUAD[15:0] == 16'hE044) & CPUWE;
wire CS_CCTW = (CPUAD[15:0] == 16'hF000) & CPUWE;

reg  [2:0] irqmask;
reg  [8:0] tick;
wire [8:0] irqs = (~tick) & (tick+9'd1);
reg  [8:0] pPV;
reg		  sync;

always @( negedge CPUCL ) begin
	if (RESET) begin
		ROMBK   <= 0;
		irqmask <= 0;
		cpu_nmi <= 0;
		cpu_irq <= 0;
		tick    <= 0;
		pPV     <= 1;
		sync    <= 1;
	end
	else begin
		if ( CS_CCTW ) ROMBK <= CPUWD[7:5];
		if ( CS_FSCW ) begin
			irqmask <= CPUWD[2:0];
			if (~CPUWD[0]) cpu_nmi <= 0;
			if (~CPUWD[1]) cpu_irq <= 0;
			else if (~CPUWD[2]) cpu_irq <= 0;
		end
		else if (pPV != PV) begin
			if (PV[3:0]==0) begin
				if (sync & (PV==9'd0)) begin tick <= 9'd0; sync <= 0; end
				else tick <= (tick+9'd1);
				cpu_nmi <= irqs[0] & irqmask[0];
				cpu_irq <=(irqs[3] & irqmask[1]) | (irqs[4] & irqmask[2]);
				pPV <= PV;
			end
		end
	end
end

endmodule
module IRQGEN
(
	input 			RESET,
	input	 [8:0]	PH,
	input	 [8:0]	PV,

	input 			CPUCL,
	input [15:0]	CPUAD,
	input  [7:0]	CPUWD,
	input				CPUWE,

	output reg		cpu_irq,
	output reg		cpu_nmi,

	output reg [2:0] ROMBK
);

	

wire CS_FSCW = (CPUAD[15:0] == 16'hE044) & CPUWE;
wire CS_CCTW = (CPUAD[15:0] == 16'hF000) & CPUWE;

reg  [2:0] irqmask;
reg  [8:0] tick;
wire [8:0] irqs = (~tick) & (tick+9'd1);
reg  [8:0] pPV;
reg		  sync;

always @( negedge CPUCL ) begin
	if (RESET) begin
		ROMBK   <= 0;
		irqmask <= 0;
		cpu_nmi <= 0;
		cpu_irq <= 0;
		tick    <= 0;
		pPV     <= 1;
		sync    <= 1;
	end
	else begin
		if ( CS_CCTW ) ROMBK <= CPUWD[7:5];
		if ( CS_FSCW ) begin
			irqmask <= CPUWD[2:0];
			if (~CPUWD[0]) cpu_nmi <= 0;
			if (~CPUWD[1]) cpu_irq <= 0;
			else if (~CPUWD[2]) cpu_irq <= 0;
		end
		else if (pPV != PV) begin
			if (PV[3:0]==0) begin
				if (sync & (PV==9'd0)) begin tick <= 9'd0; sync <= 0; end
				else tick <= (tick+9'd1);
				cpu_nmi <= irqs[0] & irqmask[0];
				cpu_irq <=(irqs[3] & irqmask[1]) | (irqs[4] & irqmask[2]);
				pPV <= PV;
			end
		end
	end
end

endmodule