// This file has been automatically generated by goFB and should not be edited by hand
// Compiler written by Hammond Pearce and available at github.com/kiwih/goFB
// Verilog support is EXPERIMENTAL ONLY

// This file represents the Composite Function Block for InjectorController

module FB_InjectorController 

(
		input wire clk,
		
		//input events
		input wire InjectorArmFinishedMovement_eI,
		input wire EmergencyStopChanged_eI,
		input wire CanisterPressureChanged_eI,
		input wire FillContentsAvailableChanged_eI,
		input wire ConveyorStoppedForInject_eI,
		input wire VacuumTimerElapsed_eI,
		
		//output events
		output wire InjectDone_eO,
		output wire InjectorPositionChanged_eO,
		output wire InjectorControlsChanged_eO,
		output wire RejectCanister_eO,
		output wire FillContentsChanged_eO,
		output wire StartVacuumTimer_eO,
		output wire InjectRunning_eO,
		
		//input variables
		input wire  EmergencyStop_I,
		input wire [7:0] CanisterPressure_I,
		input wire [7:0] FillContentsAvailable_I,
		
		//output variables
		output wire [7:0] InjectorPosition_O ,
		output wire  InjectorContentsValveOpen_O ,
		output wire  InjectorVacuumRun_O ,
		output wire  InjectorPressurePumpRun_O ,
		output wire  FillContents_O ,
		

		input reset
);


//Wires needed for event connections 
wire InjectorArmFinishedMovement_conn;
wire EmergencyStopChanged_conn;
wire CanisterPressureChanged_conn;
wire FillContentsAvailableChanged_conn;
wire ConveyorStoppedForInject_conn;
wire VacuumTimerElapsed_conn;
wire Arm_InjectDone_conn;
wire Arm_InjectorPositionChanged_conn;
wire Pumps_InjectorControlsChanged_conn;
wire Pumps_RejectCanister_conn;
wire Pumps_FillContentsChanged_conn;
wire Pumps_StartVacuumTimer_conn;
wire Arm_InjectRunning_conn;
wire Arm_StartPump_conn;
wire Pumps_PumpFinished_conn;


//Wires needed for data connections 
wire  EmergencyStop_conn;
wire [7:0] CanisterPressure_conn;
wire [7:0] FillContentsAvailable_conn;
wire [7:0] Arm_InjectorPosition_conn;
wire  Pumps_InjectorContentsValveOpen_conn;
wire  Pumps_InjectorVacuumRun_conn;
wire  Pumps_InjectorPressurePumpRun_conn;
wire  Pumps_FillContents_conn;


//top level I/O to signals
//input events
assign InjectorArmFinishedMovement_conn = InjectorArmFinishedMovement_eI;
assign EmergencyStopChanged_conn = EmergencyStopChanged_eI;
assign EmergencyStopChanged_conn = EmergencyStopChanged_eI;
assign CanisterPressureChanged_conn = CanisterPressureChanged_eI;
assign FillContentsAvailableChanged_conn = FillContentsAvailableChanged_eI;
assign ConveyorStoppedForInject_conn = ConveyorStoppedForInject_eI;
assign VacuumTimerElapsed_conn = VacuumTimerElapsed_eI;

//output events
assign InjectDone_eO = Arm_InjectDone_conn;
assign InjectorPositionChanged_eO = Arm_InjectorPositionChanged_conn;
assign InjectorControlsChanged_eO = Pumps_InjectorControlsChanged_conn;
assign RejectCanister_eO = Pumps_RejectCanister_conn;
assign FillContentsChanged_eO = Pumps_FillContentsChanged_conn;
assign StartVacuumTimer_eO = Pumps_StartVacuumTimer_conn;
assign InjectRunning_eO = Arm_InjectRunning_conn;

//input variables
assign EmergencyStop_conn = EmergencyStop_I;
assign EmergencyStop_conn = EmergencyStop_I;
assign CanisterPressure_conn = CanisterPressure_I;
assign FillContentsAvailable_conn = FillContentsAvailable_I;

//output events
assign InjectorPosition_O = Arm_InjectorPosition_conn;
assign InjectorContentsValveOpen_O = Pumps_InjectorContentsValveOpen_conn;
assign InjectorVacuumRun_O = Pumps_InjectorVacuumRun_conn;
assign InjectorPressurePumpRun_O = Pumps_InjectorPressurePumpRun_conn;
assign FillContents_O = Pumps_FillContents_conn;



// child I/O to signals

FB_InjectorMotorController Arm (
	.clk(clk),

	//event outputs 
	.InjectDone_eO(Arm_InjectDone_conn),
	.InjectorPositionChanged_eO(Arm_InjectorPositionChanged_conn),
	.InjectRunning_eO(Arm_InjectRunning_conn),
	.StartPump_eO(Arm_StartPump_conn),
	
	//event inputs
	.InjectorArmFinishedMovement_eI(InjectorArmFinishedMovement_conn), 
	.EmergencyStopChanged_eI(EmergencyStopChanged_conn), 
	.ConveyorStoppedForInject_eI(ConveyorStoppedForInject_conn), 
	.PumpFinished_eI(Pumps_PumpFinished_conn), 
	
	//data outputs
	.InjectorPosition_O(Arm_InjectorPosition_conn), 
	
	//data inputs
	.EmergencyStop_I(EmergencyStop_conn),
	
	
	.reset(reset)
);

FB_InjectorPumpsController Pumps (
	.clk(clk),

	//event outputs 
	.InjectorControlsChanged_eO(Pumps_InjectorControlsChanged_conn),
	.RejectCanister_eO(Pumps_RejectCanister_conn),
	.FillContentsChanged_eO(Pumps_FillContentsChanged_conn),
	.StartVacuumTimer_eO(Pumps_StartVacuumTimer_conn),
	.PumpFinished_eO(Pumps_PumpFinished_conn),
	
	//event inputs
	.EmergencyStopChanged_eI(EmergencyStopChanged_conn), 
	.CanisterPressureChanged_eI(CanisterPressureChanged_conn), 
	.FillContentsAvailableChanged_eI(FillContentsAvailableChanged_conn), 
	.VacuumTimerElapsed_eI(VacuumTimerElapsed_conn), 
	.StartPump_eI(Arm_StartPump_conn), 
	
	//data outputs
	.InjectorContentsValveOpen_O(Pumps_InjectorContentsValveOpen_conn), 
	.InjectorVacuumRun_O(Pumps_InjectorVacuumRun_conn), 
	.InjectorPressurePumpRun_O(Pumps_InjectorPressurePumpRun_conn), 
	.FillContents_O(Pumps_FillContents_conn), 
	
	//data inputs
	.EmergencyStop_I(EmergencyStop_conn),
	.CanisterPressure_I(CanisterPressure_conn),
	.FillContentsAvailable_I(FillContentsAvailable_conn),
	
	
	.reset(reset)
);



endmodule