#include "cb_base.h"
#include "cb_views.h"
#include "cb_xconstraints.h"
#include "cb_netlist_al3p.h"
#include "cb_netlist_pp.h"
#include "simple.h"
#pragma argsused
int main( int argc, char* argv[] )
{
try {
TLogStatus Log( cout );
CM_Root Root;
Log << "Registering";
reg( Root );
Log << "Assigning reference designators";
#if 0
ifstream DSrce;
OpenFileI( DSrce, DESIGN_NAME "_old_designators.txt" );
Root.ReadReferenceDesignators( DSrce );
DSrce.close();
#endif
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 0
Log << "Creating constraint files";
TXConstraints Constraints;
#endif
#if 0
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", "VCC5", "VCC3" );
#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 0
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;
}