changeset 11:a587ea56af8e

changed directory structure -- thin project repository with this as sub-repo
author Me@portablequad
date Sat, 07 Jan 2012 17:45:10 -0800
parents aa78c6edf3b8
children 4862640793b6
files .hgeol .hgsub .hgsubstate CircuitNetlistCreator.c HWSim__Hello_World_HW/FakeSim.c HWSim__Hello_World_HW/HWSim__Hello_World_HW.h HWSim__Hello_World_HW/HW_DESIGN_NOTES.txt HWSim__Hello_World_HW/PingPong_TimeLine.c SimParams.c SimParams.h main.c src/Application/CircuitNetlistCreator.c src/Application/HWSim__Hello_World_HW/FakeSim.c src/Application/HWSim__Hello_World_HW/HWSim__Hello_World_HW.h src/Application/HWSim__Hello_World_HW/HW_DESIGN_NOTES.txt src/Application/HWSim__Hello_World_HW/PingPong_TimeLine.c src/Application/SimParams.c src/Application/SimParams.h src/Application/main.c
diffstat 19 files changed, 569 insertions(+), 570 deletions(-) [+]
line diff
     1.1 --- a/.hgeol	Wed Jan 04 16:41:01 2012 -0800
     1.2 +++ b/.hgeol	Sat Jan 07 17:45:10 2012 -0800
     1.3 @@ -6,6 +6,8 @@
     1.4  **.h = native
     1.5  **.cpp = native
     1.6  **.java = native
     1.7 +**.class = bin
     1.8 +**.jar = bin
     1.9  **.sh = native
    1.10  **.pl = native
    1.11  **.jpg = bin
     2.1 --- a/.hgsub	Wed Jan 04 16:41:01 2012 -0800
     2.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.3 @@ -1,2 +0,0 @@
     2.4 -src/HWSim_lib = ../HWSim_lib
     2.5 -
     3.1 --- a/.hgsubstate	Wed Jan 04 16:41:01 2012 -0800
     3.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.3 @@ -1,1 +0,0 @@
     3.4 -6be14b09d97682a430fb90756b4a9644162c7be9 src/HWSim_lib
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/CircuitNetlistCreator.c	Sat Jan 07 17:45:10 2012 -0800
     4.3 @@ -0,0 +1,99 @@
     4.4 +/*
     4.5 + *  Copyright 2011 OpenSourceStewardshipFoundation.org
     4.6 + *  Licensed under GNU General Public License version 2
     4.7 + *
     4.8 + * Author: seanhalle@yahoo.com
     4.9 + *
    4.10 + */
    4.11 + #include "HWSim__Hello_World_HW/HWSim__Hello_World_HW.h"
    4.12 + 
    4.13 +/*'wire' is an expr resolves to an actual wire struct instance
    4.14 + */
    4.15 +#define setWireValuesTo( wire, fromTLIdx, outPort, toTLIdx, inPort, dataPtr)\
    4.16 +do{\
    4.17 +   wire.idxOfFromTimeline = fromTLIdx; \
    4.18 +   wire.idxOfFromOutPort  = fromTLIdx; \
    4.19 +   wire.idxOfToTimeline   = toTLIdx; \
    4.20 +   wire.idxOfToInPort     = inPort; \
    4.21 +   wire.archSpecWireData  = dataPtr; \
    4.22 + }while(0); //macro magic for namespace
    4.23 + 
    4.24 +/*This file constructs the netlist for the Hello World circuit, which is
    4.25 + * used during design and implementation of the HWSim language
    4.26 + *
    4.27 + *It has two timelines, each with one input port and one output port, and
    4.28 + * a single span-type.
    4.29 + *
    4.30 + *The timelines are cross-coupled, so output port of one connects to input
    4.31 + * port of the other.  The input port has a single trigger, which fires
    4.32 + * the one span-type.
    4.33 + *
    4.34 + *The span does nothing, except send a NULL message on the output port.
    4.35 + *The span-sim-time and communication-sim-time are both constants.
    4.36 + *
    4.37 + *Note that timelines are generic.  They are specialized by declaring
    4.38 + * inports and outports, and by registering triggers that fire particular
    4.39 + * span-types.
    4.40 + */
    4.41 +HWSimNetlist *createPingPongNetlist()
    4.42 + { HWSimNetlist   *netlist;
    4.43 +   NetlistWire    *wires;
    4.44 +   HWSimTimeline **timelines;
    4.45 +   int numTimelines;
    4.46 +   int numWires;
    4.47 +   
    4.48 +   netlist = malloc( sizeof(HWSimNetlist) );
    4.49 +   //declare timelines   numTimelines = 2;
    4.50 +   timelines = malloc( numTimelines * sizeof(HWSimTimeline) );
    4.51 +   netlist->numTimelines = numTimelines;
    4.52 +   netlist->timelines    = timelines;
    4.53 +   netlist->numSpanTypes = 1;
    4.54 +   netlist->spanTypes = malloc(netlist->numSpanTypes*sizeof(HWSimSpanType*));
    4.55 +   netlist->spanTypes[PING_PONG_TYPE] = createPingPongSpanType();
    4.56 +   timelines[0] = createAPingPongTimeline( netlist ); //use info from netlist
    4.57 +   timelines[1] = createAPingPongTimeline( netlist ); 
    4.58 +      //on one of the timelines, make reset trigger an action   
    4.59 +   timelines[1]->inPorts[-1].triggeredSpanType =
    4.60 +              netlist->spanTypes PING_PONG_TYPE]; //Connect timelines together
    4.61 +			  
    4.62 +	/*OutPorts and InPorts may have many wires attached, but an inPort only     
    4.63 +	 * has one kind of span that all incoming communications trigger.  That
    4.64 +	 * span can be zero time and then switch on the type of message then
    4.65 +	 * end with a continuation, where the continuation span is chosen by the    
    4.66 +	 * switch. 
    4.67 +	 *So, a wire only connects an out port to an in port
    4.68 +	 *The format is: sending TL-index, out-port, dest TL-index, in-port
    4.69 +	 */
    4.70 +   numWires          = 2;
    4.71 +   wires             = malloc( numWires * sizeof(NetlistWire) );
    4.72 +   netlist->numWires = numWires;
    4.73 +   netlist->wires    = wires;
    4.74 +   //TL 0, out-port 0 to TL 1, in-port 0
    4.75 +   setWireValuesTo(wires[0], 0,0,1,0, NULL); //These NetlistWires turned into
    4.76 +   setWireValuesTo(wires[1], 1,0,0,0, NULL); // HWSimWires inside ckt create
    4.77 +   //TODO: decide how do in-out bidirectional wires -- thinking make it two
    4.78 +   // separate wires with guard between in-port and out-port
    4.79 +   //TODO: decide how do guards between ports
    4.80 + }
    4.81 + 
    4.82 +   //Note: copy netlist struct with VMS malloc after VMS initialized
    4.83 +HWSimTimeline *
    4.84 +createAPingPongTimeline( HWSimNetlist *netlist )
    4.85 + { HWSimTimeline *TL;
    4.86 +   TL = malloc( sizeof(HWSimTimeline) );
    4.87 +   TL->numInPorts  = 1;
    4.88 +   TL->numOutPorts = 1;
    4.89 +   TL->inPorts = HWSim_ext__make_inPortsArray( TL->numInPorts );
    4.90 +   TL->inPorts[-1].triggeredSpanType = IDLE_SPAN; //reset port
    4.91 +   TL->inPorts[0].triggeredSpanType  = netlist->spanTypes[PING_PONG_TYPE];
    4.92 + }
    4.93 + 
    4.94 +HWSimSpanType *
    4.95 +createPingPongSpanType( )
    4.96 + { HWSimSpanType *pingPongSpanType;
    4.97 +   pingPongSpanType = malloc( sizeof(HWSimSpanType) );
    4.98 +   pingPongSpanType->behaviorFn = &behaviorOf_ping_pong_span;
    4.99 +   pingPongSpanType->timingFn   = &timingOf_ping_pong_span;
   4.100 +   return pingPongSpanType;
   4.101 + } 
   4.102 + 
   4.103 \ No newline at end of file
     5.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.2 +++ b/HWSim__Hello_World_HW/FakeSim.c	Sat Jan 07 17:45:10 2012 -0800
     5.3 @@ -0,0 +1,126 @@
     5.4 +#include <stdlib.h>
     5.5 +#include "HWSim__Hello_World_HW.h"
     5.6 +
     5.7 +void checkMalloc (void *ptr) {
     5.8 +	if (ptr == NULL) {
     5.9 +		printf("Memory allocation failed!\n");
    5.10 +		exit(1);
    5.11 +	}
    5.12 +}
    5.13 +
    5.14 +HWSimTimeline* malloc_timlines (int nrTimelines) {
    5.15 +	HWSimTimeline *timelines;
    5.16 +	int i;
    5.17 +
    5.18 +	timelines= malloc(nrTimelines*(sizeof(HWSimTimeline)));
    5.19 +	checkMalloc(timelines);
    5.20 +	for (i= 0; i<nrTimelines; i++) {
    5.21 +		timelines[i].animatingVP= malloc(sizeof(VirtProcr));
    5.22 +		checkMalloc(timelines[i].animatingVP);
    5.23 +	}
    5.24 +	return timelines;
    5.25 +}
    5.26 +
    5.27 +HWSimResults* malloc_simResults (int nrExecutions, int nrComms) {
    5.28 +	HWSimResults *simResults;
    5.29 +	int i;
    5.30 +	
    5.31 +	
    5.32 +	simResults= malloc(sizeof(HWSimResults));
    5.33 +	checkMalloc(simResults);
    5.34 +
    5.35 +	simResults->numTimelines= nrExecutions;
    5.36 +	simResults->timelineTraces= 
    5.37 +		malloc(simResults->numTimelines*sizeof(HWSimTimelineTrace *));
    5.38 +
    5.39 +	for (i= 0; i<simResults->numTimelines; i++) {
    5.40 +		simResults->timelineTraces[i]= malloc(sizeof(HWSimTimelineTrace));
    5.41 +		checkMalloc(simResults->timelineTraces[i]);
    5.42 +		simResults->timelineTraces[i]->spanRecs= malloc(sizeof(HWSimSpanRec));
    5.43 +	}
    5.44 +
    5.45 +	simResults->numCommTraces= nrComms;
    5.46 +	simResults->commTraces= 
    5.47 +		malloc(simResults->numCommTraces*sizeof(HWSimWireTrace *));
    5.48 +	checkMalloc(simResults->commTraces);
    5.49 +	for (i= 0; i<simResults->numCommTraces; i++) {
    5.50 +		simResults->commTraces[i]= malloc(sizeof(HWSimWireTrace));
    5.51 +		checkMalloc(simResults->commTraces[i]);
    5.52 +		// FRAGILE -> valgrind
    5.53 +		simResults->commTraces[i]->commRecs= malloc(sizeof(HWSimCommRec));
    5.54 +		checkMalloc(simResults->commTraces[i]->commRecs);
    5.55 +	}
    5.56 +
    5.57 +	return simResults;
    5.58 +}
    5.59 +
    5.60 +HWSimResults* create_simulation_results__fake(void *simParams,HWSimNetlist *netlist) {
    5.61 +	HWSimResults *simResults;
    5.62 +
    5.63 +	simResults= malloc_simResults(4,3);
    5.64 +
    5.65 +	//--------------- timelineTraces ------------------------------------
    5.66 +	// 2 times a ping span
    5.67 +	simResults->timelineTraces[0]->timeline= netlist->timelines[0]; 
    5.68 +	simResults->timelineTraces[0]->spanRecs->spanSeqNum= 0; // unique ???
    5.69 +	simResults->timelineTraces[0]->spanRecs->startTime= 1;
    5.70 +	simResults->timelineTraces[0]->spanRecs->endTime=2;
    5.71 +
    5.72 +	simResults->timelineTraces[1]->timeline= netlist->timelines[0]; 
    5.73 +	simResults->timelineTraces[1]->spanRecs->spanSeqNum= 1;
    5.74 +	simResults->timelineTraces[1]->spanRecs->startTime= 5;
    5.75 +	simResults->timelineTraces[1]->spanRecs->endTime=6;
    5.76 +
    5.77 +	// 2 times a pong span
    5.78 +	simResults->timelineTraces[2]->timeline= netlist->timelines[1];
    5.79 +	simResults->timelineTraces[2]->spanRecs->spanSeqNum= 2; // unique ???
    5.80 +	simResults->timelineTraces[2]->spanRecs->startTime= 3;
    5.81 +	simResults->timelineTraces[2]->spanRecs->endTime=4;
    5.82 +
    5.83 +	simResults->timelineTraces[3]->timeline= netlist->timelines[1]; 
    5.84 +	simResults->timelineTraces[3]->spanRecs->spanSeqNum= 3;
    5.85 +	simResults->timelineTraces[3]->spanRecs->startTime= 7;
    5.86 +	simResults->timelineTraces[3]->spanRecs->endTime=8;
    5.87 +
    5.88 +
    5.89 +	// a HWSimTimeline does not contain any helpful additional information to
    5.90 +	// identify or label a Timeline .
    5.91 +	// But a unique Timeline identifier is disireable. Therefore at the moment the
    5.92 +	// procrID of the anumating Procr ist used
    5.93 +
    5.94 +	// Information about the Span is required, at least a ID.The current
    5.95 +	// spanType doesn't provide it
    5.96 +
    5.97 +
    5.98 +	//--------------------  Coomunication Trace ---------------------
    5.99 +
   5.100 +	//ping to pong 2 - 3 
   5.101 +	simResults->commTraces[0]->fromTimeline= netlist->timelines[0];
   5.102 +	simResults->commTraces[0]->toTimeline= netlist->timelines[1];
   5.103 +	simResults->commTraces[0]->numComms= 1;
   5.104 +	simResults->commTraces[0]->commRecs->commID= 0;
   5.105 +	simResults->commTraces[0]->commRecs->msgID= 0;
   5.106 +	simResults->commTraces[0]->commRecs->startTime= 2;
   5.107 +	simResults->commTraces[0]->commRecs->endTime= 3;
   5.108 +
   5.109 +	//pong to ping 4 - 5 
   5.110 +	simResults->commTraces[1]->fromTimeline= netlist->timelines[1];
   5.111 +	simResults->commTraces[1]->toTimeline= netlist->timelines[0];
   5.112 +	simResults->commTraces[1]->numComms= 1;
   5.113 +	simResults->commTraces[1]->commRecs->commID= 1;
   5.114 +	simResults->commTraces[1]->commRecs->msgID= 1;
   5.115 +	simResults->commTraces[1]->commRecs->startTime= 4;
   5.116 +	simResults->commTraces[1]->commRecs->endTime= 5;
   5.117 +
   5.118 +	//ping to pong 6 - 7 
   5.119 +	simResults->commTraces[2]->fromTimeline= netlist->timelines[0];
   5.120 +	simResults->commTraces[2]->toTimeline= netlist->timelines[1];
   5.121 +	simResults->commTraces[2]->numComms= 1;
   5.122 +	simResults->commTraces[2]->commRecs= malloc(sizeof(HWSimCommRec));
   5.123 +	simResults->commTraces[2]->commRecs->commID= 2;
   5.124 +	simResults->commTraces[2]->commRecs->msgID= 0;
   5.125 +	simResults->commTraces[2]->commRecs->startTime= 6;
   5.126 +	simResults->commTraces[2]->commRecs->endTime= 7;
   5.127 +
   5.128 +	return simResults;
   5.129 +}
     6.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.2 +++ b/HWSim__Hello_World_HW/HWSim__Hello_World_HW.h	Sat Jan 07 17:45:10 2012 -0800
     6.3 @@ -0,0 +1,45 @@
     6.4 +/*
     6.5 + *  Copyright 2011 OpenSourceStewardshipFoundation.org
     6.6 + *  Licensed under GNU General Public License version 2
     6.7 + */
     6.8 +
     6.9 +
    6.10 +#ifndef _HWSim_TERAFLUX_H_
    6.11 +#define _HWSim_TERAFLUX_H_
    6.12 +
    6.13 +#include <stdio.h>
    6.14 +
    6.15 +#include "../../HWSim_lib/HWSim.h"
    6.16 +
    6.17 +
    6.18 +//===============================  Defines  ==============================
    6.19 +   //Port 0 is unused, as a bug-catch
    6.20 +#define COMMUNICATOR_OUTPORT  1
    6.21 +
    6.22 +
    6.23 +//==============================  Structures  ==============================
    6.24 +typedef struct
    6.25 + { 
    6.26 + }
    6.27 +PingPongParams;
    6.28 +
    6.29 +
    6.30 +//============================= Span Functions =========================
    6.31 +void *
    6.32 +behaviorOf_ping_pong_span( void *_params, HWSimTimeline *timeLine );
    6.33 +
    6.34 +uint64
    6.35 +timingOf_ping_pong_span( void * dataFromBehaviorFn );
    6.36 +
    6.37 +//======================== Simulation Fake ==================================
    6.38 +#ifdef FAKE
    6.39 +HWSimResults* create_simulation_results__fake(void *simParams,HWSimNetlist *netlist);
    6.40 +#endif
    6.41 +
    6.42 +//======================== Netlist creation ==================================
    6.43 +
    6.44 +HWSimNetlist* createPingPongNetlist ();
    6.45 +
    6.46 +#endif /**/
    6.47 +
    6.48 +
     7.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     7.2 +++ b/HWSim__Hello_World_HW/HW_DESIGN_NOTES.txt	Sat Jan 07 17:45:10 2012 -0800
     7.3 @@ -0,0 +1,1 @@
     7.4 +Implementing the hardware model
     7.5 
     7.6 
     7.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.
     7.8 
     7.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.
    7.10 
    7.11 The code of the span consists only of sending an empty message on the timeline's out-port.
    7.12 
    7.13 The trigger for the span is registered on the in-port and message type 0.
    7.14 
    7.15 The span timing is a constant.
    7.16 
    7.17 The port-to-port timing is a constant.
    7.18 
    7.19 Both timelines are in the same time-domain.
    7.20 
    7.21 at_reset of one timeline is set to the ping-pong span, the other timeline's at_reset is set to idle.
    7.22 
    7.23 And that is the entire hardware.
    7.24 
    7.25 \ No newline at end of file
     8.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     8.2 +++ b/HWSim__Hello_World_HW/PingPong_TimeLine.c	Sat Jan 07 17:45:10 2012 -0800
     8.3 @@ -0,0 +1,44 @@
     8.4 +/*
     8.5 + *  Copyright 2011 OpenSourceStewardshipFoundation.org
     8.6 + *  Licensed under GNU General Public License version 2
     8.7 + *
     8.8 + * Author: seanhalle@yahoo.com
     8.9 + *
    8.10 + */
    8.11 +
    8.12 +#include "HWSim__Hello_World_HW.h"
    8.13 +
    8.14 +
    8.15 +
    8.16 +//====================================================================
    8.17 +/*This is the ping-pong timeline for the Hello World hardware
    8.18 + *
    8.19 + *It has only one kind of span, which only puts a communication on
    8.20 + * the timeline's one out-port.
    8.21 + * 
    8.22 + *The in-port has only one trigger registered on it, which fires that
    8.23 + * span.
    8.24 + */
    8.25 +
    8.26 +#define NO_MSG NULL
    8.27 +#define PORT0 0
    8.28 +
    8.29 +/*
    8.30 + *Note, the returned value is passed to the timing function
    8.31 + */
    8.32 +void *
    8.33 +behaviorOf_ping_pong_span( void *_params, HWSimTimeline *timeline )
    8.34 + {
    8.35 +   PingPongParams  *params;
    8.36 +   params    = (PingPongParams *)_params;
    8.37 +//         DEBUG( dbgHW, "ping pong span\n", clone_PingPongParams(params) );
    8.38 +   
    8.39 +   //HWSim__send_on_port( NO_MSG, PORT0, timeline );
    8.40 + }
    8.41 +
    8.42 +uint64
    8.43 +timingOf_ping_pong_span( void * dataFromBehaviorFn )
    8.44 + {
    8.45 +   return 10;
    8.46 + }
    8.47 +
     9.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     9.2 +++ b/SimParams.c	Sat Jan 07 17:45:10 2012 -0800
     9.3 @@ -0,0 +1,155 @@
     9.4 +/*
     9.5 +
     9.6 + *  Copyright 2009 OpenSourceStewardshipFoundation.org
     9.7 +
     9.8 + *  Licensed under GNU General Public License version 2
     9.9 +
    9.10 + *
    9.11 +
    9.12 + * Author: seanhalle@yahoo.com
    9.13 +
    9.14 + *
    9.15 +
    9.16 + * Created on November 15, 2009, 2:35 AM
    9.17 +
    9.18 + */
    9.19 +
    9.20 +
    9.21 +
    9.22 +#include <malloc.h>
    9.23 +
    9.24 +#include <stdlib.h>
    9.25 +
    9.26 +
    9.27 +
    9.28 +#include "SimParams.h"
    9.29 +
    9.30 +#include "ParamHelper/Param.h"
    9.31 +
    9.32 +
    9.33 +
    9.34 +
    9.35 +
    9.36 +uint8 *
    9.37 +
    9.38 +read_Machine_Code_From_File( int numBytesInFile, char *machineCodeFileName );
    9.39 +
    9.40 +
    9.41 +
    9.42 + 
    9.43 +
    9.44 +void
    9.45 +
    9.46 +fill_sim_params_from_bag( SimulationParams *simParams, ParamBag *paramBag )
    9.47 +
    9.48 + { char *guestAppFileName, *systemCodeFileName;
    9.49 +
    9.50 +   int numBytesInGuestApp, numBytesInSystemCode;
    9.51 +
    9.52 +   
    9.53 +
    9.54 +      ParamStruc *param;
    9.55 +
    9.56 +      //param = getParamFromBag( "GuestApplicationFileName", paramBag );
    9.57 +
    9.58 +   guestAppFileName = param->strValue;
    9.59 +
    9.60 +      //param = getParamFromBag( "numBytesInGuestApp", paramBag );
    9.61 +
    9.62 +   numBytesInGuestApp = param->intValue;
    9.63 +
    9.64 +
    9.65 +
    9.66 +   simParams->guestApp =
    9.67 +
    9.68 +    read_Machine_Code_From_File( numBytesInGuestApp, guestAppFileName );
    9.69 +
    9.70 +
    9.71 +
    9.72 +      //param = getParamFromBag( "SystemCodeFileName", paramBag );
    9.73 +
    9.74 +   systemCodeFileName = param->strValue;
    9.75 +
    9.76 +      //param = getParamFromBag( "numBytesInSystemCode", paramBag );
    9.77 +
    9.78 +   numBytesInSystemCode = param->intValue;
    9.79 +
    9.80 +
    9.81 +
    9.82 +   simParams->systemCode =
    9.83 +
    9.84 +    read_Machine_Code_From_File( numBytesInSystemCode, systemCodeFileName );
    9.85 +
    9.86 +
    9.87 +
    9.88 +
    9.89 +
    9.90 +      //param = getParamFromBag( "numNodes", paramBag );
    9.91 +
    9.92 +   simParams->numNodes = param->intValue;
    9.93 +
    9.94 +
    9.95 +
    9.96 + }
    9.97 +
    9.98 +
    9.99 +
   9.100 +
   9.101 +
   9.102 +
   9.103 +
   9.104 +uint8 *
   9.105 +
   9.106 +read_Machine_Code_From_File( int numBytesInFile, char *machineCodeFileName )
   9.107 +
   9.108 + { int byte;
   9.109 +
   9.110 +   FILE  *file;
   9.111 +
   9.112 +   char  *machineCode = malloc( numBytesInFile );
   9.113 +
   9.114 +   if( machineCode == NULL ) printf( "\nno mem for machine code\n" );
   9.115 +
   9.116 +   
   9.117 +
   9.118 +   file = fopen( machineCodeFileName, "r" );
   9.119 +
   9.120 +   if( file == NULL ) { printf( "\nCouldn't open file!!\n"); exit(1);}
   9.121 +
   9.122 +
   9.123 +
   9.124 +   fseek( file, 0, SEEK_SET );
   9.125 +
   9.126 +   for( byte = 0; byte < numBytesInFile; byte++ )
   9.127 +
   9.128 +    {
   9.129 +
   9.130 +      if( feof( file ) )  printf( "file ran out too soon" );
   9.131 +
   9.132 +//      machineCode[byte] = getchar( file );
   9.133 +
   9.134 +      
   9.135 +
   9.136 +    }
   9.137 +
   9.138 +   return machineCode;
   9.139 +
   9.140 + }
   9.141 +
   9.142 +
   9.143 +
   9.144 +
   9.145 +
   9.146 + //==========================================================================
   9.147 +
   9.148 +void
   9.149 +
   9.150 +printSimResults( SimulationResults simResults )
   9.151 +
   9.152 + { 
   9.153 +
   9.154 + }
   9.155 +
   9.156 +
   9.157 +
   9.158 +
    10.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    10.2 +++ b/SimParams.h	Sat Jan 07 17:45:10 2012 -0800
    10.3 @@ -0,0 +1,45 @@
    10.4 +/*
    10.5 + *  Copyright 2011 OpenSourceStewardshipFoundation.org
    10.6 + *  Licensed under GNU General Public License version 2 
    10.7 + */
    10.8 +
    10.9 +#ifndef SIM_PARAMS_
   10.10 +#define SIM_PARAMS_
   10.11 +
   10.12 +#include <stdio.h>
   10.13 +#include <unistd.h>
   10.14 +#include <malloc.h>
   10.15 +
   10.16 +#include "../HWSim_lib/VMS/VMS_primitive_data_types.h"
   10.17 +#include "ParamHelper/Param.h"
   10.18 +
   10.19 +
   10.20 +//==============================  Structures  ==============================
   10.21 +typedef struct
   10.22 + { uint8 *guestApp;
   10.23 +   uint8 *systemCode;
   10.24 +   int32 numNodes;
   10.25 + }
   10.26 +SimulationResults;
   10.27 +
   10.28 +typedef struct
   10.29 + { uint8 *guestApp;
   10.30 +   uint8 *systemCode;
   10.31 +   int32 numNodes;
   10.32 +   SimulationResults *simResults;
   10.33 + }
   10.34 +SimulationParams;
   10.35 +
   10.36 +//==============================  Functions  ================================
   10.37 +void
   10.38 +printSimResults( SimulationResults simResults );
   10.39 +
   10.40 +void
   10.41 +fill_sim_params_from_bag( SimulationParams *simParams, ParamBag *paramBag );
   10.42 +
   10.43 +
   10.44 +//===========================================================================
   10.45 +
   10.46 +#endif /**/
   10.47 +
   10.48 +
    11.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    11.2 +++ b/main.c	Sat Jan 07 17:45:10 2012 -0800
    11.3 @@ -0,0 +1,52 @@
    11.4 +/*
    11.5 + *  Copyright 2011 OpenSourceStewardshipFoundation.org
    11.6 + *  Licensed under BSD
    11.7 + *
    11.8 + * author seanhalle@yahoo.com
    11.9 + */
   11.10 + 
   11.11 +#include <malloc.h>
   11.12 +#include <stdlib.h>
   11.13 +
   11.14 +#include "SimParams.h"
   11.15 +#include "HWSim__Hello_World_HW/HWSim__Hello_World_HW.h"
   11.16 +
   11.17 +char __ProgrammName[] = "HWSim Hello World";
   11.18 +char __DataSet[255];
   11.19 +char __Scheduler[];
   11.20 +
   11.21 +/*
   11.22 + *
   11.23 + * 
   11.24 + */
   11.25 +
   11.26 +int main( int argc, char **argv )
   11.27 + { ParamBag      *simParams;
   11.28 +   HWSimNetlist  *netlist;
   11.29 +   HWSimResults  *simResults;
   11.30 +
   11.31 +   printf( "param file name: %s\n", argv[1] );
   11.32 +   printf("Paraver trace file %s\n", argv[2]);
   11.33 +
   11.34 +#ifdef FAKE
   11.35 +	simParams= NULL;
   11.36 +#else
   11.37 +   simParams = makeParamBag();
   11.38 +   readParamFileIntoBag( argv[1], simParams );
   11.39 +#endif
   11.40 +   
   11.41 +   netlist = createPingPongNetlist();
   11.42 +#ifdef FAKE
   11.43 +   simResults= create_simulation_results__fake(simParams,netlist);
   11.44 +#else
   11.45 +   simResults = 
   11.46 +    HWSim__run_simulation( simParams, netlist );
   11.47 +#endif
   11.48 +
   11.49 +      //HWSim 
   11.50 +   HWSim__generate_paraver_output(argv[2], simResults, netlist);
   11.51 +   //HWSim__generate_vcd_output( simResults );
   11.52 +   
   11.53 +   exit(0); //cleans up
   11.54 + }
   11.55 +
    12.1 --- a/src/Application/CircuitNetlistCreator.c	Wed Jan 04 16:41:01 2012 -0800
    12.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    12.3 @@ -1,99 +0,0 @@
    12.4 -/*
    12.5 - *  Copyright 2011 OpenSourceStewardshipFoundation.org
    12.6 - *  Licensed under GNU General Public License version 2
    12.7 - *
    12.8 - * Author: seanhalle@yahoo.com
    12.9 - *
   12.10 - */
   12.11 - #include "HWSim__Hello_World_HW/HWSim__Hello_World_HW.h"
   12.12 - 
   12.13 -/*'wire' is an expr resolves to an actual wire struct instance
   12.14 - */
   12.15 -#define setWireValuesTo( wire, fromTLIdx, outPort, toTLIdx, inPort, dataPtr)\
   12.16 -do{\
   12.17 -   wire.idxOfFromTimeline = fromTLIdx; \
   12.18 -   wire.idxOfFromOutPort  = fromTLIdx; \
   12.19 -   wire.idxOfToTimeline   = toTLIdx; \
   12.20 -   wire.idxOfToInPort     = inPort; \
   12.21 -   wire.archSpecWireData  = dataPtr; \
   12.22 - }while(0); //macro magic for namespace
   12.23 - 
   12.24 -/*This file constructs the netlist for the Hello World circuit, which is
   12.25 - * used during design and implementation of the HWSim language
   12.26 - *
   12.27 - *It has two timelines, each with one input port and one output port, and
   12.28 - * a single span-type.
   12.29 - *
   12.30 - *The timelines are cross-coupled, so output port of one connects to input
   12.31 - * port of the other.  The input port has a single trigger, which fires
   12.32 - * the one span-type.
   12.33 - *
   12.34 - *The span does nothing, except send a NULL message on the output port.
   12.35 - *The span-sim-time and communication-sim-time are both constants.
   12.36 - *
   12.37 - *Note that timelines are generic.  They are specialized by declaring
   12.38 - * inports and outports, and by registering triggers that fire particular
   12.39 - * span-types.
   12.40 - */
   12.41 -HWSimNetlist *createPingPongNetlist()
   12.42 - { HWSimNetlist   *netlist;
   12.43 -   NetlistWire    *wires;
   12.44 -   HWSimTimeline **timelines;
   12.45 -   int numTimelines;
   12.46 -   int numWires;
   12.47 -   
   12.48 -   netlist = malloc( sizeof(HWSimNetlist) );
   12.49 -   //declare timelines   numTimelines = 2;
   12.50 -   timelines = malloc( numTimelines * sizeof(HWSimTimeline) );
   12.51 -   netlist->numTimelines = numTimelines;
   12.52 -   netlist->timelines    = timelines;
   12.53 -   netlist->numSpanTypes = 1;
   12.54 -   netlist->spanTypes = malloc(netlist->numSpanTypes*sizeof(HWSimSpanType*));
   12.55 -   netlist->spanTypes[PING_PONG_TYPE] = createPingPongSpanType();
   12.56 -   timelines[0] = createAPingPongTimeline( netlist ); //use info from netlist
   12.57 -   timelines[1] = createAPingPongTimeline( netlist ); 
   12.58 -      //on one of the timelines, make reset trigger an action   
   12.59 -   timelines[1]->inPorts[-1].triggeredSpanType =
   12.60 -              netlist->spanTypes PING_PONG_TYPE]; //Connect timelines together
   12.61 -			  
   12.62 -	/*OutPorts and InPorts may have many wires attached, but an inPort only     
   12.63 -	 * has one kind of span that all incoming communications trigger.  That
   12.64 -	 * span can be zero time and then switch on the type of message then
   12.65 -	 * end with a continuation, where the continuation span is chosen by the    
   12.66 -	 * switch. 
   12.67 -	 *So, a wire only connects an out port to an in port
   12.68 -	 *The format is: sending TL-index, out-port, dest TL-index, in-port
   12.69 -	 */
   12.70 -   numWires          = 2;
   12.71 -   wires             = malloc( numWires * sizeof(NetlistWire) );
   12.72 -   netlist->numWires = numWires;
   12.73 -   netlist->wires    = wires;
   12.74 -   //TL 0, out-port 0 to TL 1, in-port 0
   12.75 -   setWireValuesTo(wires[0], 0,0,1,0, NULL); //These NetlistWires turned into
   12.76 -   setWireValuesTo(wires[1], 1,0,0,0, NULL); // HWSimWires inside ckt create
   12.77 -   //TODO: decide how do in-out bidirectional wires -- thinking make it two
   12.78 -   // separate wires with guard between in-port and out-port
   12.79 -   //TODO: decide how do guards between ports
   12.80 - }
   12.81 - 
   12.82 -   //Note: copy netlist struct with VMS malloc after VMS initialized
   12.83 -HWSimTimeline *
   12.84 -createAPingPongTimeline( HWSimNetlist *netlist )
   12.85 - { HWSimTimeline *TL;
   12.86 -   TL = malloc( sizeof(HWSimTimeline) );
   12.87 -   TL->numInPorts  = 1;
   12.88 -   TL->numOutPorts = 1;
   12.89 -   TL->inPorts = HWSim_ext__make_inPortsArray( TL->numInPorts );
   12.90 -   TL->inPorts[-1].triggeredSpanType = IDLE_SPAN; //reset port
   12.91 -   TL->inPorts[0].triggeredSpanType  = netlist->spanTypes[PING_PONG_TYPE];
   12.92 - }
   12.93 - 
   12.94 -HWSimSpanType *
   12.95 -createPingPongSpanType( )
   12.96 - { HWSimSpanType *pingPongSpanType;
   12.97 -   pingPongSpanType = malloc( sizeof(HWSimSpanType) );
   12.98 -   pingPongSpanType->behaviorFn = &behaviorOf_ping_pong_span;
   12.99 -   pingPongSpanType->timingFn   = &timingOf_ping_pong_span;
  12.100 -   return pingPongSpanType;
  12.101 - } 
  12.102 - 
  12.103 \ No newline at end of file
    13.1 --- a/src/Application/HWSim__Hello_World_HW/FakeSim.c	Wed Jan 04 16:41:01 2012 -0800
    13.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    13.3 @@ -1,126 +0,0 @@
    13.4 -#include <stdlib.h>
    13.5 -#include "HWSim__Hello_World_HW.h"
    13.6 -
    13.7 -void checkMalloc (void *ptr) {
    13.8 -	if (ptr == NULL) {
    13.9 -		printf("Memory allocation failed!\n");
   13.10 -		exit(1);
   13.11 -	}
   13.12 -}
   13.13 -
   13.14 -HWSimTimeline* malloc_timlines (int nrTimelines) {
   13.15 -	HWSimTimeline *timelines;
   13.16 -	int i;
   13.17 -
   13.18 -	timelines= malloc(nrTimelines*(sizeof(HWSimTimeline)));
   13.19 -	checkMalloc(timelines);
   13.20 -	for (i= 0; i<nrTimelines; i++) {
   13.21 -		timelines[i].animatingVP= malloc(sizeof(VirtProcr));
   13.22 -		checkMalloc(timelines[i].animatingVP);
   13.23 -	}
   13.24 -	return timelines;
   13.25 -}
   13.26 -
   13.27 -HWSimResults* malloc_simResults (int nrExecutions, int nrComms) {
   13.28 -	HWSimResults *simResults;
   13.29 -	int i;
   13.30 -	
   13.31 -	
   13.32 -	simResults= malloc(sizeof(HWSimResults));
   13.33 -	checkMalloc(simResults);
   13.34 -
   13.35 -	simResults->numTimelines= nrExecutions;
   13.36 -	simResults->timelineTraces= 
   13.37 -		malloc(simResults->numTimelines*sizeof(HWSimTimelineTrace *));
   13.38 -
   13.39 -	for (i= 0; i<simResults->numTimelines; i++) {
   13.40 -		simResults->timelineTraces[i]= malloc(sizeof(HWSimTimelineTrace));
   13.41 -		checkMalloc(simResults->timelineTraces[i]);
   13.42 -		simResults->timelineTraces[i]->spanRecs= malloc(sizeof(HWSimSpanRec));
   13.43 -	}
   13.44 -
   13.45 -	simResults->numCommTraces= nrComms;
   13.46 -	simResults->commTraces= 
   13.47 -		malloc(simResults->numCommTraces*sizeof(HWSimWireTrace *));
   13.48 -	checkMalloc(simResults->commTraces);
   13.49 -	for (i= 0; i<simResults->numCommTraces; i++) {
   13.50 -		simResults->commTraces[i]= malloc(sizeof(HWSimWireTrace));
   13.51 -		checkMalloc(simResults->commTraces[i]);
   13.52 -		// FRAGILE -> valgrind
   13.53 -		simResults->commTraces[i]->commRecs= malloc(sizeof(HWSimCommRec));
   13.54 -		checkMalloc(simResults->commTraces[i]->commRecs);
   13.55 -	}
   13.56 -
   13.57 -	return simResults;
   13.58 -}
   13.59 -
   13.60 -HWSimResults* create_simulation_results__fake(void *simParams,HWSimNetlist *netlist) {
   13.61 -	HWSimResults *simResults;
   13.62 -
   13.63 -	simResults= malloc_simResults(4,3);
   13.64 -
   13.65 -	//--------------- timelineTraces ------------------------------------
   13.66 -	// 2 times a ping span
   13.67 -	simResults->timelineTraces[0]->timeline= netlist->timelines[0]; 
   13.68 -	simResults->timelineTraces[0]->spanRecs->spanSeqNum= 0; // unique ???
   13.69 -	simResults->timelineTraces[0]->spanRecs->startTime= 1;
   13.70 -	simResults->timelineTraces[0]->spanRecs->endTime=2;
   13.71 -
   13.72 -	simResults->timelineTraces[1]->timeline= netlist->timelines[0]; 
   13.73 -	simResults->timelineTraces[1]->spanRecs->spanSeqNum= 1;
   13.74 -	simResults->timelineTraces[1]->spanRecs->startTime= 5;
   13.75 -	simResults->timelineTraces[1]->spanRecs->endTime=6;
   13.76 -
   13.77 -	// 2 times a pong span
   13.78 -	simResults->timelineTraces[2]->timeline= netlist->timelines[1];
   13.79 -	simResults->timelineTraces[2]->spanRecs->spanSeqNum= 2; // unique ???
   13.80 -	simResults->timelineTraces[2]->spanRecs->startTime= 3;
   13.81 -	simResults->timelineTraces[2]->spanRecs->endTime=4;
   13.82 -
   13.83 -	simResults->timelineTraces[3]->timeline= netlist->timelines[1]; 
   13.84 -	simResults->timelineTraces[3]->spanRecs->spanSeqNum= 3;
   13.85 -	simResults->timelineTraces[3]->spanRecs->startTime= 7;
   13.86 -	simResults->timelineTraces[3]->spanRecs->endTime=8;
   13.87 -
   13.88 -
   13.89 -	// a HWSimTimeline does not contain any helpful additional information to
   13.90 -	// identify or label a Timeline .
   13.91 -	// But a unique Timeline identifier is disireable. Therefore at the moment the
   13.92 -	// procrID of the anumating Procr ist used
   13.93 -
   13.94 -	// Information about the Span is required, at least a ID.The current
   13.95 -	// spanType doesn't provide it
   13.96 -
   13.97 -
   13.98 -	//--------------------  Coomunication Trace ---------------------
   13.99 -
  13.100 -	//ping to pong 2 - 3 
  13.101 -	simResults->commTraces[0]->fromTimeline= netlist->timelines[0];
  13.102 -	simResults->commTraces[0]->toTimeline= netlist->timelines[1];
  13.103 -	simResults->commTraces[0]->numComms= 1;
  13.104 -	simResults->commTraces[0]->commRecs->commID= 0;
  13.105 -	simResults->commTraces[0]->commRecs->msgID= 0;
  13.106 -	simResults->commTraces[0]->commRecs->startTime= 2;
  13.107 -	simResults->commTraces[0]->commRecs->endTime= 3;
  13.108 -
  13.109 -	//pong to ping 4 - 5 
  13.110 -	simResults->commTraces[1]->fromTimeline= netlist->timelines[1];
  13.111 -	simResults->commTraces[1]->toTimeline= netlist->timelines[0];
  13.112 -	simResults->commTraces[1]->numComms= 1;
  13.113 -	simResults->commTraces[1]->commRecs->commID= 1;
  13.114 -	simResults->commTraces[1]->commRecs->msgID= 1;
  13.115 -	simResults->commTraces[1]->commRecs->startTime= 4;
  13.116 -	simResults->commTraces[1]->commRecs->endTime= 5;
  13.117 -
  13.118 -	//ping to pong 6 - 7 
  13.119 -	simResults->commTraces[2]->fromTimeline= netlist->timelines[0];
  13.120 -	simResults->commTraces[2]->toTimeline= netlist->timelines[1];
  13.121 -	simResults->commTraces[2]->numComms= 1;
  13.122 -	simResults->commTraces[2]->commRecs= malloc(sizeof(HWSimCommRec));
  13.123 -	simResults->commTraces[2]->commRecs->commID= 2;
  13.124 -	simResults->commTraces[2]->commRecs->msgID= 0;
  13.125 -	simResults->commTraces[2]->commRecs->startTime= 6;
  13.126 -	simResults->commTraces[2]->commRecs->endTime= 7;
  13.127 -
  13.128 -	return simResults;
  13.129 -}
    14.1 --- a/src/Application/HWSim__Hello_World_HW/HWSim__Hello_World_HW.h	Wed Jan 04 16:41:01 2012 -0800
    14.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    14.3 @@ -1,45 +0,0 @@
    14.4 -/*
    14.5 - *  Copyright 2011 OpenSourceStewardshipFoundation.org
    14.6 - *  Licensed under GNU General Public License version 2
    14.7 - */
    14.8 -
    14.9 -
   14.10 -#ifndef _HWSim_TERAFLUX_H_
   14.11 -#define _HWSim_TERAFLUX_H_
   14.12 -
   14.13 -#include <stdio.h>
   14.14 -
   14.15 -#include "../../HWSim_lib/HWSim.h"
   14.16 -
   14.17 -
   14.18 -//===============================  Defines  ==============================
   14.19 -   //Port 0 is unused, as a bug-catch
   14.20 -#define COMMUNICATOR_OUTPORT  1
   14.21 -
   14.22 -
   14.23 -//==============================  Structures  ==============================
   14.24 -typedef struct
   14.25 - { 
   14.26 - }
   14.27 -PingPongParams;
   14.28 -
   14.29 -
   14.30 -//============================= Span Functions =========================
   14.31 -void *
   14.32 -behaviorOf_ping_pong_span( void *_params, HWSimTimeline *timeLine );
   14.33 -
   14.34 -uint64
   14.35 -timingOf_ping_pong_span( void * dataFromBehaviorFn );
   14.36 -
   14.37 -//======================== Simulation Fake ==================================
   14.38 -#ifdef FAKE
   14.39 -HWSimResults* create_simulation_results__fake(void *simParams,HWSimNetlist *netlist);
   14.40 -#endif
   14.41 -
   14.42 -//======================== Netlist creation ==================================
   14.43 -
   14.44 -HWSimNetlist* createPingPongNetlist ();
   14.45 -
   14.46 -#endif /**/
   14.47 -
   14.48 -
    15.1 --- a/src/Application/HWSim__Hello_World_HW/HW_DESIGN_NOTES.txt	Wed Jan 04 16:41:01 2012 -0800
    15.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    15.3 @@ -1,1 +0,0 @@
    15.4 -Implementing the hardware model
    15.5 
    15.6 
    15.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.
    15.8 
    15.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.
   15.10 
   15.11 The code of the span consists only of sending an empty message on the timeline's out-port.
   15.12 
   15.13 The trigger for the span is registered on the in-port and message type 0.
   15.14 
   15.15 The span timing is a constant.
   15.16 
   15.17 The port-to-port timing is a constant.
   15.18 
   15.19 Both timelines are in the same time-domain.
   15.20 
   15.21 at_reset of one timeline is set to the ping-pong span, the other timeline's at_reset is set to idle.
   15.22 
   15.23 And that is the entire hardware.
   15.24 
   15.25 \ No newline at end of file
    16.1 --- a/src/Application/HWSim__Hello_World_HW/PingPong_TimeLine.c	Wed Jan 04 16:41:01 2012 -0800
    16.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    16.3 @@ -1,44 +0,0 @@
    16.4 -/*
    16.5 - *  Copyright 2011 OpenSourceStewardshipFoundation.org
    16.6 - *  Licensed under GNU General Public License version 2
    16.7 - *
    16.8 - * Author: seanhalle@yahoo.com
    16.9 - *
   16.10 - */
   16.11 -
   16.12 -#include "HWSim__Hello_World_HW.h"
   16.13 -
   16.14 -
   16.15 -
   16.16 -//====================================================================
   16.17 -/*This is the ping-pong timeline for the Hello World hardware
   16.18 - *
   16.19 - *It has only one kind of span, which only puts a communication on
   16.20 - * the timeline's one out-port.
   16.21 - * 
   16.22 - *The in-port has only one trigger registered on it, which fires that
   16.23 - * span.
   16.24 - */
   16.25 -
   16.26 -#define NO_MSG NULL
   16.27 -#define PORT0 0
   16.28 -
   16.29 -/*
   16.30 - *Note, the returned value is passed to the timing function
   16.31 - */
   16.32 -void *
   16.33 -behaviorOf_ping_pong_span( void *_params, HWSimTimeline *timeline )
   16.34 - {
   16.35 -   PingPongParams  *params;
   16.36 -   params    = (PingPongParams *)_params;
   16.37 -//         DEBUG( dbgHW, "ping pong span\n", clone_PingPongParams(params) );
   16.38 -   
   16.39 -   //HWSim__send_on_port( NO_MSG, PORT0, timeline );
   16.40 - }
   16.41 -
   16.42 -uint64
   16.43 -timingOf_ping_pong_span( void * dataFromBehaviorFn )
   16.44 - {
   16.45 -   return 10;
   16.46 - }
   16.47 -
    17.1 --- a/src/Application/SimParams.c	Wed Jan 04 16:41:01 2012 -0800
    17.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    17.3 @@ -1,155 +0,0 @@
    17.4 -/*
    17.5 -
    17.6 - *  Copyright 2009 OpenSourceStewardshipFoundation.org
    17.7 -
    17.8 - *  Licensed under GNU General Public License version 2
    17.9 -
   17.10 - *
   17.11 -
   17.12 - * Author: seanhalle@yahoo.com
   17.13 -
   17.14 - *
   17.15 -
   17.16 - * Created on November 15, 2009, 2:35 AM
   17.17 -
   17.18 - */
   17.19 -
   17.20 -
   17.21 -
   17.22 -#include <malloc.h>
   17.23 -
   17.24 -#include <stdlib.h>
   17.25 -
   17.26 -
   17.27 -
   17.28 -#include "SimParams.h"
   17.29 -
   17.30 -#include "ParamHelper/Param.h"
   17.31 -
   17.32 -
   17.33 -
   17.34 -
   17.35 -
   17.36 -uint8 *
   17.37 -
   17.38 -read_Machine_Code_From_File( int numBytesInFile, char *machineCodeFileName );
   17.39 -
   17.40 -
   17.41 -
   17.42 - 
   17.43 -
   17.44 -void
   17.45 -
   17.46 -fill_sim_params_from_bag( SimulationParams *simParams, ParamBag *paramBag )
   17.47 -
   17.48 - { char *guestAppFileName, *systemCodeFileName;
   17.49 -
   17.50 -   int numBytesInGuestApp, numBytesInSystemCode;
   17.51 -
   17.52 -   
   17.53 -
   17.54 -      ParamStruc *param;
   17.55 -
   17.56 -      //param = getParamFromBag( "GuestApplicationFileName", paramBag );
   17.57 -
   17.58 -   guestAppFileName = param->strValue;
   17.59 -
   17.60 -      //param = getParamFromBag( "numBytesInGuestApp", paramBag );
   17.61 -
   17.62 -   numBytesInGuestApp = param->intValue;
   17.63 -
   17.64 -
   17.65 -
   17.66 -   simParams->guestApp =
   17.67 -
   17.68 -    read_Machine_Code_From_File( numBytesInGuestApp, guestAppFileName );
   17.69 -
   17.70 -
   17.71 -
   17.72 -      //param = getParamFromBag( "SystemCodeFileName", paramBag );
   17.73 -
   17.74 -   systemCodeFileName = param->strValue;
   17.75 -
   17.76 -      //param = getParamFromBag( "numBytesInSystemCode", paramBag );
   17.77 -
   17.78 -   numBytesInSystemCode = param->intValue;
   17.79 -
   17.80 -
   17.81 -
   17.82 -   simParams->systemCode =
   17.83 -
   17.84 -    read_Machine_Code_From_File( numBytesInSystemCode, systemCodeFileName );
   17.85 -
   17.86 -
   17.87 -
   17.88 -
   17.89 -
   17.90 -      //param = getParamFromBag( "numNodes", paramBag );
   17.91 -
   17.92 -   simParams->numNodes = param->intValue;
   17.93 -
   17.94 -
   17.95 -
   17.96 - }
   17.97 -
   17.98 -
   17.99 -
  17.100 -
  17.101 -
  17.102 -
  17.103 -
  17.104 -uint8 *
  17.105 -
  17.106 -read_Machine_Code_From_File( int numBytesInFile, char *machineCodeFileName )
  17.107 -
  17.108 - { int byte;
  17.109 -
  17.110 -   FILE  *file;
  17.111 -
  17.112 -   char  *machineCode = malloc( numBytesInFile );
  17.113 -
  17.114 -   if( machineCode == NULL ) printf( "\nno mem for machine code\n" );
  17.115 -
  17.116 -   
  17.117 -
  17.118 -   file = fopen( machineCodeFileName, "r" );
  17.119 -
  17.120 -   if( file == NULL ) { printf( "\nCouldn't open file!!\n"); exit(1);}
  17.121 -
  17.122 -
  17.123 -
  17.124 -   fseek( file, 0, SEEK_SET );
  17.125 -
  17.126 -   for( byte = 0; byte < numBytesInFile; byte++ )
  17.127 -
  17.128 -    {
  17.129 -
  17.130 -      if( feof( file ) )  printf( "file ran out too soon" );
  17.131 -
  17.132 -//      machineCode[byte] = getchar( file );
  17.133 -
  17.134 -      
  17.135 -
  17.136 -    }
  17.137 -
  17.138 -   return machineCode;
  17.139 -
  17.140 - }
  17.141 -
  17.142 -
  17.143 -
  17.144 -
  17.145 -
  17.146 - //==========================================================================
  17.147 -
  17.148 -void
  17.149 -
  17.150 -printSimResults( SimulationResults simResults )
  17.151 -
  17.152 - { 
  17.153 -
  17.154 - }
  17.155 -
  17.156 -
  17.157 -
  17.158 -
    18.1 --- a/src/Application/SimParams.h	Wed Jan 04 16:41:01 2012 -0800
    18.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    18.3 @@ -1,45 +0,0 @@
    18.4 -/*
    18.5 - *  Copyright 2011 OpenSourceStewardshipFoundation.org
    18.6 - *  Licensed under GNU General Public License version 2 
    18.7 - */
    18.8 -
    18.9 -#ifndef SIM_PARAMS_
   18.10 -#define SIM_PARAMS_
   18.11 -
   18.12 -#include <stdio.h>
   18.13 -#include <unistd.h>
   18.14 -#include <malloc.h>
   18.15 -
   18.16 -#include "../HWSim_lib/VMS/VMS_primitive_data_types.h"
   18.17 -#include "ParamHelper/Param.h"
   18.18 -
   18.19 -
   18.20 -//==============================  Structures  ==============================
   18.21 -typedef struct
   18.22 - { uint8 *guestApp;
   18.23 -   uint8 *systemCode;
   18.24 -   int32 numNodes;
   18.25 - }
   18.26 -SimulationResults;
   18.27 -
   18.28 -typedef struct
   18.29 - { uint8 *guestApp;
   18.30 -   uint8 *systemCode;
   18.31 -   int32 numNodes;
   18.32 -   SimulationResults *simResults;
   18.33 - }
   18.34 -SimulationParams;
   18.35 -
   18.36 -//==============================  Functions  ================================
   18.37 -void
   18.38 -printSimResults( SimulationResults simResults );
   18.39 -
   18.40 -void
   18.41 -fill_sim_params_from_bag( SimulationParams *simParams, ParamBag *paramBag );
   18.42 -
   18.43 -
   18.44 -//===========================================================================
   18.45 -
   18.46 -#endif /**/
   18.47 -
   18.48 -
    19.1 --- a/src/Application/main.c	Wed Jan 04 16:41:01 2012 -0800
    19.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    19.3 @@ -1,52 +0,0 @@
    19.4 -/*
    19.5 - *  Copyright 2011 OpenSourceStewardshipFoundation.org
    19.6 - *  Licensed under BSD
    19.7 - *
    19.8 - * author seanhalle@yahoo.com
    19.9 - */
   19.10 - 
   19.11 -#include <malloc.h>
   19.12 -#include <stdlib.h>
   19.13 -
   19.14 -#include "SimParams.h"
   19.15 -#include "HWSim__Hello_World_HW/HWSim__Hello_World_HW.h"
   19.16 -
   19.17 -char __ProgrammName[] = "HWSim Hello World";
   19.18 -char __DataSet[255];
   19.19 -char __Scheduler[];
   19.20 -
   19.21 -/*
   19.22 - *
   19.23 - * 
   19.24 - */
   19.25 -
   19.26 -int main( int argc, char **argv )
   19.27 - { ParamBag      *simParams;
   19.28 -   HWSimNetlist  *netlist;
   19.29 -   HWSimResults  *simResults;
   19.30 -
   19.31 -   printf( "param file name: %s\n", argv[1] );
   19.32 -   printf("Paraver trace file %s\n", argv[2]);
   19.33 -
   19.34 -#ifdef FAKE
   19.35 -	simParams= NULL;
   19.36 -#else
   19.37 -   simParams = makeParamBag();
   19.38 -   readParamFileIntoBag( argv[1], simParams );
   19.39 -#endif
   19.40 -   
   19.41 -   netlist = createPingPongNetlist();
   19.42 -#ifdef FAKE
   19.43 -   simResults= create_simulation_results__fake(simParams,netlist);
   19.44 -#else
   19.45 -   simResults = 
   19.46 -    HWSim__run_simulation( simParams, netlist );
   19.47 -#endif
   19.48 -
   19.49 -      //HWSim 
   19.50 -   HWSim__generate_paraver_output(argv[2], simResults, netlist);
   19.51 -   //HWSim__generate_vcd_output( simResults );
   19.52 -   
   19.53 -   exit(0); //cleans up
   19.54 - }
   19.55 -