//--------------------------------------------------------------------------------------------------
//
// Title       : Dwarf Core CPLD U21
// Design      : U21
// Author      : SJensen
// Company     : MBARI
//
//-------------------------------------------------------------------------------------------------
//
// File        : c:\Projects\genosensor\2g\CPLDs\Core\U21\compile\U21.v
// Generated   : Mon Nov 29 07:16:50 2004
// From        : c:\Projects\genosensor\2g\CPLDs\Core\U21\src\U21.bde
// By          : Bde2Verilog ver. 2.01
//
//-------------------------------------------------------------------------------------------------
//
// Description : 
//
//-------------------------------------------------------------------------------------------------

// synopsys translate_off
`ifdef _VCP
`else
`define library(a,b)
`endif
// synopsys translate_on


// ---------- Design Unit Header ---------- //
`timescale 1ns / 1ns
//synthesis attribute KEEP of DCORIEw is TRUE;
//synthesis attribute KEEP of DCORIFGw is TRUE;
//synthesis attribute KEEP of DCORIFGr is TRUE;
//synthesis attribute KEEP of DCORLIMITSr is TRUE;
//synthesis attribute KEEP of DCORENCCTLw is TRUE;
//synthesis attribute KEEP of DCOR1CNTLOWr is TRUE;
//s-ynthesis attribute KEEP of DCOR1CNTMIDr is TRUE;
//synthesis attribute KEEP of DCOR1THRESLOWr is TRUE;
//synthesis attribute KEEP of DCOR1THRESHIGHr is TRUE;
//synthesis attribute KEEP of DCOR0CNTLOWr is TRUE;
//s-ynthesis attribute KEEP of DCOR0CNTMIDr is TRUE;
//synthesis attribute KEEP of DCOR0CNTHIGHr is TRUE;
//synthesis attribute KEEP of DCOR1CNTHIGHr is TRUE;
//synthesis attribute KEEP of DCOR0THRESLOWr is TRUE;
//synthesis attribute KEEP of DCOR0THRESHIGHr is TRUE
//synthesis attribute KEEP of DCORENCPWRr is TRUE;
//synthesis attribute KEEP of DCORENCPWRw is TRUE;
//synthesis attribute KEEP of DCORCONFIGr is TRUE;
//synthesis attribute KEEP of DCOROUTw is TRUE;
//synthesis attribute KEEP of DCORI2CCNTr is TRUE;
//synthesis attribute KEEP of DCORSENSORw is TRUE;
//synthesis attribute KEEP of DCORLINTr is TRUE;

module U21 (AS,Brake0,Brake1,DIR0,DIR1,Enc033FLG,Enc05FLG,Enc133FLG,Enc15FLG,FLS0,
FLS1,GP_Motor0_0,GP_Motor1_0,HSI,Home0,Home033FLG,Home05FLG,Home1,Home133FLG,Home15FLG,
INTbus,LightSense,MHSO,MReset,MSPReset,Mclk,PWM1,PWM2,PWM3,PWM4,
PWM5,PhaseA_Encoder0,PhaseA_Encoder1,PhaseB_Encoder0,PhaseB_Encoder1,RD,RLS0,RLS1,SCLinc,SCLreset,
TXI,WR,I2CS,Enc033ctrl,Enc05ctrl,Enc133ctrl,Enc15ctrl,GPIO10,GPIO8,GPIO9,
GP_Motor0_1,GP_Motor1_1,HSO,Home033ctrl,Home05ctrl,Home133ctrl,Home15ctrl,INT,LED1,LED2,
LED3,LED4,LED5,MHSI,MTRpwr,MTRpwrn,MTXI,PAH0,PAH1,PAL0,
PAL1,PBH0,PBH1,PBL0,PBL1,PresEn,PresSlct,SCLout,TP10,TP12,
TmpEn,TmpSlct,SCL,AD) ;

// ------------ Port declarations --------- //
input AS;
wire AS;
input Brake0;
wire Brake0;
input Brake1;
wire Brake1;
input DIR0;
wire DIR0;
input DIR1;
wire DIR1;
input Enc033FLG;
wire Enc033FLG;
input Enc05FLG;
wire Enc05FLG;
input Enc133FLG;
wire Enc133FLG;
input Enc15FLG;
wire Enc15FLG;
input FLS0;
wire FLS0;
input FLS1;
wire FLS1;
input GP_Motor0_0;
wire GP_Motor0_0;
input GP_Motor1_0;
wire GP_Motor1_0;
input HSI;
wire HSI;
input Home0;
wire Home0;
input Home033FLG;
wire Home033FLG;
input Home05FLG;
wire Home05FLG;
input Home1;
wire Home1;
input Home133FLG;
wire Home133FLG;
input Home15FLG;
wire Home15FLG;
input INTbus;
wire INTbus;
input LightSense;
wire LightSense;
input MHSO;
wire MHSO;
input MReset;
wire MReset;
input MSPReset;
wire MSPReset;
input Mclk;
wire Mclk;
input PWM1;
wire PWM1;
input PWM2;
wire PWM2;
input PWM3;
wire PWM3;
input PWM4;
wire PWM4;
input PWM5;
wire PWM5;
input PhaseA_Encoder0;
wire PhaseA_Encoder0;
input PhaseA_Encoder1;
wire PhaseA_Encoder1;
input PhaseB_Encoder0;
wire PhaseB_Encoder0;
input PhaseB_Encoder1;
wire PhaseB_Encoder1;
input RD;
wire RD;
input RLS0;
wire RLS0;
input RLS1;
wire RLS1;
input SCLinc;
wire SCLinc;
input SCLreset;
wire SCLreset;
input TXI;
wire TXI;
input WR;
wire WR;
input [5:0] I2CS;
wire [5:0] I2CS;
output Enc033ctrl;
wire Enc033ctrl;
output Enc05ctrl;
wire Enc05ctrl;
output Enc133ctrl;
wire Enc133ctrl;
output Enc15ctrl;
wire Enc15ctrl;
output GPIO10;
wire GPIO10;
output GPIO8;
wire GPIO8;
output GPIO9;
wire GPIO9;
output GP_Motor0_1;
wire GP_Motor0_1;
output GP_Motor1_1;
wire GP_Motor1_1;
output HSO;
wire HSO;
output Home033ctrl;
wire Home033ctrl;
output Home05ctrl;
wire Home05ctrl;
output Home133ctrl;
wire Home133ctrl;
output Home15ctrl;
wire Home15ctrl;
output INT;
wire INT;
output LED1;
wire LED1;
output LED2;
wire LED2;
output LED3;
wire LED3;
output LED4;
wire LED4;
output LED5;
wire LED5;
output MHSI;
wire MHSI;
output MTRpwr;
wire MTRpwr;
output MTRpwrn;
wire MTRpwrn;
output MTXI;
wire MTXI;
output PAH0;
wire PAH0;
output PAH1;
wire PAH1;
output PAL0;
wire PAL0;
output PAL1;
wire PAL1;
output PBH0;
wire PBH0;
output PBH1;
wire PBH1;
output PBL0;
wire PBL0;
output PBL1;
wire PBL1;
output PresEn;
wire PresEn;
output PresSlct;
wire PresSlct;
output SCLout;
wire SCLout;
output TP10;
wire TP10;
output TP12;
wire TP12;
output TmpEn;
wire TmpEn;
output TmpSlct;
wire TmpSlct;
inout SCL;
wire SCL;
inout [7:0] AD;
wire [7:0] AD;

// ----------- Signal declarations -------- //
wire DCOR0CNTHIGHr;
wire DCOR0CNTLOWr;
wire DCOR0THRESHIGHr;
wire DCOR0THRESLOWr;
wire DCOR1CNTHIGHr;
wire DCOR1CNTLOWr;
wire DCOR1THRESHIGHr;
wire DCOR1THRESLOWr;
wire DCORCONFIGr;
wire DCORENCCTLw;
wire DCORENCPWRr;
wire DCORENCPWRw;
wire DCORI2CCNTr;
wire DCORIEw;
wire DCORIFGr;
wire DCORIFGw;
wire DCORLIMITSr;
wire DCORLINTr;
wire DCOROUTw;
wire DCORSENSORw;
wire NET10037;
wire NET2482;
wire NET2493;
wire NET2501;
wire NET2512;
wire NET2528;
wire NET2575;
wire NET3248;
wire NET3253;
wire NET4826;
wire NET615;
wire NET621;
wire NET629;
wire Reset;
wire [7:0] BUS1564;
wire [7:0] inDATA;
wire [7:0] outDATA;

// -------- Component instantiations -------//

Servos U1
(
	.ASleading(NET4826),
	.DCOR0CNTHIGHr(DCOR0CNTHIGHr),
	.DCOR0CNTLOWr(DCOR0CNTLOWr),
	.DCOR0THRESHIGHr(DCOR0THRESHIGHr),
	.DCOR0THRESLOWr(DCOR0THRESLOWr),
	.DCOR1CNTHIGHr(DCOR1CNTHIGHr),
	.DCOR1CNTLOWr(DCOR1CNTLOWr),
	.DCOR1THRESHIGHr(DCOR1THRESHIGHr),
	.DCOR1THRESLOWr(DCOR1THRESLOWr),
	.DCORENCCTLw(DCORENCCTLw),
	.DCORIFGr(DCORIFGr),
	.DCORIFGw(DCORIFGw),
	.Hfound0(NET2482),
	.Hfound1(NET2493),
	.Home_Encoder0(Home0),
	.Home_Encoder1(Home1),
	.Mclk(Mclk),
	.MotorIn0(GP_Motor0_0),
	.Motorin1(GP_Motor1_0),
	.PhaseA_Encoder0(PhaseA_Encoder0),
	.PhaseA_Encoder1(PhaseA_Encoder1),
	.PhaseB_Encoder0(PhaseB_Encoder0),
	.PhaseB_Encoder1(PhaseB_Encoder1),
	.Reset(Reset),
	.TP(TP10),
	.Tfound0(NET2501),
	.Tfound1(NET2512),
	.inDATA(inDATA),
	.outDATA(outDATA)
);



assign Reset = ~(MSPReset);


I2Cfix U11
(
	.DCORI2CCNTr(DCORI2CCNTr),
	.Inc(SCLinc),
	.Mclk(Mclk),
	.SCL(SCL),
	.SCLint(TP12),
	.SCLreset(SCLreset),
	.outDATA(outDATA)
);



U21AddDecode U12
(
	.ADDR(BUS1564),
	.AS(AS),
	.DCOR0CNTHIGHr(DCOR0CNTHIGHr),
	.DCOR0CNTLOWr(DCOR0CNTLOWr),
	.DCOR0THRESHIGHr(DCOR0THRESHIGHr),
	.DCOR0THRESLOWr(DCOR0THRESLOWr),
	.DCOR1CNTHIGHr(DCOR1CNTHIGHr),
	.DCOR1CNTLOWr(DCOR1CNTLOWr),
	.DCOR1THRESHIGHr(DCOR1THRESHIGHr),
	.DCOR1THRESLOWr(DCOR1THRESLOWr),
	.DCORCONFIGr(DCORCONFIGr),
	.DCORENCCTLw(DCORENCCTLw),
	.DCORENCPWRr(DCORENCPWRr),
	.DCORENCPWRw(DCORENCPWRw),
	.DCORI2CCNTr(DCORI2CCNTr),
	.DCORIEw(DCORIEw),
	.DCORIFGr(DCORIFGr),
	.DCORIFGw(DCORIFGw),
	.DCORLIMITSr(DCORLIMITSr),
	.DCORLINTr(DCORLINTr),
	.DCOROUTw(DCOROUTw),
	.DCORSENSORw(DCORSENSORw),
	.RD(RD),
	.WR(WR)
);



assign GPIO9 = ~(TmpEn) & PWM3;


assign GPIO10 = ~(TmpEn) & PWM4;


Interface U2
(
	.AD(AD),
	.ADDR(BUS1564),
	.AS(AS),
	.ASleading(NET4826),
	.Mclk(Mclk),
	.RD(RD),
	.Reset(Reset),
	.WR(WR),
	.inDATA(inDATA),
	.outDATA(outDATA)
);



Interrupt U3
(
	.BusInt(INTbus),
	.DCORIEw(DCORIEw),
	.DCORIFGr(DCORIFGr),
	.Homed0(NET2482),
	.Homed1(NET2493),
	.I2Cint(TP12),
	.INT(INT),
	.LSwitchInt(NET2575),
	.Mclk(Mclk),
	.PWRint(NET2528),
	.Reset(Reset),
	.Thres0(NET2501),
	.Thres1(NET2512),
	.inDATA(inDATA),
	.outDATA(outDATA)
);



PWRreg U4
(
	.DCORENCPWRr(DCORENCPWRr),
	.DCORENCPWRw(DCORENCPWRw),
	.DCORIFGr(DCORIFGr),
	.DCORIFGw(DCORIFGw),
	.Enc033ctl(Enc033ctrl),
	.Enc033flg(Enc033FLG),
	.Enc05ctl(Enc05ctrl),
	.Enc05flg(Enc05FLG),
	.Enc133ctl(Enc133ctrl),
	.Enc133flg(Enc133FLG),
	.Enc15ctl(Enc15ctrl),
	.Enc15flg(Enc15FLG),
	.Hme033ctl(Home033ctrl),
	.Hme033flg(Home033FLG),
	.Hme05ctl(Home05ctrl),
	.Hme05flg(Home05FLG),
	.Hme133ctl(Home133ctrl),
	.Hme133flg(Home133FLG),
	.Hme15ctl(Home15ctrl),
	.Hme15flg(Home15FLG),
	.Mclk(Mclk),
	.PWRint(NET2528),
	.Reset(Reset),
	.inDATA(inDATA),
	.outDATA(outDATA)
);



Lswitch U5
(
	.Brake0(Brake0),
	.Brake1(Brake1),
	.DCORIFGw(DCORIFGw),
	.DCORLIMITSr(DCORLIMITSr),
	.DCORLINTr(DCORLINTr),
	.DIR0(DIR0),
	.DIR1(DIR1),
	.FLS0(FLS0),
	.FLS1(FLS1),
	.Home0(Home0),
	.Home1(Home1),
	.LIFG(inDATA[4]),
	.LSwitchInt(NET2575),
	.Mclk(Mclk),
	.RLS0(RLS0),
	.RLS1(RLS1),
	.Reset(Reset),
	.fBRK0(NET3248),
	.fBRK1(NET3253),
	.outDATA(outDATA)
);



I2CAddress U6
(
	.DCORCONFIGr(DCORCONFIGr),
	.I2CS(I2CS),
	.MotorIn0(GP_Motor0_0),
	.MotorIn1(GP_Motor1_0),
	.outDATA(outDATA)
);



PWMcontrol U7
(
	.Brake1(Brake0),
	.Brake2(Brake1),
	.DIR1(DIR0),
	.DIR2(DIR1),
	.FLS0(FLS0),
	.FLS1(FLS1),
	.HBRK1(NET3248),
	.HBRK2(NET3253),
	.MTRpwr(MTRpwr),
	.PAH1(PAH0),
	.PAH2(PAH1),
	.PAL1(PAL0),
	.PAL2(PAL1),
	.PBH1(PBH0),
	.PBH2(PBH1),
	.PBL1(PBL0),
	.PBL2(PBL1),
	.PWM1(PWM1),
	.PWM2(PWM2),
	.RLS0(RLS0),
	.RLS1(RLS1),
	.fBRK1(NET3248),
	.fBRK2(NET3253)
);



Sensor U8
(
	.DCORSENSORw(DCORSENSORw),
	.MReset(MReset),
	.Mclk(Mclk),
	.PresEn(PresEn),
	.PresSlct(PresSlct),
	.Reset(Reset),
	.TmpEn(TmpEn),
	.TmpSlct(TmpSlct),
	.inDATA(inDATA[3:0])
);



MISCouts U9
(
	.DCOROUTw(DCOROUTw),
	.GP_Motor0_1(GP_Motor0_1),
	.GP_Motor1_1(GP_Motor1_1),
	.LED1(LED1),
	.LED2(LED2),
	.LED3(LED3),
	.LED4(LED4),
	.LED5(LED5),
	.LightSense(LightSense),
	.MReset(MReset),
	.MTRpwr(MTRpwr),
	.MTRpwrn(MTRpwrn),
	.Mclk(Mclk),
	.Reset(Reset),
	.inDATA(inDATA)
);



// ----------- Terminals assignment --------//
//	       ---- Input terminals ---         //
assign NET10037 = PWM5;
assign NET615 = MHSO;
assign NET621 = HSI;
assign NET629 = TXI;

//		   ---- Output terminals ---        //
assign GPIO8 = NET10037;
assign HSO = NET615;
assign MHSI = NET621;
assign MTXI = NET629;
assign SCLout = SCL;

endmodule 
