00001
00002 #include "oagFpgaVerilogDesign.h"
00003
00004 namespace oagFpga {
00005
00006
00007
00008
00009
00011
00012
00013 VerilogDesign::~VerilogDesign() {
00014 if (!DELETE_UPON_DESTRUCTION) return;
00015
00016 for(std::list<Module *>::iterator it=modules.begin(); it != modules.end(); it++)
00017 delete (*it);
00018 }
00019
00020
00021
00022
00023
00025
00026
00027 VerilogDesign::Module::~Module() {
00028 if (!DELETE_UPON_DESTRUCTION) return;
00029
00030 if (ports) {
00031 for(std::list<Port *>::iterator it=ports->begin(); it!=ports->end(); it++)
00032 delete (*it);
00033 delete ports;
00034 }
00035
00036 if (assignments) {
00037 for(std::list<Assignment *>::iterator it=assignments->begin(); it!=assignments->end(); it++)
00038 delete (*it);
00039 delete assignments;
00040 }
00041
00042 if (alwaysBlocks) {
00043 for(std::list<AlwaysBlock *>::iterator it=alwaysBlocks->begin(); it!=alwaysBlocks->end(); it++)
00044 delete (*it);
00045 delete alwaysBlocks;
00046 }
00047
00048 if (initialBlocks) {
00049 for(std::list<Statement *>::iterator it=initialBlocks->begin(); it!=initialBlocks->end(); it++)
00050 delete (*it);
00051 delete initialBlocks;
00052 }
00053
00054 if (functions) {
00055 for(std::list<Function *>::iterator it=functions->begin(); it!=functions->end(); it++)
00056 delete (*it);
00057 delete functions;
00058 }
00059
00060 if (functions) {
00061 for(std::list<Function *>::iterator it=functions->begin(); it!=functions->end(); it++)
00062 delete (*it);
00063 delete functions;
00064 }
00065
00066 for(std::list<Declaration *>::iterator it=declarations.begin(); it!=declarations.end(); it++)
00067 delete (*it);
00068
00069 for(std::list<Declaration *>::iterator it=parameters.begin(); it!=parameters.end(); it++)
00070 delete (*it);
00071
00072 if (parameterOverrides) {
00073 for(std::list<Declaration *>::iterator it=parameterOverrides->begin(); it!=parameterOverrides->end(); it++)
00074 delete (*it);
00075 delete parameterOverrides;
00076 }
00077 }
00078
00079
00080
00081
00082
00084
00085
00086 VerilogDesign::Declaration::~Declaration() {
00087 if (!DELETE_UPON_DESTRUCTION) return;
00088 if (start)
00089 delete start;
00090 if (stop && start != stop)
00091 delete stop;
00092 if (start2D)
00093 delete start2D;
00094 if (stop && start2D != stop2D)
00095 delete stop2D;
00096 if (value)
00097 delete value;
00098 }
00099
00100
00101
00102
00103
00105
00106
00107 VerilogDesign::Function::~Function() {
00108 if (!DELETE_UPON_DESTRUCTION) return;
00109 if (declarations) {
00110 for(std::list<Declaration*>::iterator it=declarations->begin(); it!=declarations->end(); it++)
00111 delete (*it);
00112 delete declarations;
00113 }
00114 if (start)
00115 delete start;
00116 if (stop && start != stop)
00117 delete stop;
00118 if (action)
00119 delete action;
00120 }
00121
00122
00123
00124
00125
00127
00128
00129 VerilogDesign::Trigger::~Trigger() {
00130 if (!DELETE_UPON_DESTRUCTION) return;
00131 if (net)
00132 delete net;
00133 }
00134
00135
00136
00137
00138
00140
00141
00142 VerilogDesign::Assignment::~Assignment() {
00143 if (!DELETE_UPON_DESTRUCTION) return;
00144 if (lval)
00145 delete lval;
00146 if (value)
00147 delete value;
00148 }
00149
00150
00151
00152
00153
00155
00156
00157 VerilogDesign::AlwaysBlock::~AlwaysBlock() {
00158 if (!DELETE_UPON_DESTRUCTION) return;
00159 if (action)
00160 delete action;
00161 if (triggers) {
00162 for(std::list<Trigger*>::iterator it=triggers->begin(); it!=triggers->end(); it++)
00163 delete (*it);
00164 delete triggers;
00165 }
00166 }
00167
00168
00169
00170
00171
00173
00174
00175 VerilogDesign::Case::~Case() {
00176 if (!DELETE_UPON_DESTRUCTION) return;
00177 if (action)
00178 delete action;
00179 if (conditions) {
00180 for(std::list<Expression*>::iterator it=conditions->begin(); it!=conditions->end(); it++)
00181 delete (*it);
00182 delete conditions;
00183 }
00184 }
00185
00186
00187
00188
00189
00191
00192
00193 VerilogDesign::Statement::~Statement() {
00194 if (!DELETE_UPON_DESTRUCTION) return;
00195 if (ifc.condition)
00196 delete ifc.condition;
00197 if (ifc.ifTrue)
00198 delete ifc.ifTrue;
00199 if (ifc.ifFalse)
00200 delete ifc.ifFalse;
00201 if (ifc.cases) {
00202 for(std::list<Case*>::iterator it=ifc.cases->begin(); it!=ifc.cases->end(); it++)
00203 delete (*it);
00204 delete ifc.cases;
00205 }
00206 if (assign.lval)
00207 delete assign.lval;
00208 if (assign.rval)
00209 delete assign.rval;
00210 if (begin_end.block) {
00211 for(std::list<Statement*>::iterator it=begin_end.block->begin(); it!=begin_end.block->end(); it++)
00212 delete (*it);
00213 delete begin_end.block;
00214 }
00215 if (begin_end.declarations) {
00216 for(std::list<Declaration*>::iterator it=begin_end.declarations->begin(); it!=begin_end.declarations->end(); it++)
00217 delete (*it);
00218 delete begin_end.declarations;
00219 }
00220 }
00221
00222
00223
00224
00225
00227
00228
00229 VerilogDesign::Instantiation::~Instantiation() {
00230 if (!DELETE_UPON_DESTRUCTION) return;
00231 if (parameters) {
00232 for(std::list<Expression*>::iterator it=parameters->begin(); it!=parameters->end(); it++)
00233 delete (*it);
00234 delete parameters;
00235 }
00236 if (connections) {
00237 for(std::list<PortConnection*>::iterator it=connections->begin(); it!=connections->end(); it++)
00238 delete (*it);
00239 delete connections;
00240 }
00241 }
00242
00243
00244
00245
00246
00248
00249
00250 VerilogDesign::PortConnection::~PortConnection() {
00251 if (!DELETE_UPON_DESTRUCTION) return;
00252 if (value)
00253 delete value;
00254 }
00255
00256
00257
00258
00259
00261
00262
00263 VerilogDesign::Expression::~Expression() {
00264 if (!DELETE_UPON_DESTRUCTION) return;
00265 if (type == PRIMARY) {
00266 if (primary)
00267 delete primary;
00268 return;
00269 }
00270 if (type == BUNDLE) {
00271 if (primary)
00272 delete primary;
00273 return;
00274 }
00275 if (op1)
00276 delete op1;
00277 if (op2)
00278 delete op2;
00279 if (op3)
00280 delete op3;
00281 }
00282
00283
00284
00285
00286
00288
00289
00290 VerilogDesign::Primary::~Primary() {
00291 if (!DELETE_UPON_DESTRUCTION) return;
00292 if (range.start)
00293 delete range.start;
00294 if (range.stop && range.start != range.stop)
00295 delete range.stop;
00296 if (arguments) {
00297 for(std::list<Expression*>::iterator it=arguments->begin(); it!=arguments->end(); it++)
00298 delete (*it);
00299 delete arguments;
00300 }
00301 }
00302
00303
00304
00305
00306
00308
00309
00310 VerilogDesign::Bundle::~Bundle() {
00311 if (!DELETE_UPON_DESTRUCTION) return;
00312 if (replication)
00313 delete replication;
00314 if (members) {
00315 for(std::list<Expression*>::iterator it=members->begin(); it!=members->end(); it++)
00316 delete (*it);
00317 delete members;
00318 }
00319 }
00320
00321 }