Mercurial > cgi-bin > hgwebdir.cgi > PR > Applications > HWSim > HWSim__PingPong__HWDef
comparison CircuitNetlistCreator.c @ 16:df53f52ef49c
naming conflicts fixed
HWSimResults changed, so FakeSim needs an update -> TODO Stefan
author | hausers |
---|---|
date | Fri, 17 Feb 2012 17:41:12 +0100 |
parents | ddd87abfeefd |
children | fa277c6ce6f2 |
comparison
equal
deleted
inserted
replaced
3:29e6d6469f69 | 4:915b4cc14ff1 |
---|---|
8 #include "HWSim__PingPong__HWDef/HWSim__PingPong__HWDef.h" | 8 #include "HWSim__PingPong__HWDef/HWSim__PingPong__HWDef.h" |
9 | 9 |
10 /*'' is an expr resolves to an actual commPath struct instance | 10 /*'' is an expr resolves to an actual commPath struct instance |
11 */ | 11 */ |
12 #define setCommPathValuesTo( commPath, fromElIdx, outPort, toElIdx, inPort,\ | 12 #define setCommPathValuesTo( commPath, fromElIdx, outPort, toElIdx, inPort,\ |
13 commTimeFnPtr, dataPtr)\ | 13 timeFnPtr, dataPtr)\ |
14 do{\ | 14 do{\ |
15 commPath->idxOfFromElem = fromElIdx; \ | 15 commPath->idxOfFromElem = fromElIdx; \ |
16 commPath->idxOfFromOutPort = fromElIdx; \ | 16 commPath->idxOfFromOutPort = fromElIdx; \ |
17 commPath->idxOfToElem = toElIdx; \ | 17 commPath->idxOfToElem = toElIdx; \ |
18 commPath->idxOfToInPort = inPort; \ | 18 commPath->idxOfToInPort = inPort; \ |
19 commPath->commTimeFnPtr = commTimeFnPtr;\ | 19 commPath->commTimeCalcFn = timeFnPtr;\ |
20 commPath->archSpecCommPathData = dataPtr; \ | 20 commPath->archSpecCommPathData = dataPtr; \ |
21 }while(0); //macro magic for namespace | 21 }while(0); //macro magic for namespace |
22 | 22 |
23 | 23 |
24 HWSimActivityType* createPingPongActivityType (); | 24 HWSimActivityType* createPingPongActivityType (); |
46 { HWSimNetlist *netlist; | 46 { HWSimNetlist *netlist; |
47 HWSimCommPath **commPaths; | 47 HWSimCommPath **commPaths; |
48 HWSimElem **elems; | 48 HWSimElem **elems; |
49 int32 numElems; | 49 int32 numElems; |
50 int32 numCommPaths; | 50 int32 numCommPaths; |
51 HWSimActivityType *foo; | |
52 | 51 |
53 netlist = malloc( sizeof(HWSimNetlist) ); | 52 netlist = malloc( sizeof(HWSimNetlist) ); |
54 //declare elems numElems = 2; | 53 numElems= 2; |
55 elems = malloc( numElems * sizeof(HWSimElem) ); | 54 elems = malloc( numElems * sizeof(HWSimElem) ); |
56 netlist->numElems = numElems; | 55 netlist->numElems = numElems; |
57 netlist->elems = elems; | 56 netlist->elems = elems; |
58 netlist->numActivityTypes = 1; | 57 netlist->numActivityTypes = 1; |
59 netlist->activityTypes = malloc(netlist->numActivityTypes*sizeof(HWSimActivityType*)); | 58 netlist->activityTypes = malloc(netlist->numActivityTypes*sizeof(HWSimActivityType*)); |
76 numCommPaths = 2; | 75 numCommPaths = 2; |
77 commPaths = malloc( numCommPaths * sizeof(HWSimCommPath) ); | 76 commPaths = malloc( numCommPaths * sizeof(HWSimCommPath) ); |
78 netlist->numCommPaths= numCommPaths; | 77 netlist->numCommPaths= numCommPaths; |
79 netlist->commPaths= commPaths; | 78 netlist->commPaths= commPaths; |
80 //TL 0, out-port 0 to TL 1, in-port 0 | 79 //TL 0, out-port 0 to TL 1, in-port 0 |
81 setCommPathValuesTo(commPaths[0], 0,0,1,0, &commPath_TimeSpanCalc, NULL); | 80 setCommPathValuesTo(commPaths[0],0,0,1,0, commPath_TimeSpanCalc, NULL); |
82 //TL 1, out-port 0 to TL 0, in-port 0 | 81 //TL 1, out-port 0 to TL 0, in-port 0 |
83 setCommPathValuesTo(commPaths[1], 1,0,0,0, &commPath_TimeSpanCalc, NULL); | 82 setCommPathValuesTo(commPaths[1], 1,0,0,0, commPath_TimeSpanCalc, NULL); |
84 | 83 |
85 //TODO: decide how do in-out bidirectional commPaths -- thinking make it two | 84 //TODO: decide how do in-out bidirectional commPaths -- thinking make it two |
86 // separate commPaths with guard between in-port and out-port | 85 // separate commPaths with guard between in-port and out-port |
86 | |
87 return netlist; | |
87 } | 88 } |
88 | 89 |
89 //Stefan: copy netlist struct with VMS malloc after VMS initialized? | 90 //Stefan: copy netlist struct with VMS malloc after VMS initialized? |
91 //Sean: yes, otherwise the user has to deal with VMS details. | |
92 // So we should do this in HWSim__make_netlist_simulatable ? | |
93 // If so, I can do this | |
90 HWSimElem * | 94 HWSimElem * |
91 createAPingPongElem( HWSimNetlist *netlist ) | 95 createAPingPongElem( HWSimNetlist *netlist ) |
92 { HWSimElem *TL; | 96 { HWSimElem *TL; |
93 TL = malloc( sizeof(HWSimElem) ); | 97 TL = malloc( sizeof(HWSimElem) ); |
94 TL->numInPorts = 1; | 98 TL->numInPorts = 1; |
95 TL->numOutPorts = 1; | 99 TL->numOutPorts = 1; |
96 TL->inPorts = HWSim_ext__make_inPortsArray( TL->numInPorts ); | 100 TL->inPorts = HWSim_ext__make_inPortsArray( TL->numInPorts ); |
97 TL->inPorts[-1].triggeredActivityType = IDLE_SPAN; //reset port | 101 TL->inPorts[-1].triggeredActivityType = IDLE_SPAN; //reset port |
98 TL->inPorts[0].triggeredActivityType = netlist->activityTypes[PING_PONG_TYPE]; | 102 TL->inPorts[0].triggeredActivityType = netlist->activityTypes[PING_PONG_TYPE]; |
103 return TL; | |
99 } | 104 } |
100 | 105 |
101 HWSimActivityType * | 106 HWSimActivityType * |
102 createPingPongActivityType( ) | 107 createPingPongActivityType( ) |
103 { HWSimActivityType *pingPongActivityType; | 108 { HWSimActivityType *pingPongActivityType; |