#include "cb_base.h"
#include "cb_views.h"
#include "cb_xconstraints.h"
#include "cb_dummy_device.h"
#include "cb_netlist_al3p.h"
#include "cb_netlist_pp.h"
#include "irod.h"
#pragma argsused
int main( int argc, char* argv[] )
{
try {
TLogStatus Log( cout );
CM_Root Root;
Log << "Registering";
reg( Root );
Log << "Assigning reference designators";
ifstream DSrce;
OpenFileI( DSrce, DESIGN_NAME "_old_designators.txt" );
Root.ReadReferenceDesignators( DSrce );
DSrce.close();
Root.AssignReferenceDesignators();
Root.CheckReferenceDesignators();
#if 1
ofstream DDest;
OpenFileO( DDest, OUTPUT_BASE "_new_designators.txt" );
Root.WriteReferenceDesignators( DDest );
DDest.close();
#endif
Log << "Connecting";
Root.ConnectAll();
Log << "Post-Connecting";
Root.PostConnectAll();
Log << "Creating CAD netlists";
ofstream NetDest;
OpenFileO( NetDest, OUTPUT_BASE "_3P.net" );
OutputCad3P( &Root, NetDest, true );
NetDest.close();
OpenFileO( NetDest, OUTPUT_BASE "_PP.net" );
OutputCadPP( &Root, NetDest, true );
NetDest.close();
Log << "Creating bill of materials";
ofstream BOM_Dest;
OpenFileO( BOM_Dest, OUTPUT_BASE "_bom.txt" );
Root.OutputBOM( BOM_Dest );
BOM_Dest.close();
#if 1
Log << "Creating constraint files";
TXConstraints Constraints;
Constraints.AddIgnorePort( "VCC", "VB", "GND" );
Constraints.AddIgnorePort( "TCK", "TMS", "TDI", "TDO" );
Constraints.GenerateConstraintsFile( OUTPUT_BASE "_FlashPldConstraints.ucf", &Root.VME_Interface.FlashPLD, &Root.VME_Interface.FlashPLD.Cpld );
Constraints.AddIgnorePort( "CCLK", "DIN" );
Constraints.GenerateConstraintsFile( OUTPUT_BASE "_HostConstraints.ucf", &Root.Host.HOST_PLD, &Root.Host.HOST_PLD.Cpld );
Constraints.GenerateConstraintsFile( OUTPUT_BASE "_VMECPldConstraints.ucf", &Root.VME_Interface.VMEC_PLD, &Root.VME_Interface.VMEC_PLD.Cpld );
Constraints.GenerateConstraintsFile( OUTPUT_BASE "_VMEDPldConstraints.ucf", &Root.VME_Interface.VMED_PLD, &Root.VME_Interface.VMED_PLD.Cpld );
Constraints.GenerateConstraintsFile( OUTPUT_BASE "_NoisyPldConstraints.ucf", &Root.ClockGeneration.NoisyPLD, &Root.ClockGeneration.NoisyPLD.Cpld );
Constraints.GenerateConstraintsFile( OUTPUT_BASE "_QuietPldConstraints.ucf", &Root.ClockGeneration.QuietPLD, &Root.ClockGeneration.QuietPLD.Cpld );
Constraints.AddIgnorePort( "PROGRAM_N" );
Constraints.SetPinPrefix( "P" );
Constraints.GenerateConstraintsFile( OUTPUT_BASE "_DXBFpgaConstraints.ucf", &Root.DataExchange.DXB_FPGA, &Root.DataExchange.DXB_FPGA.Fpga.Fpga );
Constraints.GenerateConstraintsFile( OUTPUT_BASE "_DXFFpgaConstraints.ucf", &Root.DataExchange.DXF_FPGA_A, &Root.DataExchange.DXF_FPGA_A.Fpga.Fpga );
Constraints.GenerateConstraintsFile( OUTPUT_BASE "_BPIFpgaConstraints.ucf", &Root.Interconnect.BPI_FPGA[0], &Root.Interconnect.BPI_FPGA[0].Fpga.Fpga );
Constraints.GenerateConstraintsFile( OUTPUT_BASE "_TTCFpgaConstraints.ucf", &Root.Interconnect.TTC_FPGA, &Root.Interconnect.TTC_FPGA.Fpga.Fpga );
Constraints.GenerateConstraintsFile( OUTPUT_BASE "_DCFpgaConstraints.ucf", &Root.DPU_Control.DC_FPGA, &Root.DPU_Control.DC_FPGA.Fpga.Fpga );
#endif
#if 1
Log << "Creating device files";
MakeDeviceFiles( &Root, "DeviceFiles" );
#endif
Log << "Creating symbolic netlist";
ofstream View1_Dest;
OpenFileO( View1_Dest, OUTPUT_BASE "_SymNetlist.txt" );
TViewSymbolicNetlist View1;
View1.ShowAllPins = true;
View1.SetBriefNetLimit( 4 );
#if 0
View1.AddBriefNet( "/NC", "GND" );
View1.AddBriefNet( "BPWR_VPOS5", "BPWR_VPOS3_3", "VCC5A" );
View1.AddBriefNet( "MB_VCC5", "MB_VCC", "VB" );
View1.AddBriefNet( "DSP_VCC", "DSP_VA" );
View1.AddBriefNet( "VREF" );
View1.AddBriefNet( "A_DCD", "B_DCD" );
View1.AddBriefNet( "A_DCC", "B_DCC" );
View1.AddBriefNet( "A_DXD", "B_DXD" );
View1.AddBriefNet( "A_DXC", "B_DXC" );
View1.AddBriefNet( "INTER_DX" );
View1.AddBriefNet( "EMU0", "EMU1" );
View1.AddBriefNet( "BA", "BDF", "BDG", "BDH" );
View1.AddBriefNet( "SOFTRESET_N" );
View1.AddBriefNet( "FP_CKOE_DIPSW" );
View1.AddBriefNet( "SD", "SYNSEL_CD" );
View1.AddBriefNet( "DIN_MB", "DIN_A", "DIN_B" );
View1.AddBriefNet( "TRST_N" );
View1.AddBriefNet( "A_IC_BUS", "B_IC_BUS" );
View1.AddBriefNet( "FP_EMULATOR_TMS" );
View1.AddBriefNet( "BUF_JTMS", "JTMS" );
View1.AddBriefNet( "SW5_DVA", "SW5_VB" );
View1.AddBriefNet( "OE_N_BIAS_A", "VPC", "ABUFOE_N", "DBUFOE_N", "ABUFDIR", "DBUFDIR" );
View1.AddBriefNet( "VME_GA_N" );
#endif
View1.Dump( View1_Dest, &Root );
View1_Dest.close();
OpenFileO( View1_Dest, OUTPUT_BASE "_SymNets.txt" );
View1.DumpNets( View1_Dest, &Root );
View1_Dest.close();
OpenFileO( View1_Dest, OUTPUT_BASE "_SymBriefNets.txt" );
View1.DumpBriefNets( View1_Dest, &Root );
View1_Dest.close();
OpenFileO( View1_Dest, OUTPUT_BASE "_SymParts.txt" );
View1.DumpParts( View1_Dest, &Root );
View1_Dest.close();
OpenFileO( View1_Dest, OUTPUT_BASE "_SymModules.txt" );
View1.DumpModules( View1_Dest, &Root );
View1_Dest.close();
OpenFileO( View1_Dest, OUTPUT_BASE "_SymNetlist.html" );
View1.DumpHTML( View1_Dest, &Root );
View1_Dest.close();
#if 1
Log << "Creating layout script files";
TGenLayoutScript LayoutScript;
LayoutScript.GenerateScriptFile( &Root );
#endif
Log << "Creating netlist dump";
ofstream NetDumpDest;
OpenFileO( NetDumpDest, OUTPUT_BASE "_NetlistDump.txt" );
Root.DumpSortedNetList( NetDumpDest, true );
NetDumpDest.close();
Log << "Creating database dump";
ofstream Dest;
OpenFileO( Dest, OUTPUT_BASE "_DatabaseDump.txt" );
Root.DumpGlobals( Dest );
Root.DumpAll( Dest );
Root.DumpNetList( Dest );
TSubBusList NonListed;
Root.AddNonListedPortRanges( &NonListed );
Dest << "\n\nThe entire range of all ports should be listed (i.e., connected):";
Dest << "\n Ports of TParts and TModules should be listed in the Part/Module's Owner's SubBusList or the Global SubBusList.";
Dest << "\n Ports of TModules should also be listed in the Module's SubBusList, unless they are listed in the Global SubBusList.";
Dest << "\n Ports of TBundle's are similar to ports of their ultimate owner TModule.";
Dest << "\n\nTotal nonconforming port ranges: " << NonListed.GetSubBusCount();
if ( NonListed.GetSubBusCount() ) {
Dest << " (listed below).\n";
NonListed.DumpAll( Dest );
}
TNet NonWired;
Root.AddNonWiredPins( &NonWired );
Dest << "\n\nNon-wired pins:";
NonWired.DumpAsPortRanges( Dest );
Dest << "\n\nSingle-node nets:";
int SingleNodeNets = Root.DumpSingleNodeNets( Dest );
Dest << "\n\nNo-connect net (" << NoConnect << "):";
int NoConnects = Root.DumpNoConnectNet( Dest );
Dest << "\n";
Dest << "\nTotal nonconforming port ranges: " << NonListed.GetSubBusCount() << ".";
Dest << "\nTotal non-wired PinSpecs: " << NonWired.GetPinSpecCount() << ".";
Dest << "\nTotal single-node nets: " << SingleNodeNets << ".";
Dest << "\nTotal PinSpecs in no-connect net: " << NoConnects << ".";
Dest << "\nTotal Nets: " << Root.GetNetCount() << ".";
Dest << "\n\nEnd of Dump\n";
Dest.close();
Log.End();
cout << "\nTotal nonconforming port ranges: " << NonListed.GetSubBusCount() << ".";
cout << "\nTotal non-wired PinSpecs: " << NonWired.GetPinSpecCount() << ".";
cout << "\nTotal single-node nets: " << SingleNodeNets << ".";
cout << "\nTotal PinSpecs in no-connect net: " << NoConnects << ".";
cout << "\nTotal Nets: " << Root.GetNetCount() << ".";
cout << "\n";
if ( argc == 1 ) {
cout << "\nPress Enter to continue.\n" << flush;
cin.get();
}
}
catch ( string& aString ) {
cout << "\n\nError: " << aString << '\n';
MessageIfError( cout, TModPar::RegisteringModPar, "registering" );
MessageIfError( cout, TModPar::PostConnectingModPar, "post-connecting" );
MessageIfError( cout, TModule::ConnectingModule, "connecting" );
cin.get();
return 1;
}
return 0;
}