# HG changeset patch # User hausers # Date 1323193602 -3600 # Node ID 648207f2e38fdd97d1c38d6a0fbfd446cca52b6f # Parent 2d3505958ca8024612fc221241b2033f8e354642 Netlist creation runnable + creation of faked simulation results diff -r 2d3505958ca8 -r 648207f2e38f .hgignore --- a/.hgignore Mon Dec 05 12:24:44 2011 +0100 +++ b/.hgignore Tue Dec 06 18:46:42 2011 +0100 @@ -3,4 +3,7 @@ nbproject build dist -*.o \ No newline at end of file +*.o +.dep.inc +Makefile +notes diff -r 2d3505958ca8 -r 648207f2e38f src/Application/CircuitNetlistCreator.c --- a/src/Application/CircuitNetlistCreator.c Mon Dec 05 12:24:44 2011 +0100 +++ b/src/Application/CircuitNetlistCreator.c Tue Dec 06 18:46:42 2011 +0100 @@ -1,1 +1,157 @@ -/* * Copyright 2011 OpenSourceStewardshipFoundation.org * Licensed under GNU General Public License version 2 * * Author: seanhalle@yahoo.com * */ #include "HWSim__Hello_World_HW/HWSim__Hello_World_HW.h" /*This file constructs the netlist for the Hello World circuit, which is * used during design and implementation of the HWSim language * *It has two timelines, each with one input port and one output port, and * a single span-type. * *The timelines are cross-coupled, so output port of one connects to input * port of the other. The input port has a single trigger, which fires * the one span-type. * *The span does nothing, except send a NULL message on the output port. * *The span-sim-time and communication-sim-time are both constants. * *Note that timelines are generic. They are specialized by declaring * inports and outports, and by registering triggers that fire particular * span-types. */ HWSimNetlist * createPingPongNetlist() { HWSimNetlist *netlist; HWSimWire **wires; HWSimTimeline **timelines; int numTimelines; int numWires; netlist = malloc( sizeof(HWSimNetlist) ); //declare timelines numTimelines = 2; timelines = malloc( numTimelines * sizeof(HWSimTimeline) ); netlist->numTimelines = numTimelines; netlist->timelines = timelines; timelines[0] = createAPingPongTimeline(); timelines[1] = createAPingPongTimeline(); //add a trigger to reset port of one of the timelines, to start things HWSimSpanType *pingPongSpan; pingPongSpan = malloc( sizeof(HWSimSpanType) ); pingPongSpan->behaviorFn = &behaviorOf_ping_pong_span; pingPongSpan->timingFn = &timingOf_ping_pong_span; timelines[1]->triggers[0]->inPortNum = -1//the reset port timelines[1]->triggers[0]->spanType = pingPongSpan; //Connect timelines together numWires = 2; wires = malloc( numWires * sizeof(HWSimWire) ); netlist->numWires = numWires; netlist->wires = wires; //TODO:For wires, have many design decisions to make -- driven by impl, so // have to be delayed until get into guts of impl. //TODO: maybe make HWSimWire a union with a 5 (or 6) elem array //TODO: decide if each wire transports only one kind of message or many //TODO: decide if inports accept one wire or many (msg type set by inport) //tl 0, out-port 0 to tl 1, in-port 0, msg-type 0 wires[0] = {0,0,1,0,0}; wires[1] = {1,0,0,0,0}; /* For starters, not doing time-domains.. will add later (Nov 2011) //Create time domains numTimeDomains = 2; timeDomains = malloc( numTimeDomains * sizeof(TimeDomain) ); netlist->numTimeDomains = numTimeDomains; netlist->timeDomains = timeDomains; timeDomains[0]->numDomains = 0; timeDomains[0]->numTimelines = 1; timeDomains[0]->timelines[0] = 0;//is index into netlist->timelines[] timeDomains[1]->numDomains = 0; timeDomains[1]->numTimelines = 1; timeDomains[1]->timelines[0] = 1;//index into netlist->timelines[] //Create time domain connections -- must respect hierarchy numDomainConnections = 2; domainConnects = malloc( numDomainConnections * sizeof(HWSimDomainConn) ); netlist->numDomainConns = numDomainConnections; netlist->domainConns = domainConnects; domainConnects[0] = {0,1}; //domain 0 sends sim-time updates to domain 1 domainConnects[1] = {1,0}; //domain 1 sends sim-time updates to domain 0 */ } HWSimTimeline * createAPingPongTimeline() { HWSimTimeline *tl; HWSimTrigger **triggers; tl = malloc( sizeof(HWSimTimeline) ); tl->numInPorts = 1; tl->numOutPorts = 1; tl->numTriggers = 2; triggers = malloc( 2 * sizeof(HWSimTrigger) ); //extra is reset trig tl->triggers[0].inPortNum = -1; //reset trigger tl->triggers[0].spanType = IDLE_SPAN; HWSimSpanType *pingPongSpan; pingPongSpan = malloc( sizeof(HWSimSpanType) ); pingPongSpan->behaviorFn = &behaviorOf_ping_pong_span; pingPongSpan->timingFn = &timingOf_ping_pong_span; tl->triggers[1].inPortNum = 0; //TODO: Debug: verify whether . or -> tl->triggers[1].spanType = pingPongSpan; } \ No newline at end of file +/* + * Copyright 2011 OpenSourceStewardshipFoundation.org + * Licensed under GNU General Public License version 2 + * + * Author: seanhalle@yahoo.com + * + */ + +#include "HWSim__Hello_World_HW/HWSim__Hello_World_HW.h" + +HWSimTimeline* createAPingPongTimeline (); + + +/*This file constructs the netlist for the Hello World circuit, which is + * used during design and implementation of the HWSim language + * + *It has two timelines, each with one input port and one output port, and + * a single span-type. + * + *The timelines are cross-coupled, so output port of one connects to input + * port of the other. The input port has a single trigger, which fires + * the one span-type. + * + *The span does nothing, except send a NULL message on the output port. + * + *The span-sim-time and communication-sim-time are both constants. + * + *Note that timelines are generic. They are specialized by declaring + * inports and outports, and by registering triggers that fire particular + * span-types. + */ +HWSimNetlist * +createPingPongNetlist() + { HWSimNetlist *netlist; + HWSimWire **wires; + HWSimTimeline **timelines; + + int numTimelines; + int numWires; + + int i; + + netlist = malloc( sizeof(HWSimNetlist) ); + + //declare timelines + numTimelines = 2; + timelines = malloc( numTimelines * sizeof(HWSimTimeline *) ); + netlist->numTimelines = numTimelines; + netlist->timelines = timelines; + + timelines[0] = createAPingPongTimeline(0); + timelines[1] = createAPingPongTimeline(1); + + //add a trigger to reset port of one of the timelines, to start things + HWSimSpanType *pingPongSpan; + pingPongSpan = malloc( sizeof(HWSimSpanType) ); + pingPongSpan->behaviorFn = &behaviorOf_ping_pong_span; + pingPongSpan->timingFn = (void *)&(timingOf_ping_pong_span); + + timelines[1]->triggers[0]->inPortNum = -1;//the reset port + timelines[1]->triggers[0]->spanType = pingPongSpan; + + //Connect timelines together + numWires = 2; + wires = malloc( numWires * sizeof(HWSimWire *) ); + for (i= 0; inumWires = numWires; + netlist->wires = wires; + + //TODO:For wires, have many design decisions to make -- driven by impl, so + // have to be delayed until get into guts of impl. + //TODO: maybe make HWSimWire a union with a 5 (or 6) elem array + //TODO: decide if each wire transports only one kind of message or many + //TODO: decide if inports accept one wire or many (msg type set by inport) + //tl 0, out-port 0 to tl 1, in-port 0, msg-type 0 + wires[0]->idxOfFromTimeline= 0; + wires[0]->fromOutPort= 0; + wires[0]->idxOfToTimeline= 1; + wires[0]->toInPort= 0; + wires[0]->msgType= 0; + wires[1]->idxOfFromTimeline= 1; + wires[1]->fromOutPort= 0; + wires[1]->idxOfToTimeline= 0; + wires[1]->toInPort= 0; + wires[1]->msgType= 0; + + +/* For starters, not doing time-domains.. will add later (Nov 2011) + //Create time domains + numTimeDomains = 2; + timeDomains = malloc( numTimeDomains * sizeof(TimeDomain) ); + netlist->numTimeDomains = numTimeDomains; + netlist->timeDomains = timeDomains; + + timeDomains[0]->numDomains = 0; + timeDomains[0]->numTimelines = 1; + timeDomains[0]->timelines[0] = 0;//is index into netlist->timelines[] + + timeDomains[1]->numDomains = 0; + timeDomains[1]->numTimelines = 1; + timeDomains[1]->timelines[0] = 1;//index into netlist->timelines[] + + //Create time domain connections -- must respect hierarchy + numDomainConnections = 2; + domainConnects = malloc( numDomainConnections * sizeof(HWSimDomainConn) ); + netlist->numDomainConns = numDomainConnections; + netlist->domainConns = domainConnects; + + domainConnects[0] = {0,1}; //domain 0 sends sim-time updates to domain 1 + domainConnects[1] = {1,0}; //domain 1 sends sim-time updates to domain 0 + */ + + return netlist; + } + +HWSimTimeline * +createAPingPongTimeline(int timelineID) + { HWSimTimeline *tl; + int i; +// HWSimTrigger **triggers; + + tl = malloc( sizeof(HWSimTimeline) ); + + tl->timelineID= timelineID; + tl->numInPorts = 1; + tl->numOutPorts = 1; + tl->numTriggers = 2; + + tl->triggers = malloc( 2 * sizeof(HWSimTrigger *) ); //extra is reset trig + for (i= 0; inumTriggers; i++) { + tl->triggers[i]= malloc(sizeof(HWSimTrigger)); + } + + + // FIXME general IDLE_SPAN + HWSimSpanType *idleSpan; + idleSpan= malloc(sizeof(HWSimSpanType)); + idleSpan->behaviorFn= NULL; + idleSpan->timingFn= NULL; + + + tl->triggers[0]->inPortNum = -1; //reset trigger + tl->triggers[0]->spanType = idleSpan; + + HWSimSpanType *pingPongSpan; + pingPongSpan = malloc( sizeof(HWSimSpanType) ); + pingPongSpan->behaviorFn = &behaviorOf_ping_pong_span; + pingPongSpan->timingFn = (void *)&timingOf_ping_pong_span; + + tl->triggers[1]->inPortNum = 0; //TODO: Debug: verify whether . or -> + tl->triggers[1]->spanType = pingPongSpan; + + return tl; + } + diff -r 2d3505958ca8 -r 648207f2e38f src/Application/HWSim__Hello_World_HW/FakeSim.c --- a/src/Application/HWSim__Hello_World_HW/FakeSim.c Mon Dec 05 12:24:44 2011 +0100 +++ b/src/Application/HWSim__Hello_World_HW/FakeSim.c Tue Dec 06 18:46:42 2011 +0100 @@ -1,55 +1,86 @@ +#include #include "HWSim__Hello_World_HW.h" +void checkMalloc (void *ptr) { + if (ptr == NULL) { + printf("Memory allocation failed!\n"); + exit(1); + } +} + +HWSimTimeline* malloc_timlines (int nrTimelines) { + HWSimTimeline *timelines; + int i; + + timelines= malloc(nrTimelines*(sizeof(HWSimTimeline))); + checkMalloc(timelines); + for (i= 0; inumTimelines= nrExecutions; + simResults->timelineTraces= + malloc(simResults->numTimelines*sizeof(HWSimTimelineTrace *)); + + for (i= 0; inumTimelines; i++) { + simResults->timelineTraces[i]= malloc(sizeof(HWSimTimelineTrace)); + checkMalloc(simResults->timelineTraces[i]); + simResults->timelineTraces[i]->spanRecs= malloc(sizeof(HWSimSpanRec)); + } + + simResults->numCommTraces= nrComms; + simResults->commTraces= + malloc(simResults->numCommTraces*sizeof(HWSimWireTrace *)); + checkMalloc(simResults->commTraces); + for (i= 0; inumCommTraces; i++) { + simResults->commTraces[i]= malloc(sizeof(HWSimWireTrace)); + checkMalloc(simResults->commTraces[i]); + // FRAGILE -> valgrind + simResults->commTraces[i]->commRecs= malloc(sizeof(HWSimCommRec)); + checkMalloc(simResults->commTraces[i]->commRecs); + } + + return simResults; +} + HWSimResults* create_simulation_results__fake(void *simParams,HWSimNetlist *netlist) { HWSimResults *simResults; - HWSimTimeline *pingTimeline,*pongTimeline; - - // 2 timelines - pingTimeline= malloc(sizeof(HWSimTimeline)); - pingTimeline->animatingVP= malloc(sizeof(VirtProcr)); - pingTimeline->animatingVP->procrID= 0; + simResults= malloc_simResults(4,3); - pongTimeline= malloc(sizeof(HWSimTimeline)); - pongTimeline->animatingVP= malloc(sizeof(VirtProcr)); - pongTimeline->animatingVP->procrID= 1; + //--------------- timelineTraces ------------------------------------ + // 2 times a ping span + simResults->timelineTraces[0]->timeline= netlist->timelines[0]; + simResults->timelineTraces[0]->spanRecs->spanSeqNum= 0; // unique ??? + simResults->timelineTraces[0]->spanRecs->startTime= 1; + simResults->timelineTraces[0]->spanRecs->endTime=2; - simResults= malloc(sizeof(HWSimResults)); - - //--------------- timelineTrace ------------------------------------ - simResults->numTimelines= 2; - simResults->timelineTraces= malloc(simResults->numTimelines*sizeof(HWSimTimelineTrace)); - - simResults->timelineTraces[0]->timeline= pingTimeline; - simResults->timelineTraces[0]->numSpans= 2; - simResults->timelineTraces[0]->spanRecs= malloc(simResults->timelineTraces[0]->numSpans*sizeof(HWSimSpanRec)); - - // 2 times a ping span - // no idle spans included (not required ??) - simResults->timelineTraces[0]->spanRecs[0]->spanSeqNum= 0; // unique ??? - simResults->timelineTraces[0]->spanRecs[0]->spanType= NULL; - simResults->timelineTraces[0]->spanRecs[0]->startTime= 1; - simResults->timelineTraces[0]->spanRecs[0]->endTime=2; - - simResults->timelineTraces[0]->spanRecs[1]->spanSeqNum= 1; - simResults->timelineTraces[0]->spanRecs[1]->spanType= NULL; - simResults->timelineTraces[0]->spanRecs[1]->startTime= 5; - simResults->timelineTraces[0]->spanRecs[1]->endTime=6; - - simResults->timelineTraces[1]->timeline= pongTimeline; - simResults->timelineTraces[1]->numSpans= 2; - simResults->timelineTraces[1]->spanRecs= malloc(simResults->timelineTraces[1]->numSpans*sizeof(HWSimSpanRec)); + simResults->timelineTraces[1]->timeline= netlist->timelines[0]; + simResults->timelineTraces[1]->spanRecs->spanSeqNum= 1; + simResults->timelineTraces[1]->spanRecs->startTime= 5; + simResults->timelineTraces[1]->spanRecs->endTime=6; // 2 times a pong span - simResults->timelineTraces[1]->spanRecs[0]->spanSeqNum= 2; // unique ??? - simResults->timelineTraces[1]->spanRecs[0]->spanType= NULL; - simResults->timelineTraces[1]->spanRecs[0]->startTime= 3; - simResults->timelineTraces[1]->spanRecs[0]->endTime=4; + simResults->timelineTraces[2]->timeline= netlist->timelines[1]; + simResults->timelineTraces[2]->spanRecs->spanSeqNum= 2; // unique ??? + simResults->timelineTraces[2]->spanRecs->startTime= 3; + simResults->timelineTraces[2]->spanRecs->endTime=4; - simResults->timelineTraces[1]->spanRecs[1]->spanSeqNum= 3; - simResults->timelineTraces[1]->spanRecs[1]->spanType= NULL; - simResults->timelineTraces[1]->spanRecs[1]->startTime= 7; - simResults->timelineTraces[1]->spanRecs[1]->endTime=8; + simResults->timelineTraces[3]->timeline= netlist->timelines[1]; + simResults->timelineTraces[3]->spanRecs->spanSeqNum= 3; + simResults->timelineTraces[3]->spanRecs->startTime= 7; + simResults->timelineTraces[3]->spanRecs->endTime=8; // a HWSimTimeline does not contain any helpful additional information to @@ -62,39 +93,34 @@ //-------------------- Coomunication Trace --------------------- - simResults->numCommTraces= 3; - simResults->commTrace= malloc(simResults->numCommTraces*sizeof(HWSimWireTrace)); //ping to pong 2 - 3 - simResults->commTrace[0]->fromTimeline= pingTimeline; - simResults->commTrace[0]->toTimeline= pongTimeline; - simResults->commTrace[0]->numComms= 1; - simResults->commTrace[0]->commRecs= malloc(sizeof(HWSimCommRec)); - simResults->commTrace[0]->commRecs->commID= 0; - simResults->commTrace[0]->commRecs->msgID= 0; - simResults->commTrace[0]->commRecs->startTime= 2; - simResults->commTrace[0]->commRecs->endTime= 3; + simResults->commTraces[0]->fromTimeline= netlist->timelines[0]; + simResults->commTraces[0]->toTimeline= netlist->timelines[1]; + simResults->commTraces[0]->numComms= 1; + simResults->commTraces[0]->commRecs->commID= 0; + simResults->commTraces[0]->commRecs->msgID= 0; + simResults->commTraces[0]->commRecs->startTime= 2; + simResults->commTraces[0]->commRecs->endTime= 3; //pong to ping 4 - 5 - simResults->commTrace[1]->fromTimeline= pongTimeline; - simResults->commTrace[1]->toTimeline= pingTimeline; - simResults->commTrace[1]->numComms= 1; - simResults->commTrace[1]->commRecs= malloc(sizeof(HWSimCommRec)); - simResults->commTrace[1]->commRecs->commID= 1; - simResults->commTrace[1]->commRecs->msgID= 1; - simResults->commTrace[1]->commRecs->startTime= 4; - simResults->commTrace[1]->commRecs->endTime= 5; + simResults->commTraces[1]->fromTimeline= netlist->timelines[1]; + simResults->commTraces[1]->toTimeline= netlist->timelines[0]; + simResults->commTraces[1]->numComms= 1; + simResults->commTraces[1]->commRecs->commID= 1; + simResults->commTraces[1]->commRecs->msgID= 1; + simResults->commTraces[1]->commRecs->startTime= 4; + simResults->commTraces[1]->commRecs->endTime= 5; //ping to pong 6 - 7 - simResults->commTrace[2]->fromTimeline= pingTimeline; - simResults->commTrace[2]->toTimeline= pongTimeline; - simResults->commTrace[2]->numComms= 1; - simResults->commTrace[2]->commRecs= malloc(sizeof(HWSimCommRec)); - simResults->commTrace[2]->commRecs->commID= 2; - simResults->commTrace[2]->commRecs->msgID= 0; - simResults->commTrace[2]->commRecs->startTime= 6; - simResults->commTrace[2]->commRecs->endTime= 7; + simResults->commTraces[2]->fromTimeline= netlist->timelines[0]; + simResults->commTraces[2]->toTimeline= netlist->timelines[1]; + simResults->commTraces[2]->numComms= 1; + simResults->commTraces[2]->commRecs= malloc(sizeof(HWSimCommRec)); + simResults->commTraces[2]->commRecs->commID= 2; + simResults->commTraces[2]->commRecs->msgID= 0; + simResults->commTraces[2]->commRecs->startTime= 6; + simResults->commTraces[2]->commRecs->endTime= 7; return simResults; - } diff -r 2d3505958ca8 -r 648207f2e38f src/Application/HWSim__Hello_World_HW/HWSim__Hello_World_HW.h --- a/src/Application/HWSim__Hello_World_HW/HWSim__Hello_World_HW.h Mon Dec 05 12:24:44 2011 +0100 +++ b/src/Application/HWSim__Hello_World_HW/HWSim__Hello_World_HW.h Tue Dec 06 18:46:42 2011 +0100 @@ -1,1 +1,45 @@ -/* * Copyright 2011 OpenSourceStewardshipFoundation.org * Licensed under GNU General Public License version 2 */ #ifndef _HWSim_TERAFLUX_H_ #define _HWSim_TERAFLUX_H_ #include #include "../../HWSim_lib/HWSim.h" //=============================== Defines ============================== //Port 0 is unused, as a bug-catch #define COMMUNICATOR_OUTPORT 1 //============================== Structures ============================== typedef struct { } PingPongParams; //============================= Span Functions ========================= void * behaviorOf_ping_pong_span( void *_params, VirtProcr *timeLine ); uint64 timingOf_ping_pong_span( void * dataFromBehaviorFn ); #endif /**/ \ No newline at end of file +/* + * Copyright 2011 OpenSourceStewardshipFoundation.org + * Licensed under GNU General Public License version 2 + */ + + +#ifndef _HWSim_TERAFLUX_H_ +#define _HWSim_TERAFLUX_H_ + +#include + +#include "../../HWSim_lib/HWSim.h" + + +//=============================== Defines ============================== + //Port 0 is unused, as a bug-catch +#define COMMUNICATOR_OUTPORT 1 + + +//============================== Structures ============================== +typedef struct + { + } +PingPongParams; + + +//============================= Span Functions ========================= +void * +behaviorOf_ping_pong_span( void *_params, HWSimTimeline *timeLine ); + +uint64 +timingOf_ping_pong_span( void * dataFromBehaviorFn ); + +//======================== Simulation Fake ================================== +#ifdef FAKE +HWSimResults* create_simulation_results__fake(void *simParams,HWSimNetlist *netlist); +#endif + +//======================== Netlist creation ================================== + +HWSimNetlist* createPingPongNetlist (); + +#endif /**/ + + diff -r 2d3505958ca8 -r 648207f2e38f src/Application/HWSim__Hello_World_HW/PingPong_TimeLine.c --- a/src/Application/HWSim__Hello_World_HW/PingPong_TimeLine.c Mon Dec 05 12:24:44 2011 +0100 +++ b/src/Application/HWSim__Hello_World_HW/PingPong_TimeLine.c Tue Dec 06 18:46:42 2011 +0100 @@ -1,1 +1,44 @@ -/* * Copyright 2011 OpenSourceStewardshipFoundation.org * Licensed under GNU General Public License version 2 * * Author: seanhalle@yahoo.com * */ #include "HWSim__Hello_World_HW.h" //==================================================================== /*This is the ping-pong timeline for the Hello World hardware * *It has only one kind of span, which only puts a communication on * the timeline's one out-port. * *The in-port has only one trigger registered on it, which fires that * span. */ #define NO_MSG NULL #define PORT0 0 /* *Note, the returned value is passed to the timing function */ void * behaviorOf_ping_pong_span( void *_params, HWSimTimeline *timeline ) { PingPongParams *params; params = (PingPongParams *)_params; DEBUG( dbgHW, "ping pong span\n", clone_PingPongParams(params) ); HWSim__send_on_port( NO_MSG, PORT0, timeline ); } uint64 timingOf_ping_pong_span( void * dataFromBehaviorFn ) { return 10; } \ No newline at end of file +/* + * Copyright 2011 OpenSourceStewardshipFoundation.org + * Licensed under GNU General Public License version 2 + * + * Author: seanhalle@yahoo.com + * + */ + +#include "HWSim__Hello_World_HW.h" + + + +//==================================================================== +/*This is the ping-pong timeline for the Hello World hardware + * + *It has only one kind of span, which only puts a communication on + * the timeline's one out-port. + * + *The in-port has only one trigger registered on it, which fires that + * span. + */ + +#define NO_MSG NULL +#define PORT0 0 + +/* + *Note, the returned value is passed to the timing function + */ +void * +behaviorOf_ping_pong_span( void *_params, HWSimTimeline *timeline ) + { + PingPongParams *params; + params = (PingPongParams *)_params; +// DEBUG( dbgHW, "ping pong span\n", clone_PingPongParams(params) ); + + //HWSim__send_on_port( NO_MSG, PORT0, timeline ); + } + +uint64 +timingOf_ping_pong_span( void * dataFromBehaviorFn ) + { + return 10; + } + diff -r 2d3505958ca8 -r 648207f2e38f src/Application/SimParams.c --- a/src/Application/SimParams.c Mon Dec 05 12:24:44 2011 +0100 +++ b/src/Application/SimParams.c Tue Dec 06 18:46:42 2011 +0100 @@ -1,1 +1,155 @@ -/* * Copyright 2009 OpenSourceStewardshipFoundation.org * Licensed under GNU General Public License version 2 * * Author: seanhalle@yahoo.com * * Created on November 15, 2009, 2:35 AM */ #include #include #include "SimParams.h" #include "ParamHelper/Param.h" uint8 * read_Machine_Code_From_File( int numBytesInFile, char *machineCodeFileName ); void fill_sim_params_from_bag( SimulationParams *simParams, ParamBag *paramBag ) { char *guestAppFileName, *systemCodeFileName; int numBytesInGuestApp, numBytesInSystemCode; ParamStruc *param; param = getParamFromBag( "GuestApplicationFileName", paramBag ); guestAppFileName = param->strValue; param = getParamFromBag( "numBytesInGuestApp", paramBag ); numBytesInGuestApp = param->intValue; simParams->guestApp = read_Machine_Code_From_File( numBytesInGuestApp, guestAppFileName ); param = getParamFromBag( "SystemCodeFileName", paramBag ); systemCodeFileName = param->strValue; param = getParamFromBag( "numBytesInSystemCode", paramBag ); numBytesInSystemCode = param->intValue; simParams->systemCode = read_Machine_Code_From_File( numBytesInSystemCode, systemCodeFileName ); param = getParamFromBag( "numNodes", paramBag ); simParams->numNodes = param->intValue; } uint8 * read_Machine_Code_From_File( int numBytesInFile, char *machineCodeFileName ) { int byte; FILE *file; char *machineCode = malloc( numBytesInFile ); if( machineCode == NULL ) printf( "\nno mem for machine code\n" ); file = fopen( machineCodeFileName, "r" ); if( file == NULL ) { printf( "\nCouldn't open file!!\n"); exit(1);} fseek( file, 0, SEEK_SET ); for( byte = 0; byte < numBytesInFile; byte++ ) { if( feof( file ) ) printf( "file ran out too soon" ); machineCode[byte] = getchar( file ); } return machineCode; } //========================================================================== void printSimResults( SimulationResults simResults ) { } \ No newline at end of file +/* + + * Copyright 2009 OpenSourceStewardshipFoundation.org + + * Licensed under GNU General Public License version 2 + + * + + * Author: seanhalle@yahoo.com + + * + + * Created on November 15, 2009, 2:35 AM + + */ + + + +#include + +#include + + + +#include "SimParams.h" + +#include "ParamHelper/Param.h" + + + + + +uint8 * + +read_Machine_Code_From_File( int numBytesInFile, char *machineCodeFileName ); + + + + + +void + +fill_sim_params_from_bag( SimulationParams *simParams, ParamBag *paramBag ) + + { char *guestAppFileName, *systemCodeFileName; + + int numBytesInGuestApp, numBytesInSystemCode; + + + + ParamStruc *param; + + //param = getParamFromBag( "GuestApplicationFileName", paramBag ); + + guestAppFileName = param->strValue; + + //param = getParamFromBag( "numBytesInGuestApp", paramBag ); + + numBytesInGuestApp = param->intValue; + + + + simParams->guestApp = + + read_Machine_Code_From_File( numBytesInGuestApp, guestAppFileName ); + + + + //param = getParamFromBag( "SystemCodeFileName", paramBag ); + + systemCodeFileName = param->strValue; + + //param = getParamFromBag( "numBytesInSystemCode", paramBag ); + + numBytesInSystemCode = param->intValue; + + + + simParams->systemCode = + + read_Machine_Code_From_File( numBytesInSystemCode, systemCodeFileName ); + + + + + + //param = getParamFromBag( "numNodes", paramBag ); + + simParams->numNodes = param->intValue; + + + + } + + + + + + + +uint8 * + +read_Machine_Code_From_File( int numBytesInFile, char *machineCodeFileName ) + + { int byte; + + FILE *file; + + char *machineCode = malloc( numBytesInFile ); + + if( machineCode == NULL ) printf( "\nno mem for machine code\n" ); + + + + file = fopen( machineCodeFileName, "r" ); + + if( file == NULL ) { printf( "\nCouldn't open file!!\n"); exit(1);} + + + + fseek( file, 0, SEEK_SET ); + + for( byte = 0; byte < numBytesInFile; byte++ ) + + { + + if( feof( file ) ) printf( "file ran out too soon" ); + +// machineCode[byte] = getchar( file ); + + + + } + + return machineCode; + + } + + + + + + //========================================================================== + +void + +printSimResults( SimulationResults simResults ) + + { + + } + + + + diff -r 2d3505958ca8 -r 648207f2e38f src/Application/SimParams.h --- a/src/Application/SimParams.h Mon Dec 05 12:24:44 2011 +0100 +++ b/src/Application/SimParams.h Tue Dec 06 18:46:42 2011 +0100 @@ -1,1 +1,45 @@ -/* * Copyright 2011 OpenSourceStewardshipFoundation.org * Licensed under GNU General Public License version 2 */ #ifndef SIM_PARAMS_ #define SIM_PARAMS_ #include #include #include #include "../HWSim_lib/VMS/VMS_primitive_data_types.h" #include "ParamHelper/Param.h" //============================== Structures ============================== typedef struct { uint8 *guestApp; uint8 *systemCode; int32 numNodes; } SimulationResults; typedef struct { uint8 *guestApp; uint8 *systemCode; int32 numNodes; SimulationResults *simResults; } SimulationParams; //============================== Functions ================================ void printSimResults( SimulationResults simResults ); void fill_sim_params_from_bag( SimulationParams *simParams, ParamBag *paramBag ); //=========================================================================== #endif /**/ \ No newline at end of file +/* + * Copyright 2011 OpenSourceStewardshipFoundation.org + * Licensed under GNU General Public License version 2 + */ + +#ifndef SIM_PARAMS_ +#define SIM_PARAMS_ + +#include +#include +#include + +#include "../HWSim_lib/VMS/VMS_primitive_data_types.h" +#include "ParamHelper/Param.h" + + +//============================== Structures ============================== +typedef struct + { uint8 *guestApp; + uint8 *systemCode; + int32 numNodes; + } +SimulationResults; + +typedef struct + { uint8 *guestApp; + uint8 *systemCode; + int32 numNodes; + SimulationResults *simResults; + } +SimulationParams; + +//============================== Functions ================================ +void +printSimResults( SimulationResults simResults ); + +void +fill_sim_params_from_bag( SimulationParams *simParams, ParamBag *paramBag ); + + +//=========================================================================== + +#endif /**/ + + diff -r 2d3505958ca8 -r 648207f2e38f src/Application/main.c --- a/src/Application/main.c Mon Dec 05 12:24:44 2011 +0100 +++ b/src/Application/main.c Tue Dec 06 18:46:42 2011 +0100 @@ -11,6 +11,10 @@ #include "SimParams.h" #include "HWSim__Hello_World_HW/HWSim__Hello_World_HW.h" +char __ProgrammName[] = "HWSim Hello World"; +char __DataSet[255]; +char __Scheduler[]; + /* * * @@ -22,17 +26,26 @@ HWSimResults *simResults; printf( "param file name: %s\n", argv[1] ); + printf("Paraver trace file %s\n", argv[2]); +#ifdef FAKE + simParams= NULL; +#else simParams = makeParamBag(); readParamFileIntoBag( argv[1], simParams ); +#endif netlist = createPingPongNetlist(); +#ifdef FAKE + simResults= create_simulation_results__fake(simParams,netlist); +#else simResults = HWSim__run_simulation( simParams, netlist ); +#endif //HWSim - HWSim__generate_paraver_output( simResults ); - HWSim__generate_vcd_output( simResults ); + HWSim__generate_paraver_output(argv[2], simResults, netlist); + //HWSim__generate_vcd_output( simResults ); exit(0); //cleans up }