Mercurial > cgi-bin > hgwebdir.cgi > PR > Applications > HWSim > HWSim__LPGPU_Arch__HWDef
changeset 1:46c8ea895bff
changed naming and #includes to LPGPU_Arch
| author | kshalle |
|---|---|
| date | Mon, 13 Feb 2012 15:10:30 -0800 |
| parents | def43ecee616 |
| children | f068965d9269 |
| files | .hgignore CircuitNetlistCreator.c HWSim__LPGPU_Arch__HWDef/CommPath_TimeSpan_Fns.c HWSim__LPGPU_Arch__HWDef/FakeSim.c HWSim__LPGPU_Arch__HWDef/HWSim__LPGPU_Arch__HWDef.h HWSim__LPGPU_Arch__HWDef/HWSim__PingPong__HWDef.h HWSim__LPGPU_Arch__HWDef/HW_DESIGN_NOTES.txt HWSim__LPGPU_Arch__HWDef/PingPongElem_Activities.c HWSim__LPGPU_Arch__HWDef/PingPong_TimeLine.c SimParams.c SimParams.h main.c |
| diffstat | 12 files changed, 250 insertions(+), 296 deletions(-) [+] |
line diff
1.1 --- a/.hgignore Sat Feb 11 14:29:21 2012 -0800 1.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 1.3 @@ -1,9 +0,0 @@ 1.4 -syntax: glob 1.5 - 1.6 -nbproject 1.7 -build 1.8 -dist 1.9 -*.o 1.10 -.dep.inc 1.11 -Makefile 1.12 -notes
2.1 --- a/CircuitNetlistCreator.c Sat Feb 11 14:29:21 2012 -0800 2.2 +++ b/CircuitNetlistCreator.c Mon Feb 13 15:10:30 2012 -0800 2.3 @@ -5,101 +5,105 @@ 2.4 * Author: seanhalle@yahoo.com 2.5 * 2.6 */ 2.7 - #include "HWSim__Hello_World_HW/HWSim__Hello_World_HW.h" 2.8 +#include "HWSim__LPGPU_Arch__HWDef/HWSim__LPGPU_Arch__HWDef.h" 2.9 2.10 -/*'wire' is an expr resolves to an actual wire struct instance 2.11 +/*'' is an expr resolves to an actual commPath struct instance 2.12 */ 2.13 -#define setWireValuesTo( wire, fromTLIdx, outPort, toTLIdx, inPort, dataPtr)\ 2.14 +#define setCommPathValuesTo( commPath, fromElIdx, outPort, toElIdx, inPort,\ 2.15 + commTimeFnPtr, dataPtr)\ 2.16 do{\ 2.17 - wire->idxOfFromTimeline = fromTLIdx; \ 2.18 - wire->idxOfFromOutPort = fromTLIdx; \ 2.19 - wire->idxOfToTimeline = toTLIdx; \ 2.20 - wire->idxOfToInPort = inPort; \ 2.21 - wire->archSpecCommPathData = dataPtr; \ 2.22 + commPath->idxOfFromElem = fromElIdx; \ 2.23 + commPath->idxOfFromOutPort = fromElIdx; \ 2.24 + commPath->idxOfToElem = toElIdx; \ 2.25 + commPath->idxOfToInPort = inPort; \ 2.26 + commPath->commTimeFnPtr = commTimeFnPtr;\ 2.27 + commPath->archSpecCommPathData = dataPtr; \ 2.28 }while(0); //macro magic for namespace 2.29 2.30 2.31 -HWSimSpanType* createPingPongSpanType (); 2.32 +HWSimActivityType* createPingPongActivityType (); 2.33 2.34 -HWSimTimeline* createAPingPongTimeline (HWSimNetlist *netlist); 2.35 +HWSimElem* createAPingPongElem (HWSimNetlist *netlist); 2.36 2.37 /*This file constructs the netlist for the Hello World circuit, which is 2.38 * used during design and implementation of the HWSim language 2.39 * 2.40 - *It has two timelines, each with one input port and one output port, and 2.41 - * a single span-type. 2.42 + *It has two elements, each with one input port and one output port, and 2.43 + * a single activity-type. 2.44 * 2.45 - *The timelines are cross-coupled, so output port of one connects to input 2.46 + *The elements are cross-coupled, so output port of one connects to input 2.47 * port of the other. The input port has a single trigger, which fires 2.48 - * the one span-type. 2.49 + * the one activity-type. 2.50 * 2.51 - *The span does nothing, except send a NULL message on the output port. 2.52 - *The span-sim-time and communication-sim-time are both constants. 2.53 + *The activity does nothing, except send a NULL message on the output port. 2.54 + *The activity-sim-time and communication-sim-time are both constants. 2.55 * 2.56 - *Note that timelines are generic. They are specialized by declaring 2.57 + *Note that elements are generic. They are specialized by declaring 2.58 * inports and outports, and by registering triggers that fire particular 2.59 - * span-types. 2.60 + * activity-types. 2.61 */ 2.62 HWSimNetlist *createPingPongNetlist() 2.63 { HWSimNetlist *netlist; 2.64 - HWSimCommPath **wires; 2.65 - HWSimTimeline **timelines; 2.66 - int32 numTimelines; 2.67 - int32 numWires; 2.68 - HWSimSpanType *foo; 2.69 + HWSimCommPath **commPaths; 2.70 + HWSimElem **elems; 2.71 + int32 numElems; 2.72 + int32 numCommPaths; 2.73 + HWSimActivityType *foo; 2.74 2.75 netlist = malloc( sizeof(HWSimNetlist) ); 2.76 - //declare timelines numTimelines = 2; 2.77 - timelines = malloc( numTimelines * sizeof(HWSimTimeline) ); 2.78 - netlist->numTimelines = numTimelines; 2.79 - netlist->timelines = timelines; 2.80 - netlist->numSpanTypes = 1; 2.81 - netlist->spanTypes = malloc(netlist->numSpanTypes*sizeof(HWSimSpanType*)); 2.82 - netlist->spanTypes[PING_PONG_TYPE] = createPingPongSpanType(); 2.83 - timelines[0] = createAPingPongTimeline( netlist ); //use info from netlist 2.84 - timelines[1] = createAPingPongTimeline( netlist ); 2.85 - //on one of the timelines, make reset trigger an action 2.86 - timelines[1]->inPorts[-1].triggeredSpanType = 2.87 - netlist->spanTypes[PING_PONG_TYPE]; //Connect timelines together 2.88 + //declare elems numElems = 2; 2.89 + elems = malloc( numElems * sizeof(HWSimElem) ); 2.90 + netlist->numElems = numElems; 2.91 + netlist->elems = elems; 2.92 + netlist->numActivityTypes = 1; 2.93 + netlist->activityTypes = malloc(netlist->numActivityTypes*sizeof(HWSimActivityType*)); 2.94 + netlist->activityTypes[PING_PONG_TYPE] = createPingPongActivityType(); 2.95 + elems[0] = createAPingPongElem( netlist ); //use info from netlist 2.96 + elems[1] = createAPingPongElem( netlist ); 2.97 + //on one of the elems, make reset trigger an action 2.98 + elems[1]->inPorts[-1].triggeredActivityType = 2.99 + netlist->activityTypes[PING_PONG_TYPE]; //Connect elems together 2.100 2.101 - /*OutPorts and InPorts may have many wires attached, but an inPort only 2.102 - * has one kind of span that all incoming communications trigger. That 2.103 - * span can be zero time and then switch on the type of message then 2.104 - * end with a continuation, where the continuation span is chosen by the 2.105 + /*OutPorts and InPorts may have many commPaths attached. 2.106 + * but an inPort only 2.107 + * has one kind of activity that all incoming communications trigger. That 2.108 + * activity can be zero time and then switch on the type of message then 2.109 + * end with a continuation, where the continuation activity is chosen by the 2.110 * switch. 2.111 - *So, a wire only connects an out port to an in port 2.112 + *So, a commPath only connects an out port to an in port 2.113 *The format is: sending TL-index, out-port, dest TL-index, in-port 2.114 */ 2.115 - numWires = 2; 2.116 - wires = malloc( numWires * sizeof(HWSimCommPath) ); 2.117 - netlist->numCommPaths= numWires; 2.118 - netlist->commPaths= wires; 2.119 - //TL 0, out-port 0 to TL 1, in-port 0 2.120 - setWireValuesTo(wires[0], 0,0,1,0, NULL); //These NetlistWires turned into 2.121 - setWireValuesTo(wires[1], 1,0,0,0, NULL); // HWSimWires inside ckt create 2.122 - //TODO: decide how do in-out bidirectional wires -- thinking make it two 2.123 - // separate wires with guard between in-port and out-port 2.124 - //TODO: decide how do guards between ports 2.125 + numCommPaths = 2; 2.126 + commPaths = malloc( numCommPaths * sizeof(HWSimCommPath) ); 2.127 + netlist->numCommPaths= numCommPaths; 2.128 + netlist->commPaths= commPaths; 2.129 + //TL 0, out-port 0 to TL 1, in-port 0 2.130 + setCommPathValuesTo(commPaths[0], 0,0,1,0, &commPath_TimeSpanCalc, NULL); 2.131 + //TL 1, out-port 0 to TL 0, in-port 0 2.132 + setCommPathValuesTo(commPaths[1], 1,0,0,0, &commPath_TimeSpanCalc, NULL); 2.133 + 2.134 + //TODO: decide how do in-out bidirectional commPaths -- thinking make it two 2.135 + // separate commPaths with guard between in-port and out-port 2.136 } 2.137 2.138 - //Note: copy netlist struct with VMS malloc after VMS initialized 2.139 -HWSimTimeline * 2.140 -createAPingPongTimeline( HWSimNetlist *netlist ) 2.141 - { HWSimTimeline *TL; 2.142 - TL = malloc( sizeof(HWSimTimeline) ); 2.143 + //Stefan: copy netlist struct with VMS malloc after VMS initialized? 2.144 +HWSimElem * 2.145 +createAPingPongElem( HWSimNetlist *netlist ) 2.146 + { HWSimElem *TL; 2.147 + TL = malloc( sizeof(HWSimElem) ); 2.148 TL->numInPorts = 1; 2.149 TL->numOutPorts = 1; 2.150 TL->inPorts = HWSim_ext__make_inPortsArray( TL->numInPorts ); 2.151 - TL->inPorts[-1].triggeredSpanType = IDLE_SPAN; //reset port 2.152 - TL->inPorts[0].triggeredSpanType = netlist->spanTypes[PING_PONG_TYPE]; 2.153 + TL->inPorts[-1].triggeredActivityType = IDLE_SPAN; //reset port 2.154 + TL->inPorts[0].triggeredActivityType = netlist->activityTypes[PING_PONG_TYPE]; 2.155 } 2.156 2.157 -HWSimSpanType * 2.158 -createPingPongSpanType( ) 2.159 - { HWSimSpanType *pingPongSpanType; 2.160 - pingPongSpanType = malloc( sizeof(HWSimSpanType) ); 2.161 - pingPongSpanType->behaviorFn = &behaviorOf_ping_pong_span; 2.162 - pingPongSpanType->timingFn = &timingOf_ping_pong_span; 2.163 - return pingPongSpanType; 2.164 +HWSimActivityType * 2.165 +createPingPongActivityType( ) 2.166 + { HWSimActivityType *pingPongActivityType; 2.167 + pingPongActivityType = malloc( sizeof(HWSimActivityType) ); 2.168 + pingPongActivityType->behaviorFn = &pingPongElem_PingActivity_behavior; 2.169 + pingPongActivityType->timingFn = &pingPongElem_PingActivity_timing; 2.170 + return pingPongActivityType; 2.171 } 2.172
3.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 3.2 +++ b/HWSim__LPGPU_Arch__HWDef/CommPath_TimeSpan_Fns.c Mon Feb 13 15:10:30 2012 -0800 3.3 @@ -0,0 +1,35 @@ 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 + 3.12 +#include "HWSim__LPGPU_Arch__HWDef.h" 3.13 + 3.14 + 3.15 + 3.16 +//==================================================================== 3.17 +/*This is the ping-pong element for the Hello World hardware 3.18 + * 3.19 + *It has only one kind of activity, which only puts a communication on 3.20 + * the element's one out-port. 3.21 + * 3.22 + *The in-port has only one trigger registered on it, which fires that 3.23 + * activity. 3.24 + */ 3.25 + 3.26 +#define NO_MSG NULL 3.27 +#define PORT0 0 3.28 + 3.29 +/* 3.30 + *Note, the returned value is passed to the timing function 3.31 + */ 3.32 +HWSimTimeSpan 3.33 +commPath_TimeSpanCalc( HWSimCommPath *commPath, HWSimActivityInst *sendingActivity ) 3.34 + { 3.35 +// DEBUG( dbgHW, "comm", debugInfoForCommPath(commPath), debugInfoForActivity(sendingActivity) ); 3.36 + return 5; 3.37 + } 3.38 +
4.1 --- a/HWSim__LPGPU_Arch__HWDef/FakeSim.c Sat Feb 11 14:29:21 2012 -0800 4.2 +++ b/HWSim__LPGPU_Arch__HWDef/FakeSim.c Mon Feb 13 15:10:30 2012 -0800 4.3 @@ -1,5 +1,5 @@ 4.4 #include <stdlib.h> 4.5 -#include "HWSim__Hello_World_HW.h" 4.6 +#include "HWSim__LPGPU_Arch__HWDef.h" 4.7 4.8 void checkMalloc (void *ptr) { 4.9 if (ptr == NULL) { 4.10 @@ -8,17 +8,17 @@ 4.11 } 4.12 } 4.13 4.14 -HWSimTimeline* malloc_timlines (int nrTimelines) { 4.15 - HWSimTimeline *timelines; 4.16 +HWSimElem* malloc_timlines (int nrElems) { 4.17 + HWSimElem *elems; 4.18 int i; 4.19 4.20 - timelines= malloc(nrTimelines*(sizeof(HWSimTimeline))); 4.21 - checkMalloc(timelines); 4.22 - for (i= 0; i<nrTimelines; i++) { 4.23 - timelines[i].animatingVP= malloc(sizeof(VirtProcr)); 4.24 - checkMalloc(timelines[i].animatingVP); 4.25 + elems= malloc(nrElems*(sizeof(HWSimElem))); 4.26 + checkMalloc(elems); 4.27 + for (i= 0; i<nrElems; i++) { 4.28 + elems[i].animatingVP= malloc(sizeof(SlaveVP)); 4.29 + checkMalloc(elems[i].animatingVP); 4.30 } 4.31 - return timelines; 4.32 + return elems; 4.33 } 4.34 4.35 HWSimResults* malloc_simResults (int nrExecutions, int nrComms) { 4.36 @@ -29,22 +29,22 @@ 4.37 simResults= malloc(sizeof(HWSimResults)); 4.38 checkMalloc(simResults); 4.39 4.40 - simResults->numTimelines= nrExecutions; 4.41 - simResults->timelineTraces= 4.42 - malloc(simResults->numTimelines*sizeof(HWSimTimelineTrace *)); 4.43 + simResults->numElems= nrExecutions; 4.44 + simResults->elemTraces= 4.45 + malloc(simResults->numElems*sizeof(HWSimElemTrace *)); 4.46 4.47 - for (i= 0; i<simResults->numTimelines; i++) { 4.48 - simResults->timelineTraces[i]= malloc(sizeof(HWSimTimelineTrace)); 4.49 - checkMalloc(simResults->timelineTraces[i]); 4.50 - simResults->timelineTraces[i]->spanRecs= malloc(sizeof(HWSimSpanRec)); 4.51 + for (i= 0; i<simResults->numElems; i++) { 4.52 + simResults->elemTraces[i]= malloc(sizeof(HWSimElemTrace)); 4.53 + checkMalloc(simResults->elemTraces[i]); 4.54 + simResults->elemTraces[i]->activityRecs= malloc(sizeof(HWSimActivityRec)); 4.55 } 4.56 4.57 simResults->numCommTraces= nrComms; 4.58 simResults->commTraces= 4.59 - malloc(simResults->numCommTraces*sizeof(HWSimWireTrace *)); 4.60 + malloc(simResults->numCommTraces*sizeof(HWSimCommPathTrace *)); 4.61 checkMalloc(simResults->commTraces); 4.62 for (i= 0; i<simResults->numCommTraces; i++) { 4.63 - simResults->commTraces[i]= malloc(sizeof(HWSimWireTrace)); 4.64 + simResults->commTraces[i]= malloc(sizeof(HWSimCommPathTrace)); 4.65 checkMalloc(simResults->commTraces[i]); 4.66 // FRAGILE -> valgrind 4.67 simResults->commTraces[i]->commRecs= malloc(sizeof(HWSimCommRec)); 4.68 @@ -59,44 +59,44 @@ 4.69 4.70 simResults= malloc_simResults(4,3); 4.71 4.72 - //--------------- timelineTraces ------------------------------------ 4.73 - // 2 times a ping span 4.74 - simResults->timelineTraces[0]->timeline= netlist->timelines[0]; 4.75 - simResults->timelineTraces[0]->spanRecs->spanSeqNum= 0; // unique ??? 4.76 - simResults->timelineTraces[0]->spanRecs->startTime= 1; 4.77 - simResults->timelineTraces[0]->spanRecs->endTime=2; 4.78 + //--------------- elemTraces ------------------------------------ 4.79 + // 2 times a ping activity 4.80 + simResults->elemTraces[0]->elem= netlist->elems[0]; 4.81 + simResults->elemTraces[0]->activityRecs->activitySeqNum= 0; // unique ??? 4.82 + simResults->elemTraces[0]->activityRecs->startTime= 1; 4.83 + simResults->elemTraces[0]->activityRecs->endTime=2; 4.84 4.85 - simResults->timelineTraces[1]->timeline= netlist->timelines[0]; 4.86 - simResults->timelineTraces[1]->spanRecs->spanSeqNum= 1; 4.87 - simResults->timelineTraces[1]->spanRecs->startTime= 5; 4.88 - simResults->timelineTraces[1]->spanRecs->endTime=6; 4.89 + simResults->elemTraces[1]->elem= netlist->elems[0]; 4.90 + simResults->elemTraces[1]->activityRecs->activitySeqNum= 1; 4.91 + simResults->elemTraces[1]->activityRecs->startTime= 5; 4.92 + simResults->elemTraces[1]->activityRecs->endTime=6; 4.93 4.94 - // 2 times a pong span 4.95 - simResults->timelineTraces[2]->timeline= netlist->timelines[1]; 4.96 - simResults->timelineTraces[2]->spanRecs->spanSeqNum= 2; // unique ??? 4.97 - simResults->timelineTraces[2]->spanRecs->startTime= 3; 4.98 - simResults->timelineTraces[2]->spanRecs->endTime=4; 4.99 + // 2 times a pong activity 4.100 + simResults->elemTraces[2]->elem= netlist->elems[1]; 4.101 + simResults->elemTraces[2]->activityRecs->activitySeqNum= 2; // unique ??? 4.102 + simResults->elemTraces[2]->activityRecs->startTime= 3; 4.103 + simResults->elemTraces[2]->activityRecs->endTime=4; 4.104 4.105 - simResults->timelineTraces[3]->timeline= netlist->timelines[1]; 4.106 - simResults->timelineTraces[3]->spanRecs->spanSeqNum= 3; 4.107 - simResults->timelineTraces[3]->spanRecs->startTime= 7; 4.108 - simResults->timelineTraces[3]->spanRecs->endTime=8; 4.109 + simResults->elemTraces[3]->elem= netlist->elems[1]; 4.110 + simResults->elemTraces[3]->activityRecs->activitySeqNum= 3; 4.111 + simResults->elemTraces[3]->activityRecs->startTime= 7; 4.112 + simResults->elemTraces[3]->activityRecs->endTime=8; 4.113 4.114 4.115 - // a HWSimTimeline does not contain any helpful additional information to 4.116 - // identify or label a Timeline . 4.117 - // But a unique Timeline identifier is disireable. Therefore at the moment the 4.118 + // a HWSimElem does not contain any helpful additional information to 4.119 + // identify or label a Element . 4.120 + // But a unique Element identifier is disireable. Therefore at the moment the 4.121 // procrID of the anumating Procr ist used 4.122 4.123 - // Information about the Span is required, at least a ID.The current 4.124 - // spanType doesn't provide it 4.125 + // Information about the Activity is required, at least a ID.The current 4.126 + // activityType doesn't provide it 4.127 4.128 4.129 //-------------------- Coomunication Trace --------------------- 4.130 4.131 //ping to pong 2 - 3 4.132 - simResults->commTraces[0]->fromTimeline= netlist->timelines[0]; 4.133 - simResults->commTraces[0]->toTimeline= netlist->timelines[1]; 4.134 + simResults->commTraces[0]->fromElem= netlist->elems[0]; 4.135 + simResults->commTraces[0]->toElem= netlist->elems[1]; 4.136 simResults->commTraces[0]->numComms= 1; 4.137 simResults->commTraces[0]->commRecs->commID= 0; 4.138 simResults->commTraces[0]->commRecs->msgID= 0; 4.139 @@ -104,8 +104,8 @@ 4.140 simResults->commTraces[0]->commRecs->endTime= 3; 4.141 4.142 //pong to ping 4 - 5 4.143 - simResults->commTraces[1]->fromTimeline= netlist->timelines[1]; 4.144 - simResults->commTraces[1]->toTimeline= netlist->timelines[0]; 4.145 + simResults->commTraces[1]->fromElem= netlist->elems[1]; 4.146 + simResults->commTraces[1]->toElem= netlist->elems[0]; 4.147 simResults->commTraces[1]->numComms= 1; 4.148 simResults->commTraces[1]->commRecs->commID= 1; 4.149 simResults->commTraces[1]->commRecs->msgID= 1; 4.150 @@ -113,8 +113,8 @@ 4.151 simResults->commTraces[1]->commRecs->endTime= 5; 4.152 4.153 //ping to pong 6 - 7 4.154 - simResults->commTraces[2]->fromTimeline= netlist->timelines[0]; 4.155 - simResults->commTraces[2]->toTimeline= netlist->timelines[1]; 4.156 + simResults->commTraces[2]->fromElem= netlist->elems[0]; 4.157 + simResults->commTraces[2]->toElem= netlist->elems[1]; 4.158 simResults->commTraces[2]->numComms= 1; 4.159 simResults->commTraces[2]->commRecs= malloc(sizeof(HWSimCommRec)); 4.160 simResults->commTraces[2]->commRecs->commID= 2;
5.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 5.2 +++ b/HWSim__LPGPU_Arch__HWDef/HWSim__LPGPU_Arch__HWDef.h Mon Feb 13 15:10:30 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 "../../VMS_Implementations/HWSim_impl/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 activityTypes 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 +//============================= Activity Functions ========================= 5.34 +void * 5.35 +pingPongElem_PingActivity_behavior( void *_params, HWSimElem *timeLine ); 5.36 + 5.37 +uint64 5.38 +pingPongElem_PingActivity_timing( 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 --- a/HWSim__LPGPU_Arch__HWDef/HWSim__PingPong__HWDef.h Sat Feb 11 14:29:21 2012 -0800 6.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 6.3 @@ -1,48 +0,0 @@ 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_lib.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 -//Different spanTypes 6.23 -#define PING_PONG_TYPE 0 6.24 - 6.25 - 6.26 -//============================== Structures ============================== 6.27 -typedef struct 6.28 - { 6.29 - } 6.30 -PingPongParams; 6.31 - 6.32 - 6.33 -//============================= Span Functions ========================= 6.34 -void * 6.35 -behaviorOf_ping_pong_span( void *_params, HWSimTimeline *timeLine ); 6.36 - 6.37 -uint64 6.38 -timingOf_ping_pong_span( void * dataFromBehaviorFn ); 6.39 - 6.40 -//======================== Simulation Fake ================================== 6.41 -#ifdef FAKE 6.42 -HWSimResults* create_simulation_results__fake(void *simParams,HWSimNetlist *netlist); 6.43 -#endif 6.44 - 6.45 -//======================== Netlist creation ================================== 6.46 - 6.47 -HWSimNetlist* createPingPongNetlist (); 6.48 - 6.49 -#endif /**/ 6.50 - 6.51 -
7.1 --- a/HWSim__LPGPU_Arch__HWDef/HW_DESIGN_NOTES.txt Sat Feb 11 14:29:21 2012 -0800 7.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 7.3 @@ -1,1 +0,0 @@ 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__LPGPU_Arch__HWDef/PingPongElem_Activities.c Mon Feb 13 15:10:30 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__LPGPU_Arch__HWDef.h" 8.13 + 8.14 + 8.15 + 8.16 +//==================================================================== 8.17 +/*This is the ping-pong element for the Hello World hardware 8.18 + * 8.19 + *It has only one kind of activity, which only puts a communication on 8.20 + * the element's one out-port. 8.21 + * 8.22 + *The in-port has only one trigger registered on it, which fires that 8.23 + * activity. 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 +pingPongElem_PingActivity_behavior( void *_params, HWSimElem *elem ) 8.34 + { 8.35 + PingPongParams *params; 8.36 + params = (PingPongParams *)_params; 8.37 +// DEBUG( dbgHW, "ping pong activity\n", clone_PingPongParams(params) ); 8.38 + 8.39 +// HWSim__send_on_port( NO_MSG, PORT0, elem ); 8.40 + } 8.41 + 8.42 +HWSimTimeSpan 8.43 +pingPongElem_PingActivity_timing( void * dataFromBehaviorFn ) 8.44 + { 8.45 + return 10; 8.46 + } 8.47 +
9.1 --- a/HWSim__LPGPU_Arch__HWDef/PingPong_TimeLine.c Sat Feb 11 14:29:21 2012 -0800 9.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 9.3 @@ -1,44 +0,0 @@ 9.4 -/* 9.5 - * Copyright 2011 OpenSourceStewardshipFoundation.org 9.6 - * Licensed under GNU General Public License version 2 9.7 - * 9.8 - * Author: seanhalle@yahoo.com 9.9 - * 9.10 - */ 9.11 - 9.12 -#include "HWSim__Hello_World_HW.h" 9.13 - 9.14 - 9.15 - 9.16 -//==================================================================== 9.17 -/*This is the ping-pong timeline for the Hello World hardware 9.18 - * 9.19 - *It has only one kind of span, which only puts a communication on 9.20 - * the timeline's one out-port. 9.21 - * 9.22 - *The in-port has only one trigger registered on it, which fires that 9.23 - * span. 9.24 - */ 9.25 - 9.26 -#define NO_MSG NULL 9.27 -#define PORT0 0 9.28 - 9.29 -/* 9.30 - *Note, the returned value is passed to the timing function 9.31 - */ 9.32 -void * 9.33 -behaviorOf_ping_pong_span( void *_params, HWSimTimeline *timeline ) 9.34 - { 9.35 - PingPongParams *params; 9.36 - params = (PingPongParams *)_params; 9.37 -// DEBUG( dbgHW, "ping pong span\n", clone_PingPongParams(params) ); 9.38 - 9.39 -// HWSim__send_on_port( NO_MSG, PORT0, timeline ); 9.40 - } 9.41 - 9.42 -HWSimTimePeriod 9.43 -timingOf_ping_pong_span( void * dataFromBehaviorFn ) 9.44 - { 9.45 - return 10; 9.46 - } 9.47 -
10.1 --- a/SimParams.c Sat Feb 11 14:29:21 2012 -0800 10.2 +++ b/SimParams.c Mon Feb 13 15:10:30 2012 -0800 10.3 @@ -1,155 +1,77 @@ 10.4 /* 10.5 - 10.6 * Copyright 2009 OpenSourceStewardshipFoundation.org 10.7 - 10.8 * Licensed under GNU General Public License version 2 10.9 - 10.10 * 10.11 - 10.12 * Author: seanhalle@yahoo.com 10.13 - 10.14 * 10.15 - 10.16 * Created on November 15, 2009, 2:35 AM 10.17 - 10.18 */ 10.19 10.20 10.21 - 10.22 #include <malloc.h> 10.23 - 10.24 #include <stdlib.h> 10.25 10.26 10.27 - 10.28 #include "SimParams.h" 10.29 10.30 -#include "ParamHelper/Param.h" 10.31 - 10.32 - 10.33 - 10.34 - 10.35 10.36 uint8 * 10.37 - 10.38 read_Machine_Code_From_File( int numBytesInFile, char *machineCodeFileName ); 10.39 10.40 10.41 - 10.42 - 10.43 - 10.44 void 10.45 - 10.46 fill_sim_params_from_bag( SimulationParams *simParams, ParamBag *paramBag ) 10.47 - 10.48 { char *guestAppFileName, *systemCodeFileName; 10.49 - 10.50 int numBytesInGuestApp, numBytesInSystemCode; 10.51 - 10.52 10.53 - 10.54 ParamStruc *param; 10.55 10.56 //param = getParamFromBag( "GuestApplicationFileName", paramBag ); 10.57 - 10.58 guestAppFileName = param->strValue; 10.59 10.60 //param = getParamFromBag( "numBytesInGuestApp", paramBag ); 10.61 - 10.62 numBytesInGuestApp = param->intValue; 10.63 10.64 - 10.65 - 10.66 simParams->guestApp = 10.67 - 10.68 read_Machine_Code_From_File( numBytesInGuestApp, guestAppFileName ); 10.69 10.70 - 10.71 - 10.72 //param = getParamFromBag( "SystemCodeFileName", paramBag ); 10.73 - 10.74 systemCodeFileName = param->strValue; 10.75 10.76 //param = getParamFromBag( "numBytesInSystemCode", paramBag ); 10.77 - 10.78 numBytesInSystemCode = param->intValue; 10.79 10.80 - 10.81 - 10.82 simParams->systemCode = 10.83 - 10.84 read_Machine_Code_From_File( numBytesInSystemCode, systemCodeFileName ); 10.85 10.86 - 10.87 - 10.88 - 10.89 - 10.90 //param = getParamFromBag( "numNodes", paramBag ); 10.91 - 10.92 simParams->numNodes = param->intValue; 10.93 - 10.94 - 10.95 - 10.96 } 10.97 10.98 10.99 - 10.100 - 10.101 - 10.102 - 10.103 - 10.104 uint8 * 10.105 - 10.106 read_Machine_Code_From_File( int numBytesInFile, char *machineCodeFileName ) 10.107 - 10.108 { int byte; 10.109 - 10.110 FILE *file; 10.111 - 10.112 char *machineCode = malloc( numBytesInFile ); 10.113 - 10.114 if( machineCode == NULL ) printf( "\nno mem for machine code\n" ); 10.115 10.116 - 10.117 - 10.118 file = fopen( machineCodeFileName, "r" ); 10.119 - 10.120 if( file == NULL ) { printf( "\nCouldn't open file!!\n"); exit(1);} 10.121 10.122 - 10.123 - 10.124 fseek( file, 0, SEEK_SET ); 10.125 - 10.126 for( byte = 0; byte < numBytesInFile; byte++ ) 10.127 - 10.128 { 10.129 - 10.130 if( feof( file ) ) printf( "file ran out too soon" ); 10.131 - 10.132 // machineCode[byte] = getchar( file ); 10.133 - 10.134 - 10.135 - 10.136 } 10.137 - 10.138 return machineCode; 10.139 - 10.140 } 10.141 10.142 10.143 - 10.144 - 10.145 - 10.146 - //========================================================================== 10.147 - 10.148 +//========================================================================== 10.149 void 10.150 - 10.151 printSimResults( SimulationResults simResults ) 10.152 - 10.153 { 10.154 - 10.155 } 10.156 10.157 - 10.158 - 10.159 -
11.1 --- a/SimParams.h Sat Feb 11 14:29:21 2012 -0800 11.2 +++ b/SimParams.h Mon Feb 13 15:10:30 2012 -0800 11.3 @@ -10,8 +10,8 @@ 11.4 #include <unistd.h> 11.5 #include <malloc.h> 11.6 11.7 -#include "../HWSim_lib/VMS/VMS_primitive_data_types.h" 11.8 -#include "ParamHelper/Param.h" 11.9 +#include "../VMS_Implementations/VMS_impl/VMS_primitive_data_types.h" 11.10 +#include "../C_Libraries/ParamHelper/Param.h" 11.11 11.12 11.13 //============================== Structures ==============================
12.1 --- a/main.c Sat Feb 11 14:29:21 2012 -0800 12.2 +++ b/main.c Mon Feb 13 15:10:30 2012 -0800 12.3 @@ -9,7 +9,10 @@ 12.4 #include <stdlib.h> 12.5 12.6 #include "SimParams.h" 12.7 -#include "HWSim__Hello_World_HW/HWSim__Hello_World_HW.h" 12.8 +#include "HWSim__LPGPU_Arch__HWDef/HWSim__LPGPU_Arch__HWDef.h" 12.9 +//Stefan: name conflict here -- MC_shared version of params is in HWSim__PingPong__HWDef.h, but need normal C version here 12.10 +#include "../C_Libraries/ParamHelper/Param.h" 12.11 + 12.12 12.13 char __ProgrammName[] = "HWSim Hello World"; 12.14 char __DataSet[255];
