changeset 12:4862640793b6

small changes to the netlist creation
author hausers
date Tue, 31 Jan 2012 17:10:29 +0100
parents a587ea56af8e
children abe3db0025d5
files CircuitNetlistCreator.c HWSim__Hello_World_HW/HWSim__Hello_World_HW.h HWSim__Hello_World_HW/PingPong_TimeLine.c
diffstat 3 files changed, 27 insertions(+), 17 deletions(-) [+]
line diff
     1.1 --- a/CircuitNetlistCreator.c	Sat Jan 07 17:45:10 2012 -0800
     1.2 +++ b/CircuitNetlistCreator.c	Tue Jan 31 17:10:29 2012 +0100
     1.3 @@ -11,13 +11,18 @@
     1.4   */
     1.5  #define setWireValuesTo( wire, fromTLIdx, outPort, toTLIdx, inPort, dataPtr)\
     1.6  do{\
     1.7 -   wire.idxOfFromTimeline = fromTLIdx; \
     1.8 -   wire.idxOfFromOutPort  = fromTLIdx; \
     1.9 -   wire.idxOfToTimeline   = toTLIdx; \
    1.10 -   wire.idxOfToInPort     = inPort; \
    1.11 -   wire.archSpecWireData  = dataPtr; \
    1.12 +   wire->idxOfFromTimeline = fromTLIdx; \
    1.13 +   wire->idxOfFromOutPort  = fromTLIdx; \
    1.14 +   wire->idxOfToTimeline   = toTLIdx; \
    1.15 +   wire->idxOfToInPort     = inPort; \
    1.16 +   wire->archSpecCommPathData  = dataPtr; \
    1.17   }while(0); //macro magic for namespace
    1.18 - 
    1.19 +
    1.20 +
    1.21 +HWSimSpanType* createPingPongSpanType (); 
    1.22 +
    1.23 +HWSimTimeline* createAPingPongTimeline (HWSimNetlist *netlist);
    1.24 +
    1.25  /*This file constructs the netlist for the Hello World circuit, which is
    1.26   * used during design and implementation of the HWSim language
    1.27   *
    1.28 @@ -37,10 +42,11 @@
    1.29   */
    1.30  HWSimNetlist *createPingPongNetlist()
    1.31   { HWSimNetlist   *netlist;
    1.32 -   NetlistWire    *wires;
    1.33 +   HWSimCommPath  **wires;
    1.34     HWSimTimeline **timelines;
    1.35 -   int numTimelines;
    1.36 -   int numWires;
    1.37 +   int32 numTimelines;
    1.38 +   int32 numWires;
    1.39 +	HWSimSpanType *foo;
    1.40     
    1.41     netlist = malloc( sizeof(HWSimNetlist) );
    1.42     //declare timelines   numTimelines = 2;
    1.43 @@ -54,7 +60,7 @@
    1.44     timelines[1] = createAPingPongTimeline( netlist ); 
    1.45        //on one of the timelines, make reset trigger an action   
    1.46     timelines[1]->inPorts[-1].triggeredSpanType =
    1.47 -              netlist->spanTypes PING_PONG_TYPE]; //Connect timelines together
    1.48 +              netlist->spanTypes[PING_PONG_TYPE]; //Connect timelines together
    1.49  			  
    1.50  	/*OutPorts and InPorts may have many wires attached, but an inPort only     
    1.51  	 * has one kind of span that all incoming communications trigger.  That
    1.52 @@ -65,9 +71,9 @@
    1.53  	 *The format is: sending TL-index, out-port, dest TL-index, in-port
    1.54  	 */
    1.55     numWires          = 2;
    1.56 -   wires             = malloc( numWires * sizeof(NetlistWire) );
    1.57 -   netlist->numWires = numWires;
    1.58 -   netlist->wires    = wires;
    1.59 +   wires             = malloc( numWires * sizeof(HWSimCommPath) );
    1.60 +   netlist->numCommPaths= numWires;
    1.61 +   netlist->commPaths= wires;
    1.62     //TL 0, out-port 0 to TL 1, in-port 0
    1.63     setWireValuesTo(wires[0], 0,0,1,0, NULL); //These NetlistWires turned into
    1.64     setWireValuesTo(wires[1], 1,0,0,0, NULL); // HWSimWires inside ckt create
    1.65 @@ -83,6 +89,7 @@
    1.66     TL = malloc( sizeof(HWSimTimeline) );
    1.67     TL->numInPorts  = 1;
    1.68     TL->numOutPorts = 1;
    1.69 +	//Sean: here we create only inPorts -> outPorts will be created be HWSim ?
    1.70     TL->inPorts = HWSim_ext__make_inPortsArray( TL->numInPorts );
    1.71     TL->inPorts[-1].triggeredSpanType = IDLE_SPAN; //reset port
    1.72     TL->inPorts[0].triggeredSpanType  = netlist->spanTypes[PING_PONG_TYPE];
    1.73 @@ -96,4 +103,4 @@
    1.74     pingPongSpanType->timingFn   = &timingOf_ping_pong_span;
    1.75     return pingPongSpanType;
    1.76   } 
    1.77 - 
    1.78 \ No newline at end of file
    1.79 + 
     2.1 --- a/HWSim__Hello_World_HW/HWSim__Hello_World_HW.h	Sat Jan 07 17:45:10 2012 -0800
     2.2 +++ b/HWSim__Hello_World_HW/HWSim__Hello_World_HW.h	Tue Jan 31 17:10:29 2012 +0100
     2.3 @@ -9,13 +9,16 @@
     2.4  
     2.5  #include <stdio.h>
     2.6  
     2.7 -#include "../../HWSim_lib/HWSim.h"
     2.8 +#include "../../HWSim_lib/HWSim_lib.h"
     2.9  
    2.10  
    2.11  //===============================  Defines  ==============================
    2.12     //Port 0 is unused, as a bug-catch
    2.13  #define COMMUNICATOR_OUTPORT  1
    2.14  
    2.15 +//Different spanTypes
    2.16 +#define PING_PONG_TYPE 0
    2.17 +
    2.18  
    2.19  //==============================  Structures  ==============================
    2.20  typedef struct
     3.1 --- a/HWSim__Hello_World_HW/PingPong_TimeLine.c	Sat Jan 07 17:45:10 2012 -0800
     3.2 +++ b/HWSim__Hello_World_HW/PingPong_TimeLine.c	Tue Jan 31 17:10:29 2012 +0100
     3.3 @@ -33,10 +33,10 @@
     3.4     params    = (PingPongParams *)_params;
     3.5  //         DEBUG( dbgHW, "ping pong span\n", clone_PingPongParams(params) );
     3.6     
     3.7 -   //HWSim__send_on_port( NO_MSG, PORT0, timeline );
     3.8 +//   HWSim__send_on_port( NO_MSG, PORT0, timeline );
     3.9   }
    3.10  
    3.11 -uint64
    3.12 +HWSimTimePeriod
    3.13  timingOf_ping_pong_span( void * dataFromBehaviorFn )
    3.14   {
    3.15     return 10;