changeset 0:def43ecee616

Initial add
author Me@portablequad
date Sat, 11 Feb 2012 14:29:21 -0800
parents
children 46c8ea895bff
files .hgeol .hgignore CircuitNetlistCreator.c HWSim__LPGPU_Arch__HWDef/FakeSim.c HWSim__LPGPU_Arch__HWDef/HWSim__PingPong__HWDef.h HWSim__LPGPU_Arch__HWDef/HW_DESIGN_NOTES.txt HWSim__LPGPU_Arch__HWDef/PingPong_TimeLine.c SimParams.c SimParams.h main.c
diffstat 10 files changed, 599 insertions(+), 0 deletions(-) [+]
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/.hgeol	Sat Feb 11 14:29:21 2012 -0800
     1.3 @@ -0,0 +1,14 @@
     1.4 +
     1.5 +[patterns]
     1.6 +**.py = native
     1.7 +**.txt = native
     1.8 +**.c = native
     1.9 +**.h = native
    1.10 +**.cpp = native
    1.11 +**.java = native
    1.12 +**.class = bin
    1.13 +**.jar = bin
    1.14 +**.sh = native
    1.15 +**.pl = native
    1.16 +**.jpg = bin
    1.17 +**.gif = bin
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/.hgignore	Sat Feb 11 14:29:21 2012 -0800
     2.3 @@ -0,0 +1,9 @@
     2.4 +syntax: glob
     2.5 +
     2.6 +nbproject
     2.7 +build
     2.8 +dist
     2.9 +*.o
    2.10 +.dep.inc
    2.11 +Makefile
    2.12 +notes
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/CircuitNetlistCreator.c	Sat Feb 11 14:29:21 2012 -0800
     3.3 @@ -0,0 +1,105 @@
     3.4 +/*
     3.5 + *  Copyright 2011 OpenSourceStewardshipFoundation.org
     3.6 + *  Licensed under GNU General Public License version 2
     3.7 + *
     3.8 + * Author: seanhalle@yahoo.com
     3.9 + *
    3.10 + */
    3.11 + #include "HWSim__Hello_World_HW/HWSim__Hello_World_HW.h"
    3.12 + 
    3.13 +/*'wire' is an expr resolves to an actual wire struct instance
    3.14 + */
    3.15 +#define setWireValuesTo( wire, fromTLIdx, outPort, toTLIdx, inPort, dataPtr)\
    3.16 +do{\
    3.17 +   wire->idxOfFromTimeline = fromTLIdx; \
    3.18 +   wire->idxOfFromOutPort  = fromTLIdx; \
    3.19 +   wire->idxOfToTimeline   = toTLIdx; \
    3.20 +   wire->idxOfToInPort     = inPort; \
    3.21 +   wire->archSpecCommPathData  = dataPtr; \
    3.22 + }while(0); //macro magic for namespace
    3.23 +
    3.24 +
    3.25 +HWSimSpanType* createPingPongSpanType (); 
    3.26 +
    3.27 +HWSimTimeline* createAPingPongTimeline (HWSimNetlist *netlist);
    3.28 +
    3.29 +/*This file constructs the netlist for the Hello World circuit, which is
    3.30 + * used during design and implementation of the HWSim language
    3.31 + *
    3.32 + *It has two timelines, each with one input port and one output port, and
    3.33 + * a single span-type.
    3.34 + *
    3.35 + *The timelines are cross-coupled, so output port of one connects to input
    3.36 + * port of the other.  The input port has a single trigger, which fires
    3.37 + * the one span-type.
    3.38 + *
    3.39 + *The span does nothing, except send a NULL message on the output port.
    3.40 + *The span-sim-time and communication-sim-time are both constants.
    3.41 + *
    3.42 + *Note that timelines are generic.  They are specialized by declaring
    3.43 + * inports and outports, and by registering triggers that fire particular
    3.44 + * span-types.
    3.45 + */
    3.46 +HWSimNetlist *createPingPongNetlist()
    3.47 + { HWSimNetlist   *netlist;
    3.48 +   HWSimCommPath  **wires;
    3.49 +   HWSimTimeline **timelines;
    3.50 +   int32 numTimelines;
    3.51 +   int32 numWires;
    3.52 +	HWSimSpanType *foo;
    3.53 +   
    3.54 +   netlist = malloc( sizeof(HWSimNetlist) );
    3.55 +   //declare timelines   numTimelines = 2;
    3.56 +   timelines = malloc( numTimelines * sizeof(HWSimTimeline) );
    3.57 +   netlist->numTimelines = numTimelines;
    3.58 +   netlist->timelines    = timelines;
    3.59 +   netlist->numSpanTypes = 1;
    3.60 +   netlist->spanTypes = malloc(netlist->numSpanTypes*sizeof(HWSimSpanType*));
    3.61 +   netlist->spanTypes[PING_PONG_TYPE] = createPingPongSpanType();
    3.62 +   timelines[0] = createAPingPongTimeline( netlist ); //use info from netlist
    3.63 +   timelines[1] = createAPingPongTimeline( netlist ); 
    3.64 +      //on one of the timelines, make reset trigger an action   
    3.65 +   timelines[1]->inPorts[-1].triggeredSpanType =
    3.66 +              netlist->spanTypes[PING_PONG_TYPE]; //Connect timelines together
    3.67 +			  
    3.68 +	/*OutPorts and InPorts may have many wires attached, but an inPort only     
    3.69 +	 * has one kind of span that all incoming communications trigger.  That
    3.70 +	 * span can be zero time and then switch on the type of message then
    3.71 +	 * end with a continuation, where the continuation span is chosen by the    
    3.72 +	 * switch. 
    3.73 +	 *So, a wire only connects an out port to an in port
    3.74 +	 *The format is: sending TL-index, out-port, dest TL-index, in-port
    3.75 +	 */
    3.76 +   numWires          = 2;
    3.77 +   wires             = malloc( numWires * sizeof(HWSimCommPath) );
    3.78 +   netlist->numCommPaths= numWires;
    3.79 +   netlist->commPaths= wires;
    3.80 +   //TL 0, out-port 0 to TL 1, in-port 0
    3.81 +   setWireValuesTo(wires[0], 0,0,1,0, NULL); //These NetlistWires turned into
    3.82 +   setWireValuesTo(wires[1], 1,0,0,0, NULL); // HWSimWires inside ckt create
    3.83 +   //TODO: decide how do in-out bidirectional wires -- thinking make it two
    3.84 +   // separate wires with guard between in-port and out-port
    3.85 +   //TODO: decide how do guards between ports
    3.86 + }
    3.87 + 
    3.88 +   //Note: copy netlist struct with VMS malloc after VMS initialized
    3.89 +HWSimTimeline *
    3.90 +createAPingPongTimeline( HWSimNetlist *netlist )
    3.91 + { HWSimTimeline *TL;
    3.92 +   TL = malloc( sizeof(HWSimTimeline) );
    3.93 +   TL->numInPorts  = 1;
    3.94 +   TL->numOutPorts = 1;
    3.95 +   TL->inPorts = HWSim_ext__make_inPortsArray( TL->numInPorts );
    3.96 +   TL->inPorts[-1].triggeredSpanType = IDLE_SPAN; //reset port
    3.97 +   TL->inPorts[0].triggeredSpanType  = netlist->spanTypes[PING_PONG_TYPE];
    3.98 + }
    3.99 + 
   3.100 +HWSimSpanType *
   3.101 +createPingPongSpanType( )
   3.102 + { HWSimSpanType *pingPongSpanType;
   3.103 +   pingPongSpanType = malloc( sizeof(HWSimSpanType) );
   3.104 +   pingPongSpanType->behaviorFn = &behaviorOf_ping_pong_span;
   3.105 +   pingPongSpanType->timingFn   = &timingOf_ping_pong_span;
   3.106 +   return pingPongSpanType;
   3.107 + } 
   3.108 + 
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/HWSim__LPGPU_Arch__HWDef/FakeSim.c	Sat Feb 11 14:29:21 2012 -0800
     4.3 @@ -0,0 +1,126 @@
     4.4 +#include <stdlib.h>
     4.5 +#include "HWSim__Hello_World_HW.h"
     4.6 +
     4.7 +void checkMalloc (void *ptr) {
     4.8 +	if (ptr == NULL) {
     4.9 +		printf("Memory allocation failed!\n");
    4.10 +		exit(1);
    4.11 +	}
    4.12 +}
    4.13 +
    4.14 +HWSimTimeline* malloc_timlines (int nrTimelines) {
    4.15 +	HWSimTimeline *timelines;
    4.16 +	int i;
    4.17 +
    4.18 +	timelines= malloc(nrTimelines*(sizeof(HWSimTimeline)));
    4.19 +	checkMalloc(timelines);
    4.20 +	for (i= 0; i<nrTimelines; i++) {
    4.21 +		timelines[i].animatingVP= malloc(sizeof(VirtProcr));
    4.22 +		checkMalloc(timelines[i].animatingVP);
    4.23 +	}
    4.24 +	return timelines;
    4.25 +}
    4.26 +
    4.27 +HWSimResults* malloc_simResults (int nrExecutions, int nrComms) {
    4.28 +	HWSimResults *simResults;
    4.29 +	int i;
    4.30 +	
    4.31 +	
    4.32 +	simResults= malloc(sizeof(HWSimResults));
    4.33 +	checkMalloc(simResults);
    4.34 +
    4.35 +	simResults->numTimelines= nrExecutions;
    4.36 +	simResults->timelineTraces= 
    4.37 +		malloc(simResults->numTimelines*sizeof(HWSimTimelineTrace *));
    4.38 +
    4.39 +	for (i= 0; i<simResults->numTimelines; i++) {
    4.40 +		simResults->timelineTraces[i]= malloc(sizeof(HWSimTimelineTrace));
    4.41 +		checkMalloc(simResults->timelineTraces[i]);
    4.42 +		simResults->timelineTraces[i]->spanRecs= malloc(sizeof(HWSimSpanRec));
    4.43 +	}
    4.44 +
    4.45 +	simResults->numCommTraces= nrComms;
    4.46 +	simResults->commTraces= 
    4.47 +		malloc(simResults->numCommTraces*sizeof(HWSimWireTrace *));
    4.48 +	checkMalloc(simResults->commTraces);
    4.49 +	for (i= 0; i<simResults->numCommTraces; i++) {
    4.50 +		simResults->commTraces[i]= malloc(sizeof(HWSimWireTrace));
    4.51 +		checkMalloc(simResults->commTraces[i]);
    4.52 +		// FRAGILE -> valgrind
    4.53 +		simResults->commTraces[i]->commRecs= malloc(sizeof(HWSimCommRec));
    4.54 +		checkMalloc(simResults->commTraces[i]->commRecs);
    4.55 +	}
    4.56 +
    4.57 +	return simResults;
    4.58 +}
    4.59 +
    4.60 +HWSimResults* create_simulation_results__fake(void *simParams,HWSimNetlist *netlist) {
    4.61 +	HWSimResults *simResults;
    4.62 +
    4.63 +	simResults= malloc_simResults(4,3);
    4.64 +
    4.65 +	//--------------- timelineTraces ------------------------------------
    4.66 +	// 2 times a ping span
    4.67 +	simResults->timelineTraces[0]->timeline= netlist->timelines[0]; 
    4.68 +	simResults->timelineTraces[0]->spanRecs->spanSeqNum= 0; // unique ???
    4.69 +	simResults->timelineTraces[0]->spanRecs->startTime= 1;
    4.70 +	simResults->timelineTraces[0]->spanRecs->endTime=2;
    4.71 +
    4.72 +	simResults->timelineTraces[1]->timeline= netlist->timelines[0]; 
    4.73 +	simResults->timelineTraces[1]->spanRecs->spanSeqNum= 1;
    4.74 +	simResults->timelineTraces[1]->spanRecs->startTime= 5;
    4.75 +	simResults->timelineTraces[1]->spanRecs->endTime=6;
    4.76 +
    4.77 +	// 2 times a pong span
    4.78 +	simResults->timelineTraces[2]->timeline= netlist->timelines[1];
    4.79 +	simResults->timelineTraces[2]->spanRecs->spanSeqNum= 2; // unique ???
    4.80 +	simResults->timelineTraces[2]->spanRecs->startTime= 3;
    4.81 +	simResults->timelineTraces[2]->spanRecs->endTime=4;
    4.82 +
    4.83 +	simResults->timelineTraces[3]->timeline= netlist->timelines[1]; 
    4.84 +	simResults->timelineTraces[3]->spanRecs->spanSeqNum= 3;
    4.85 +	simResults->timelineTraces[3]->spanRecs->startTime= 7;
    4.86 +	simResults->timelineTraces[3]->spanRecs->endTime=8;
    4.87 +
    4.88 +
    4.89 +	// a HWSimTimeline does not contain any helpful additional information to
    4.90 +	// identify or label a Timeline .
    4.91 +	// But a unique Timeline identifier is disireable. Therefore at the moment the
    4.92 +	// procrID of the anumating Procr ist used
    4.93 +
    4.94 +	// Information about the Span is required, at least a ID.The current
    4.95 +	// spanType doesn't provide it
    4.96 +
    4.97 +
    4.98 +	//--------------------  Coomunication Trace ---------------------
    4.99 +
   4.100 +	//ping to pong 2 - 3 
   4.101 +	simResults->commTraces[0]->fromTimeline= netlist->timelines[0];
   4.102 +	simResults->commTraces[0]->toTimeline= netlist->timelines[1];
   4.103 +	simResults->commTraces[0]->numComms= 1;
   4.104 +	simResults->commTraces[0]->commRecs->commID= 0;
   4.105 +	simResults->commTraces[0]->commRecs->msgID= 0;
   4.106 +	simResults->commTraces[0]->commRecs->startTime= 2;
   4.107 +	simResults->commTraces[0]->commRecs->endTime= 3;
   4.108 +
   4.109 +	//pong to ping 4 - 5 
   4.110 +	simResults->commTraces[1]->fromTimeline= netlist->timelines[1];
   4.111 +	simResults->commTraces[1]->toTimeline= netlist->timelines[0];
   4.112 +	simResults->commTraces[1]->numComms= 1;
   4.113 +	simResults->commTraces[1]->commRecs->commID= 1;
   4.114 +	simResults->commTraces[1]->commRecs->msgID= 1;
   4.115 +	simResults->commTraces[1]->commRecs->startTime= 4;
   4.116 +	simResults->commTraces[1]->commRecs->endTime= 5;
   4.117 +
   4.118 +	//ping to pong 6 - 7 
   4.119 +	simResults->commTraces[2]->fromTimeline= netlist->timelines[0];
   4.120 +	simResults->commTraces[2]->toTimeline= netlist->timelines[1];
   4.121 +	simResults->commTraces[2]->numComms= 1;
   4.122 +	simResults->commTraces[2]->commRecs= malloc(sizeof(HWSimCommRec));
   4.123 +	simResults->commTraces[2]->commRecs->commID= 2;
   4.124 +	simResults->commTraces[2]->commRecs->msgID= 0;
   4.125 +	simResults->commTraces[2]->commRecs->startTime= 6;
   4.126 +	simResults->commTraces[2]->commRecs->endTime= 7;
   4.127 +
   4.128 +	return simResults;
   4.129 +}
     5.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.2 +++ b/HWSim__LPGPU_Arch__HWDef/HWSim__PingPong__HWDef.h	Sat Feb 11 14:29:21 2012 -0800
     5.3 @@ -0,0 +1,48 @@
     5.4 +/*
     5.5 + *  Copyright 2011 OpenSourceStewardshipFoundation.org
     5.6 + *  Licensed under GNU General Public License version 2
     5.7 + */
     5.8 +
     5.9 +
    5.10 +#ifndef _HWSim_TERAFLUX_H_
    5.11 +#define _HWSim_TERAFLUX_H_
    5.12 +
    5.13 +#include <stdio.h>
    5.14 +
    5.15 +#include "../../HWSim_lib/HWSim_lib.h"
    5.16 +
    5.17 +
    5.18 +//===============================  Defines  ==============================
    5.19 +   //Port 0 is unused, as a bug-catch
    5.20 +#define COMMUNICATOR_OUTPORT  1
    5.21 +
    5.22 +//Different spanTypes
    5.23 +#define PING_PONG_TYPE 0
    5.24 +
    5.25 +
    5.26 +//==============================  Structures  ==============================
    5.27 +typedef struct
    5.28 + { 
    5.29 + }
    5.30 +PingPongParams;
    5.31 +
    5.32 +
    5.33 +//============================= Span Functions =========================
    5.34 +void *
    5.35 +behaviorOf_ping_pong_span( void *_params, HWSimTimeline *timeLine );
    5.36 +
    5.37 +uint64
    5.38 +timingOf_ping_pong_span( void * dataFromBehaviorFn );
    5.39 +
    5.40 +//======================== Simulation Fake ==================================
    5.41 +#ifdef FAKE
    5.42 +HWSimResults* create_simulation_results__fake(void *simParams,HWSimNetlist *netlist);
    5.43 +#endif
    5.44 +
    5.45 +//======================== Netlist creation ==================================
    5.46 +
    5.47 +HWSimNetlist* createPingPongNetlist ();
    5.48 +
    5.49 +#endif /**/
    5.50 +
    5.51 +
     6.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.2 +++ b/HWSim__LPGPU_Arch__HWDef/HW_DESIGN_NOTES.txt	Sat Feb 11 14:29:21 2012 -0800
     6.3 @@ -0,0 +1,1 @@
     6.4 +Implementing the hardware model
     6.5 
     6.6 
     6.7 This is the "hello world" for HWSim.  It is hardware that has just two timelines that send a message back and forth between them.  The message has no content, it simply triggers the other timeline, which then sends the same empty message back, repeating the cycle.
     6.8 
     6.9 Each timeline has one in-port and one out-port.  The out-port of the first timeline is connected to the in-port of the second and vice-versa.
    6.10 
    6.11 The code of the span consists only of sending an empty message on the timeline's out-port.
    6.12 
    6.13 The trigger for the span is registered on the in-port and message type 0.
    6.14 
    6.15 The span timing is a constant.
    6.16 
    6.17 The port-to-port timing is a constant.
    6.18 
    6.19 Both timelines are in the same time-domain.
    6.20 
    6.21 at_reset of one timeline is set to the ping-pong span, the other timeline's at_reset is set to idle.
    6.22 
    6.23 And that is the entire hardware.
    6.24 
    6.25 \ No newline at end of file
     7.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     7.2 +++ b/HWSim__LPGPU_Arch__HWDef/PingPong_TimeLine.c	Sat Feb 11 14:29:21 2012 -0800
     7.3 @@ -0,0 +1,44 @@
     7.4 +/*
     7.5 + *  Copyright 2011 OpenSourceStewardshipFoundation.org
     7.6 + *  Licensed under GNU General Public License version 2
     7.7 + *
     7.8 + * Author: seanhalle@yahoo.com
     7.9 + *
    7.10 + */
    7.11 +
    7.12 +#include "HWSim__Hello_World_HW.h"
    7.13 +
    7.14 +
    7.15 +
    7.16 +//====================================================================
    7.17 +/*This is the ping-pong timeline for the Hello World hardware
    7.18 + *
    7.19 + *It has only one kind of span, which only puts a communication on
    7.20 + * the timeline's one out-port.
    7.21 + * 
    7.22 + *The in-port has only one trigger registered on it, which fires that
    7.23 + * span.
    7.24 + */
    7.25 +
    7.26 +#define NO_MSG NULL
    7.27 +#define PORT0 0
    7.28 +
    7.29 +/*
    7.30 + *Note, the returned value is passed to the timing function
    7.31 + */
    7.32 +void *
    7.33 +behaviorOf_ping_pong_span( void *_params, HWSimTimeline *timeline )
    7.34 + {
    7.35 +   PingPongParams  *params;
    7.36 +   params    = (PingPongParams *)_params;
    7.37 +//         DEBUG( dbgHW, "ping pong span\n", clone_PingPongParams(params) );
    7.38 +   
    7.39 +//   HWSim__send_on_port( NO_MSG, PORT0, timeline );
    7.40 + }
    7.41 +
    7.42 +HWSimTimePeriod
    7.43 +timingOf_ping_pong_span( void * dataFromBehaviorFn )
    7.44 + {
    7.45 +   return 10;
    7.46 + }
    7.47 +
     8.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     8.2 +++ b/SimParams.c	Sat Feb 11 14:29:21 2012 -0800
     8.3 @@ -0,0 +1,155 @@
     8.4 +/*
     8.5 +
     8.6 + *  Copyright 2009 OpenSourceStewardshipFoundation.org
     8.7 +
     8.8 + *  Licensed under GNU General Public License version 2
     8.9 +
    8.10 + *
    8.11 +
    8.12 + * Author: seanhalle@yahoo.com
    8.13 +
    8.14 + *
    8.15 +
    8.16 + * Created on November 15, 2009, 2:35 AM
    8.17 +
    8.18 + */
    8.19 +
    8.20 +
    8.21 +
    8.22 +#include <malloc.h>
    8.23 +
    8.24 +#include <stdlib.h>
    8.25 +
    8.26 +
    8.27 +
    8.28 +#include "SimParams.h"
    8.29 +
    8.30 +#include "ParamHelper/Param.h"
    8.31 +
    8.32 +
    8.33 +
    8.34 +
    8.35 +
    8.36 +uint8 *
    8.37 +
    8.38 +read_Machine_Code_From_File( int numBytesInFile, char *machineCodeFileName );
    8.39 +
    8.40 +
    8.41 +
    8.42 + 
    8.43 +
    8.44 +void
    8.45 +
    8.46 +fill_sim_params_from_bag( SimulationParams *simParams, ParamBag *paramBag )
    8.47 +
    8.48 + { char *guestAppFileName, *systemCodeFileName;
    8.49 +
    8.50 +   int numBytesInGuestApp, numBytesInSystemCode;
    8.51 +
    8.52 +   
    8.53 +
    8.54 +      ParamStruc *param;
    8.55 +
    8.56 +      //param = getParamFromBag( "GuestApplicationFileName", paramBag );
    8.57 +
    8.58 +   guestAppFileName = param->strValue;
    8.59 +
    8.60 +      //param = getParamFromBag( "numBytesInGuestApp", paramBag );
    8.61 +
    8.62 +   numBytesInGuestApp = param->intValue;
    8.63 +
    8.64 +
    8.65 +
    8.66 +   simParams->guestApp =
    8.67 +
    8.68 +    read_Machine_Code_From_File( numBytesInGuestApp, guestAppFileName );
    8.69 +
    8.70 +
    8.71 +
    8.72 +      //param = getParamFromBag( "SystemCodeFileName", paramBag );
    8.73 +
    8.74 +   systemCodeFileName = param->strValue;
    8.75 +
    8.76 +      //param = getParamFromBag( "numBytesInSystemCode", paramBag );
    8.77 +
    8.78 +   numBytesInSystemCode = param->intValue;
    8.79 +
    8.80 +
    8.81 +
    8.82 +   simParams->systemCode =
    8.83 +
    8.84 +    read_Machine_Code_From_File( numBytesInSystemCode, systemCodeFileName );
    8.85 +
    8.86 +
    8.87 +
    8.88 +
    8.89 +
    8.90 +      //param = getParamFromBag( "numNodes", paramBag );
    8.91 +
    8.92 +   simParams->numNodes = param->intValue;
    8.93 +
    8.94 +
    8.95 +
    8.96 + }
    8.97 +
    8.98 +
    8.99 +
   8.100 +
   8.101 +
   8.102 +
   8.103 +
   8.104 +uint8 *
   8.105 +
   8.106 +read_Machine_Code_From_File( int numBytesInFile, char *machineCodeFileName )
   8.107 +
   8.108 + { int byte;
   8.109 +
   8.110 +   FILE  *file;
   8.111 +
   8.112 +   char  *machineCode = malloc( numBytesInFile );
   8.113 +
   8.114 +   if( machineCode == NULL ) printf( "\nno mem for machine code\n" );
   8.115 +
   8.116 +   
   8.117 +
   8.118 +   file = fopen( machineCodeFileName, "r" );
   8.119 +
   8.120 +   if( file == NULL ) { printf( "\nCouldn't open file!!\n"); exit(1);}
   8.121 +
   8.122 +
   8.123 +
   8.124 +   fseek( file, 0, SEEK_SET );
   8.125 +
   8.126 +   for( byte = 0; byte < numBytesInFile; byte++ )
   8.127 +
   8.128 +    {
   8.129 +
   8.130 +      if( feof( file ) )  printf( "file ran out too soon" );
   8.131 +
   8.132 +//      machineCode[byte] = getchar( file );
   8.133 +
   8.134 +      
   8.135 +
   8.136 +    }
   8.137 +
   8.138 +   return machineCode;
   8.139 +
   8.140 + }
   8.141 +
   8.142 +
   8.143 +
   8.144 +
   8.145 +
   8.146 + //==========================================================================
   8.147 +
   8.148 +void
   8.149 +
   8.150 +printSimResults( SimulationResults simResults )
   8.151 +
   8.152 + { 
   8.153 +
   8.154 + }
   8.155 +
   8.156 +
   8.157 +
   8.158 +
     9.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     9.2 +++ b/SimParams.h	Sat Feb 11 14:29:21 2012 -0800
     9.3 @@ -0,0 +1,45 @@
     9.4 +/*
     9.5 + *  Copyright 2011 OpenSourceStewardshipFoundation.org
     9.6 + *  Licensed under GNU General Public License version 2 
     9.7 + */
     9.8 +
     9.9 +#ifndef SIM_PARAMS_
    9.10 +#define SIM_PARAMS_
    9.11 +
    9.12 +#include <stdio.h>
    9.13 +#include <unistd.h>
    9.14 +#include <malloc.h>
    9.15 +
    9.16 +#include "../HWSim_lib/VMS/VMS_primitive_data_types.h"
    9.17 +#include "ParamHelper/Param.h"
    9.18 +
    9.19 +
    9.20 +//==============================  Structures  ==============================
    9.21 +typedef struct
    9.22 + { uint8 *guestApp;
    9.23 +   uint8 *systemCode;
    9.24 +   int32 numNodes;
    9.25 + }
    9.26 +SimulationResults;
    9.27 +
    9.28 +typedef struct
    9.29 + { uint8 *guestApp;
    9.30 +   uint8 *systemCode;
    9.31 +   int32 numNodes;
    9.32 +   SimulationResults *simResults;
    9.33 + }
    9.34 +SimulationParams;
    9.35 +
    9.36 +//==============================  Functions  ================================
    9.37 +void
    9.38 +printSimResults( SimulationResults simResults );
    9.39 +
    9.40 +void
    9.41 +fill_sim_params_from_bag( SimulationParams *simParams, ParamBag *paramBag );
    9.42 +
    9.43 +
    9.44 +//===========================================================================
    9.45 +
    9.46 +#endif /**/
    9.47 +
    9.48 +
    10.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    10.2 +++ b/main.c	Sat Feb 11 14:29:21 2012 -0800
    10.3 @@ -0,0 +1,52 @@
    10.4 +/*
    10.5 + *  Copyright 2011 OpenSourceStewardshipFoundation.org
    10.6 + *  Licensed under BSD
    10.7 + *
    10.8 + * author seanhalle@yahoo.com
    10.9 + */
   10.10 + 
   10.11 +#include <malloc.h>
   10.12 +#include <stdlib.h>
   10.13 +
   10.14 +#include "SimParams.h"
   10.15 +#include "HWSim__Hello_World_HW/HWSim__Hello_World_HW.h"
   10.16 +
   10.17 +char __ProgrammName[] = "HWSim Hello World";
   10.18 +char __DataSet[255];
   10.19 +char __Scheduler[];
   10.20 +
   10.21 +/*
   10.22 + *
   10.23 + * 
   10.24 + */
   10.25 +
   10.26 +int main( int argc, char **argv )
   10.27 + { ParamBag      *simParams;
   10.28 +   HWSimNetlist  *netlist;
   10.29 +   HWSimResults  *simResults;
   10.30 +
   10.31 +   printf( "param file name: %s\n", argv[1] );
   10.32 +   printf("Paraver trace file %s\n", argv[2]);
   10.33 +
   10.34 +#ifdef FAKE
   10.35 +	simParams= NULL;
   10.36 +#else
   10.37 +   simParams = makeParamBag();
   10.38 +   readParamFileIntoBag( argv[1], simParams );
   10.39 +#endif
   10.40 +   
   10.41 +   netlist = createPingPongNetlist();
   10.42 +#ifdef FAKE
   10.43 +   simResults= create_simulation_results__fake(simParams,netlist);
   10.44 +#else
   10.45 +   simResults = 
   10.46 +    HWSim__run_simulation( simParams, netlist );
   10.47 +#endif
   10.48 +
   10.49 +      //HWSim 
   10.50 +   HWSim__generate_paraver_output(argv[2], simResults, netlist);
   10.51 +   //HWSim__generate_vcd_output( simResults );
   10.52 +   
   10.53 +   exit(0); //cleans up
   10.54 + }
   10.55 +