//--------------------------------------------------------------------------------------------------
//
// Title       : Dwarf Core CPLD U21
// Design      : U21
// Author      : mbari###
// Company     : MBARI
//
//-------------------------------------------------------------------------------------------------
//
// File        : C:\Projects\genosensor\2g\CPLDs\Core\U21\restore\U21\compile\U21.v
// Generated   : Fri Mar  5 13:41:48 2004
// From        : C:\Projects\genosensor\2g\CPLDs\Core\U21\restore\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

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,Mclk,PWM1,PWM2,PhaseA_Encoder0,PhaseA_Encoder1,PhaseB_Encoder0,PhaseB_Encoder1,
RD,RLS0,RLS1,Reset,SCLinc,SCLreset,TXI,WR,I2CS,Enc033ctrl,
Enc05ctrl,Enc133ctrl,Enc15ctrl,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,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 Mclk;
wire Mclk;
input PWM1;
wire PWM1;
input PWM2;
wire PWM2;
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 Reset;
wire Reset;
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 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;
inout SCL;
wire SCL;
inout [7:0] AD;
wire [7:0] AD;

// ----------- Signal declarations -------- //
wire NET1635;
wire NET1643;
wire NET1651;
wire NET1659;
wire NET1667;
wire NET1675;
wire NET1683;
wire NET1691;
wire NET1699;
wire NET1707;
wire NET1970;
wire NET1978;
wire NET1989;
wire NET2017;
wire NET2025;
wire NET2036;
wire NET2047;
wire NET2064;
wire NET2078;
wire NET2311;
wire NET2421;
wire NET2429;
wire NET2482;
wire NET2493;
wire NET2501;
wire NET2512;
wire NET2528;
wire NET2539;
wire NET2575;
wire NET615;
wire NET621;
wire NET629;
wire [7:0] BUS1564;
wire [7:0] inDATA;
wire [7:0] outDATA;

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

Servos U1
(
	.DCOR0CNTHIGHr(NET1667),
	.DCOR0CNTLOWr(NET1651),
	.DCOR0CNTMIDr(NET1659),
	.DCOR0THRESLOWr(NET1635),
	.DCOR0THRESMIDr(NET1643),
	.DCOR1CNTHIGHr(NET1675),
	.DCOR1CNTLOWr(NET1683),
	.DCOR1CNTMIDr(NET1691),
	.DCOR1THRESLOWr(NET1707),
	.DCOR1THRESMIDr(NET1699),
	.DCORENCCTLw(NET1970),
	.DCORIFGr(NET1978),
	.DCORIFGw(NET1989),
	.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),
	.Tfound0(NET2501),
	.Tfound1(NET2512),
	.inDATA(inDATA),
	.outDATA(outDATA)
);



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



U21AddDecode U12
(
	.ADDR(BUS1564),
	.AS(AS),
	.DCOR0CNTHIGHr(NET1667),
	.DCOR0CNTLOWr(NET1651),
	.DCOR0CNTMIDr(NET1659),
	.DCOR0THRESLOWr(NET1635),
	.DCOR0THRESMIDr(NET1643),
	.DCOR1CNTHIGHr(NET1675),
	.DCOR1CNTLOWr(NET1683),
	.DCOR1CNTMIDr(NET1691),
	.DCOR1THRESLOWr(NET1707),
	.DCOR1THRESMIDr(NET1699),
	.DCORCONFIGr(NET2064),
	.DCORENCCTLw(NET1970),
	.DCORENCPWRr(NET2036),
	.DCORENCPWRw(NET2025),
	.DCORI2CCNTr(NET2311),
	.DCORIEw(NET2078),
	.DCORIFGr(NET1978),
	.DCORIFGw(NET1989),
	.DCORLIMITSr(NET2047),
	.DCOROUTw(NET2017),
	.RD(RD),
	.WR(WR)
);



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



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



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



Lswitch U5
(
	.Brake0(Brake0),
	.Brake1(Brake1),
	.DCORIFGr(NET1978),
	.DCORIFGw(NET1989),
	.DCORLIMITSr(NET2047),
	.DIR0(DIR0),
	.DIR1(DIR1),
	.FLS0(FLS0),
	.FLS1(FLS1),
	.Home0(Home0),
	.Home1(Home1),
	.LSwitchInt(NET2575),
	.Mclk(Mclk),
	.RLS0(RLS0),
	.RLS1(RLS1),
	.Reset(Reset),
	.fBRK0(NET2421),
	.fBRK1(NET2429),
	.inDATA(inDATA),
	.outDATA(outDATA)
);



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



PWMcontrol U7
(
	.Brake1(Brake0),
	.Brake2(Brake1),
	.DIR1(DIR0),
	.DIR2(DIR1),
	.HBRK1(NET2421),
	.HBRK2(NET2429),
	.PAH1(PAH0),
	.PAH2(PBL1),
	.PAL1(PAL0),
	.PAL2(PBH1),
	.PBH1(PBH0),
	.PBH2(PAL1),
	.PBL1(PBL0),
	.PBL2(PAH1),
	.PWM1(PWM1),
	.PWM2(PWM2),
	.fBRK1(NET2421),
	.fBRK2(NET2429)
);



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



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

//		   ---- Output terminals ---        //
assign HSO = NET615;
assign MHSI = NET621;
assign MTXI = NET629;

endmodule 
