Mercurial > cgi-bin > hgwebdir.cgi > PR > Applications > HWSim > HWSim__PingPong__HWDef
comparison src/Application/main.c @ 1:7566745e812a
Ideas starting to gel.. application part close to candidate form
| author | Me@portablequad |
|---|---|
| date | Sat, 19 Nov 2011 17:58:21 -0800 |
| parents | 8ea476474093 |
| children | d872169e58fa |
comparison
equal
deleted
inserted
replaced
| 0:b82f273d18a2 | 1:f527b53fd7b3 |
|---|---|
| 1 /* | 1 /* |
| 2 | 2 * Copyright 2011 OpenSourceStewardshipFoundation.org |
| 3 * Copyright Oct 24, 2009 OpenSourceStewardshipFoundation.org | |
| 4 | |
| 5 * Licensed under GNU General Public License version 2 | 3 * Licensed under GNU General Public License version 2 |
| 6 | |
| 7 * | 4 * |
| 8 | |
| 9 * author seanhalle@yahoo.com | 5 * author seanhalle@yahoo.com |
| 10 | |
| 11 */ | 6 */ |
| 12 | 7 |
| 13 | |
| 14 | |
| 15 #include <malloc.h> | 8 #include <malloc.h> |
| 16 | |
| 17 #include <stdlib.h> | 9 #include <stdlib.h> |
| 18 | 10 |
| 11 #include "SimParams.h" | |
| 12 #include "HWSim__Hello_World_HW/HWSim__Hello_World_HW.h" | |
| 19 | 13 |
| 20 | 14 /* |
| 21 #include "SimParams.h" | 15 * |
| 22 | |
| 23 #include "HWSim_TeraFlux/HWSim_TeraFlux.h" | |
| 24 | |
| 25 | |
| 26 | |
| 27 /** | |
| 28 | |
| 29 * | 16 * |
| 30 | |
| 31 */ | 17 */ |
| 32 | 18 |
| 33 int main( int argc, char **argv ) | 19 int main( int argc, char **argv ) |
| 20 { ParamBag *simParams; | |
| 21 HWSimResults *simResults; | |
| 34 | 22 |
| 35 { SimulationParams *simParams; | 23 printf( "param file name: %s\n", argv[1] ); |
| 36 | 24 |
| 37 SimulationResults *simResults; | 25 simParams = makeParamBag(); |
| 26 readParamFileIntoBag( argv[1], simParams ); | |
| 27 | |
| 28 netlist = createPingPongNetlist(); | |
| 29 simResults = | |
| 30 HWSim__run_simulation( simParams, netlist ); | |
| 38 | 31 |
| 39 ParamBag *paramBag; | 32 //HWSim |
| 40 | 33 printSimResults( simResults ); |
| 41 | 34 |
| 42 | |
| 43 printf( "arguments: %s | %s\n", argv[0], argv[1] ); | |
| 44 | |
| 45 | |
| 46 | |
| 47 simParams = malloc( sizeof(SimulationParams) ); | |
| 48 | |
| 49 | |
| 50 | |
| 51 | |
| 52 | |
| 53 //VMS has its own separate internal malloc, so to get results out, | |
| 54 | |
| 55 // have to pass in empty array for it to fill up | |
| 56 | |
| 57 //The alternative is internally telling HWSim make external space to use | |
| 58 | |
| 59 simResults = malloc( sizeof(SimulationResults) ); | |
| 60 | |
| 61 simParams->simResults = simResults; | |
| 62 | |
| 63 | |
| 64 | |
| 65 paramBag = makeParamBag(); | |
| 66 | |
| 67 | |
| 68 | |
| 69 readParamFileIntoBag( argv[1], paramBag ); | |
| 70 | |
| 71 fill_sim_params_from_bag( simParams, paramBag ); | |
| 72 | |
| 73 | |
| 74 | |
| 75 | |
| 76 | |
| 77 constructAndSimulateSystem( simParams ); | |
| 78 | |
| 79 | |
| 80 | |
| 81 printSimResults( simResults ); | |
| 82 | |
| 83 | |
| 84 | |
| 85 fflush(stdin); | 35 fflush(stdin); |
| 86 | |
| 87 | |
| 88 | |
| 89 exit(0); //cleans up | 36 exit(0); //cleans up |
| 90 | |
| 91 } | 37 } |
| 92 | 38 |
| 93 | |
| 94 | |
| 95 | |
| 96 |
