Mercurial > cgi-bin > hgwebdir.cgi > PR > Applications > HWSim > HWSim__PingPong__HWDef
changeset 22:fac65c465f98
chgd to new activityType structure w/booleans in it
author | Some Random Person <seanhalle@yahoo.com> |
---|---|
date | Tue, 15 May 2012 06:00:36 -0700 |
parents | 3a4be4048a21 |
children | c11c48758df3 |
files | CircuitNetlistCreator.c HWSim__PingPong__HWDef/HWSim__PingPong__HWDef.h HWSim__PingPong__HWDef/PingPongElem_Activities.c |
diffstat | 3 files changed, 17 insertions(+), 22 deletions(-) [+] |
line diff
1.1 --- a/CircuitNetlistCreator.c Mon Apr 02 14:06:11 2012 +0200 1.2 +++ b/CircuitNetlistCreator.c Tue May 15 06:00:36 2012 -0700 1.3 @@ -58,14 +58,14 @@ 1.4 netlist->numActivityTypes = 1; 1.5 netlist->activityTypes = malloc(netlist->numActivityTypes*sizeof(HWSimActivityType*)); 1.6 // Stefan: tocheck valgrind 1.7 - netlist->activityTypes[PING_PONG_TYPE] = createPingPongActivityType(); 1.8 + netlist->activityTypes[PING_PONG_ACTIVITY] = createPingPongActivityType(); 1.9 1.10 elems[0] = createAPingPongElem( netlist ); //use info from netlist 1.11 elems[1] = createAPingPongElem( netlist ); 1.12 //on one of the elems, make reset trigger an action 1.13 //Stefan: FIXME 1.14 elems[1]->inPorts[-1].triggeredActivityType = 1.15 - netlist->activityTypes[PING_PONG_TYPE]; //Connect elems together 1.16 + netlist->activityTypes[PING_PONG_ACTIVITY]; //Connect elems together 1.17 1.18 /*OutPorts and InPorts may have many commPaths attached. 1.19 * but an inPort only 1.20 @@ -111,10 +111,6 @@ 1.21 free(netlist); 1.22 } 1.23 1.24 - //Stefan: copy netlist struct with VMS malloc after VMS initialized? 1.25 - //ANSWER: yes, otherwise the user has to deal with VMS details. 1.26 - // So we should do this in HWSim__make_netlist_simulatable -> yes 1.27 - // If so, I can do this 1.28 HWSimElem * 1.29 createAPingPongElem( HWSimNetlist *netlist ) 1.30 { HWSimElem *TL; 1.31 @@ -123,7 +119,7 @@ 1.32 TL->numOutPorts = 1; 1.33 TL->inPorts = HWSim_ext__make_inPortsArray( TL->numInPorts ); 1.34 TL->inPorts[-1].triggeredActivityType = IDLE_SPAN; //reset port 1.35 - TL->inPorts[0].triggeredActivityType = netlist->activityTypes[PING_PONG_TYPE]; 1.36 + TL->inPorts[0].triggeredActivityType = netlist->activityTypes[PING_PONG_ACTIVITY]; 1.37 return TL; 1.38 } 1.39 1.40 @@ -131,8 +127,12 @@ 1.41 createPingPongActivityType( ) 1.42 { HWSimActivityType *pingPongActivityType; 1.43 pingPongActivityType = malloc( sizeof(HWSimActivityType) ); 1.44 - pingPongActivityType->behaviorFn = &pingPongElem_PingActivity_behavior; 1.45 - pingPongActivityType->timingFn = &pingPongElem_PingActivity_timing; 1.46 + 1.47 + pingPongActivityType->hasBehavior = true; 1.48 + pingPongActivityType->hasTiming = true; 1.49 + pingPongActivityType->timingIsFixed = true; 1.50 + pingPongActivityType->fixedTime = 10; 1.51 + pingPongActivityType->behaviorFn = &pingPongElem_PingActivity_behavior; 1.52 return pingPongActivityType; 1.53 - } 1.54 + } 1.55
2.1 --- a/HWSim__PingPong__HWDef/HWSim__PingPong__HWDef.h Mon Apr 02 14:06:11 2012 +0200 2.2 +++ b/HWSim__PingPong__HWDef/HWSim__PingPong__HWDef.h Tue May 15 06:00:36 2012 -0700 2.3 @@ -9,7 +9,7 @@ 2.4 2.5 #include <stdio.h> 2.6 2.7 -#include "../../VMS_Implementations/HWSim_impl/HWSim_lib.h" 2.8 +#include "HWSim_impl/HWSim_lib.h" 2.9 2.10 2.11 //=============================== Defines ============================== 2.12 @@ -17,7 +17,7 @@ 2.13 #define COMMUNICATOR_OUTPORT 1 2.14 2.15 //Different activityTypes 2.16 -#define PING_PONG_TYPE 0 2.17 +#define PING_PONG_ACTIVITY 0 2.18 2.19 2.20 //============================== Structures ==============================
3.1 --- a/HWSim__PingPong__HWDef/PingPongElem_Activities.c Mon Apr 02 14:06:11 2012 +0200 3.2 +++ b/HWSim__PingPong__HWDef/PingPongElem_Activities.c Tue May 15 06:00:36 2012 -0700 3.3 @@ -28,20 +28,15 @@ 3.4 *Note, the returned value is passed to the timing function 3.5 */ 3.6 void * 3.7 -pingPongElem_PingActivity_behavior( void *_params, HWSimElem *elem ) 3.8 - { //Stefan: FIXME 3.9 -// PingPongParams *params; 3.10 -// params = (PingPongParams *)_params; 3.11 -//// DEBUG( dbgHW, "ping pong activity\n", clone_PingPongParams(params) ); 3.12 -// 3.13 -//// HWSim__send_on_port( NO_MSG, PORT0, elem ); 3.14 -// return params; 3.15 - printf("Ping-Pong\n"); 3.16 +pingPongElem_PingActivity_behavior( HWSimElem *elem ) 3.17 + { DEBUG_printf( dbgHW, "ping pong activity\n" ); 3.18 + 3.19 + HWSim__send_on_port( NO_MSG, PORT0, elem ); 3.20 return NULL; 3.21 } 3.22 3.23 HWSimTimeSpan 3.24 -pingPongElem_PingActivity_timing( void * dataFromBehaviorFn ) 3.25 +pingPongElem_PingActivity_timing( HWSimElem *elem ) 3.26 { 3.27 return 10; 3.28 }