Mercurial > cgi-bin > hgwebdir.cgi > PR > Applications > HWSim > HWSim__PingPong__HWDef
comparison SimParams.c @ 12:4862640793b6
small changes to the netlist creation
| author | hausers |
|---|---|
| date | Tue, 31 Jan 2012 17:10:29 +0100 |
| parents | |
| children | 8d9d367e96f9 |
comparison
equal
deleted
inserted
replaced
| -1:000000000000 | 0:f8b56a679108 |
|---|---|
| 1 /* | |
| 2 | |
| 3 * Copyright 2009 OpenSourceStewardshipFoundation.org | |
| 4 | |
| 5 * Licensed under GNU General Public License version 2 | |
| 6 | |
| 7 * | |
| 8 | |
| 9 * Author: seanhalle@yahoo.com | |
| 10 | |
| 11 * | |
| 12 | |
| 13 * Created on November 15, 2009, 2:35 AM | |
| 14 | |
| 15 */ | |
| 16 | |
| 17 | |
| 18 | |
| 19 #include <malloc.h> | |
| 20 | |
| 21 #include <stdlib.h> | |
| 22 | |
| 23 | |
| 24 | |
| 25 #include "SimParams.h" | |
| 26 | |
| 27 #include "ParamHelper/Param.h" | |
| 28 | |
| 29 | |
| 30 | |
| 31 | |
| 32 | |
| 33 uint8 * | |
| 34 | |
| 35 read_Machine_Code_From_File( int numBytesInFile, char *machineCodeFileName ); | |
| 36 | |
| 37 | |
| 38 | |
| 39 | |
| 40 | |
| 41 void | |
| 42 | |
| 43 fill_sim_params_from_bag( SimulationParams *simParams, ParamBag *paramBag ) | |
| 44 | |
| 45 { char *guestAppFileName, *systemCodeFileName; | |
| 46 | |
| 47 int numBytesInGuestApp, numBytesInSystemCode; | |
| 48 | |
| 49 | |
| 50 | |
| 51 ParamStruc *param; | |
| 52 | |
| 53 //param = getParamFromBag( "GuestApplicationFileName", paramBag ); | |
| 54 | |
| 55 guestAppFileName = param->strValue; | |
| 56 | |
| 57 //param = getParamFromBag( "numBytesInGuestApp", paramBag ); | |
| 58 | |
| 59 numBytesInGuestApp = param->intValue; | |
| 60 | |
| 61 | |
| 62 | |
| 63 simParams->guestApp = | |
| 64 | |
| 65 read_Machine_Code_From_File( numBytesInGuestApp, guestAppFileName ); | |
| 66 | |
| 67 | |
| 68 | |
| 69 //param = getParamFromBag( "SystemCodeFileName", paramBag ); | |
| 70 | |
| 71 systemCodeFileName = param->strValue; | |
| 72 | |
| 73 //param = getParamFromBag( "numBytesInSystemCode", paramBag ); | |
| 74 | |
| 75 numBytesInSystemCode = param->intValue; | |
| 76 | |
| 77 | |
| 78 | |
| 79 simParams->systemCode = | |
| 80 | |
| 81 read_Machine_Code_From_File( numBytesInSystemCode, systemCodeFileName ); | |
| 82 | |
| 83 | |
| 84 | |
| 85 | |
| 86 | |
| 87 //param = getParamFromBag( "numNodes", paramBag ); | |
| 88 | |
| 89 simParams->numNodes = param->intValue; | |
| 90 | |
| 91 | |
| 92 | |
| 93 } | |
| 94 | |
| 95 | |
| 96 | |
| 97 | |
| 98 | |
| 99 | |
| 100 | |
| 101 uint8 * | |
| 102 | |
| 103 read_Machine_Code_From_File( int numBytesInFile, char *machineCodeFileName ) | |
| 104 | |
| 105 { int byte; | |
| 106 | |
| 107 FILE *file; | |
| 108 | |
| 109 char *machineCode = malloc( numBytesInFile ); | |
| 110 | |
| 111 if( machineCode == NULL ) printf( "\nno mem for machine code\n" ); | |
| 112 | |
| 113 | |
| 114 | |
| 115 file = fopen( machineCodeFileName, "r" ); | |
| 116 | |
| 117 if( file == NULL ) { printf( "\nCouldn't open file!!\n"); exit(1);} | |
| 118 | |
| 119 | |
| 120 | |
| 121 fseek( file, 0, SEEK_SET ); | |
| 122 | |
| 123 for( byte = 0; byte < numBytesInFile; byte++ ) | |
| 124 | |
| 125 { | |
| 126 | |
| 127 if( feof( file ) ) printf( "file ran out too soon" ); | |
| 128 | |
| 129 // machineCode[byte] = getchar( file ); | |
| 130 | |
| 131 | |
| 132 | |
| 133 } | |
| 134 | |
| 135 return machineCode; | |
| 136 | |
| 137 } | |
| 138 | |
| 139 | |
| 140 | |
| 141 | |
| 142 | |
| 143 //========================================================================== | |
| 144 | |
| 145 void | |
| 146 | |
| 147 printSimResults( SimulationResults simResults ) | |
| 148 | |
| 149 { | |
| 150 | |
| 151 } | |
| 152 | |
| 153 | |
| 154 | |
| 155 |
