# HG changeset patch # User hausers # Date 1328026229 -3600 # Node ID 4862640793b6bfa0bf0d93da3583ccef7a380816 # Parent a587ea56af8e653fb0c9ef73b9b352446a2593f8 small changes to the netlist creation diff -r a587ea56af8e -r 4862640793b6 CircuitNetlistCreator.c --- a/CircuitNetlistCreator.c Sat Jan 07 17:45:10 2012 -0800 +++ b/CircuitNetlistCreator.c Tue Jan 31 17:10:29 2012 +0100 @@ -11,13 +11,18 @@ */ #define setWireValuesTo( wire, fromTLIdx, outPort, toTLIdx, inPort, dataPtr)\ do{\ - wire.idxOfFromTimeline = fromTLIdx; \ - wire.idxOfFromOutPort = fromTLIdx; \ - wire.idxOfToTimeline = toTLIdx; \ - wire.idxOfToInPort = inPort; \ - wire.archSpecWireData = dataPtr; \ + wire->idxOfFromTimeline = fromTLIdx; \ + wire->idxOfFromOutPort = fromTLIdx; \ + wire->idxOfToTimeline = toTLIdx; \ + wire->idxOfToInPort = inPort; \ + wire->archSpecCommPathData = dataPtr; \ }while(0); //macro magic for namespace - + + +HWSimSpanType* createPingPongSpanType (); + +HWSimTimeline* createAPingPongTimeline (HWSimNetlist *netlist); + /*This file constructs the netlist for the Hello World circuit, which is * used during design and implementation of the HWSim language * @@ -37,10 +42,11 @@ */ HWSimNetlist *createPingPongNetlist() { HWSimNetlist *netlist; - NetlistWire *wires; + HWSimCommPath **wires; HWSimTimeline **timelines; - int numTimelines; - int numWires; + int32 numTimelines; + int32 numWires; + HWSimSpanType *foo; netlist = malloc( sizeof(HWSimNetlist) ); //declare timelines numTimelines = 2; @@ -54,7 +60,7 @@ timelines[1] = createAPingPongTimeline( netlist ); //on one of the timelines, make reset trigger an action timelines[1]->inPorts[-1].triggeredSpanType = - netlist->spanTypes PING_PONG_TYPE]; //Connect timelines together + netlist->spanTypes[PING_PONG_TYPE]; //Connect timelines together /*OutPorts and InPorts may have many wires attached, but an inPort only * has one kind of span that all incoming communications trigger. That @@ -65,9 +71,9 @@ *The format is: sending TL-index, out-port, dest TL-index, in-port */ numWires = 2; - wires = malloc( numWires * sizeof(NetlistWire) ); - netlist->numWires = numWires; - netlist->wires = wires; + wires = malloc( numWires * sizeof(HWSimCommPath) ); + netlist->numCommPaths= numWires; + netlist->commPaths= wires; //TL 0, out-port 0 to TL 1, in-port 0 setWireValuesTo(wires[0], 0,0,1,0, NULL); //These NetlistWires turned into setWireValuesTo(wires[1], 1,0,0,0, NULL); // HWSimWires inside ckt create @@ -83,6 +89,7 @@ TL = malloc( sizeof(HWSimTimeline) ); TL->numInPorts = 1; TL->numOutPorts = 1; + //Sean: here we create only inPorts -> outPorts will be created be HWSim ? TL->inPorts = HWSim_ext__make_inPortsArray( TL->numInPorts ); TL->inPorts[-1].triggeredSpanType = IDLE_SPAN; //reset port TL->inPorts[0].triggeredSpanType = netlist->spanTypes[PING_PONG_TYPE]; @@ -96,4 +103,4 @@ pingPongSpanType->timingFn = &timingOf_ping_pong_span; return pingPongSpanType; } - \ No newline at end of file + diff -r a587ea56af8e -r 4862640793b6 HWSim__Hello_World_HW/HWSim__Hello_World_HW.h --- a/HWSim__Hello_World_HW/HWSim__Hello_World_HW.h Sat Jan 07 17:45:10 2012 -0800 +++ b/HWSim__Hello_World_HW/HWSim__Hello_World_HW.h Tue Jan 31 17:10:29 2012 +0100 @@ -9,13 +9,16 @@ #include -#include "../../HWSim_lib/HWSim.h" +#include "../../HWSim_lib/HWSim_lib.h" //=============================== Defines ============================== //Port 0 is unused, as a bug-catch #define COMMUNICATOR_OUTPORT 1 +//Different spanTypes +#define PING_PONG_TYPE 0 + //============================== Structures ============================== typedef struct diff -r a587ea56af8e -r 4862640793b6 HWSim__Hello_World_HW/PingPong_TimeLine.c --- a/HWSim__Hello_World_HW/PingPong_TimeLine.c Sat Jan 07 17:45:10 2012 -0800 +++ b/HWSim__Hello_World_HW/PingPong_TimeLine.c Tue Jan 31 17:10:29 2012 +0100 @@ -33,10 +33,10 @@ params = (PingPongParams *)_params; // DEBUG( dbgHW, "ping pong span\n", clone_PingPongParams(params) ); - //HWSim__send_on_port( NO_MSG, PORT0, timeline ); +// HWSim__send_on_port( NO_MSG, PORT0, timeline ); } -uint64 +HWSimTimePeriod timingOf_ping_pong_span( void * dataFromBehaviorFn ) { return 10;