changeset 6:e6ee13464969

small syntax fixups
author Me@portablequad
date Wed, 21 Dec 2011 07:19:51 -0800
parents 0ef08e9afd54
children 55d3ca21bccd
files src/Application/CircuitNetlistCreator.c
diffstat 1 files changed, 1 insertions(+), 1 deletions(-) [+]
line diff
     1.1 --- a/src/Application/CircuitNetlistCreator.c	Wed Nov 30 11:10:38 2011 -0800
     1.2 +++ b/src/Application/CircuitNetlistCreator.c	Wed Dec 21 07:19:51 2011 -0800
     1.3 @@ -1,1 +1,1 @@
     1.4 -/*
     1.5  *  Copyright 2011 OpenSourceStewardshipFoundation.org
     1.6  *  Licensed under GNU General Public License version 2
     1.7  *
     1.8  * Author: seanhalle@yahoo.com
     1.9  *
    1.10  */
    1.11 
    1.12 #include "HWSim__Hello_World_HW/HWSim__Hello_World_HW.h"
    1.13 
    1.14 
    1.15 /*This file constructs the netlist for the Hello World circuit, which is
    1.16  * used during design and implementation of the HWSim language
    1.17  * 
    1.18  *It has two timelines, each with one input port and one output port, and
    1.19  * a single span-type.
    1.20  *
    1.21  *The timelines are cross-coupled, so output port of one connects to input
    1.22  * port of the other.  The input port has a single trigger, which fires
    1.23  * the one span-type.
    1.24  * 
    1.25  *The span does nothing, except send a NULL message on the output port.
    1.26  * 
    1.27  *The span-sim-time and communication-sim-time are both constants.
    1.28  *
    1.29  *Note that timelines are generic.  They are specialized by declaring
    1.30  * inports and outports, and by registering triggers that fire particular
    1.31  * span-types.
    1.32  */
    1.33 HWSimNetlist *
    1.34 createPingPongNetlist()
    1.35  { HWSimNetlist *netlist;
    1.36    HWSimWire   **wires;
    1.37    HWSimTimeline    **timelines;
    1.38    
    1.39    int numTimelines;
    1.40    int numWires;
    1.41  
    1.42    netlist = malloc( sizeof(HWSimNetlist) );
    1.43    
    1.44       //declare timelines
    1.45    numTimelines = 2;
    1.46    timelines = malloc( numTimelines * sizeof(HWSimTimeline) );
    1.47    netlist->numTimelines = numTimelines;
    1.48    netlist->timelines    = timelines;
    1.49    
    1.50    timelines[0] = createAPingPongTimeline();
    1.51    timelines[1] = createAPingPongTimeline();
    1.52    
    1.53       //add a trigger to reset port of one of the timelines, to start things
    1.54    HWSimSpanType *pingPongSpan;
    1.55    pingPongSpan = malloc( sizeof(HWSimSpanType) );
    1.56    pingPongSpan->behaviorFn = &behaviorOf_ping_pong_span;
    1.57    pingPongSpan->timingFn   = &timingOf_ping_pong_span;
    1.58    
    1.59    timelines[1]->triggers[0]->inPortNum = -1//the reset port
    1.60    timelines[1]->triggers[0]->spanType = pingPongSpan;
    1.61    
    1.62       //Connect timelines together
    1.63    numWires = 2;
    1.64    wires = malloc( numWires * sizeof(HWSimWire) );
    1.65    netlist->numWires = numWires;
    1.66    netlist->wires    = wires;
    1.67    
    1.68    //TODO:For wires, have many design decisions to make -- driven by impl, so
    1.69    // have to be delayed until get into guts of impl.
    1.70    //TODO: maybe make HWSimWire a union with a 5 (or 6) elem array
    1.71    //TODO: decide if each wire transports only one kind of message or many
    1.72    //TODO: decide if inports accept one wire or many (msg type set by inport)
    1.73    //tl 0, out-port 0 to tl 1, in-port 0, msg-type 0
    1.74    wires[0] = {0,0,1,0,0}; 
    1.75    wires[1] = {1,0,0,0,0};
    1.76 
    1.77 /* For starters, not doing time-domains..  will add later (Nov 2011)
    1.78       //Create time domains
    1.79    numTimeDomains = 2;
    1.80    timeDomains    = malloc( numTimeDomains * sizeof(TimeDomain) );
    1.81    netlist->numTimeDomains = numTimeDomains;
    1.82    netlist->timeDomains    = timeDomains;
    1.83    
    1.84    timeDomains[0]->numDomains   = 0;
    1.85    timeDomains[0]->numTimelines = 1;
    1.86    timeDomains[0]->timelines[0] = 0;//is index into netlist->timelines[]
    1.87    
    1.88    timeDomains[1]->numDomains   = 0;
    1.89    timeDomains[1]->numTimelines = 1;
    1.90    timeDomains[1]->timelines[0] = 1;//index into netlist->timelines[]
    1.91    
    1.92       //Create time domain connections -- must respect hierarchy
    1.93    numDomainConnections = 2;
    1.94    domainConnects = malloc( numDomainConnections * sizeof(HWSimDomainConn) );
    1.95    netlist->numDomainConns = numDomainConnections;
    1.96    netlist->domainConns    = domainConnects;
    1.97    
    1.98    domainConnects[0] = {0,1}; //domain 0 sends sim-time updates to domain 1
    1.99    domainConnects[1] = {1,0}; //domain 1 sends sim-time updates to domain 0
   1.100  */
   1.101  }
   1.102 
   1.103 HWSimTimeline *
   1.104 createAPingPongTimeline()
   1.105  { HWSimTimeline *tl;
   1.106    HWSimTrigger **triggers;
   1.107    
   1.108    tl = malloc( sizeof(HWSimTimeline) );
   1.109     
   1.110    tl->numInPorts  = 1;
   1.111    tl->numOutPorts = 1;
   1.112    tl->numTriggers = 2;
   1.113    
   1.114    triggers = malloc( 2 * sizeof(HWSimTrigger) ); //extra is reset trig
   1.115    tl->triggers[0].inPortNum = -1; //reset trigger
   1.116    tl->triggers[0].spanType = IDLE_SPAN;
   1.117    
   1.118    HWSimSpanType *pingPongSpan;
   1.119    pingPongSpan = malloc( sizeof(HWSimSpanType) );
   1.120    pingPongSpan->behaviorFn = &behaviorOf_ping_pong_span;
   1.121    pingPongSpan->timingFn   = &timingOf_ping_pong_span;
   1.122    
   1.123    tl->triggers[1].inPortNum = 0; //TODO: Debug: verify whether . or ->
   1.124    tl->triggers[1].spanType = pingPongSpan;
   1.125  }
   1.126 \ No newline at end of file
   1.127 +/*
   1.128  *  Copyright 2011 OpenSourceStewardshipFoundation.org
   1.129  *  Licensed under GNU General Public License version 2
   1.130  *
   1.131  * Author: seanhalle@yahoo.com
   1.132  *
   1.133  */
   1.134 
   1.135 #include "HWSim__Hello_World_HW/HWSim__Hello_World_HW.h"
   1.136 
   1.137 
   1.138 /*This file constructs the netlist for the Hello World circuit, which is
   1.139  * used during design and implementation of the HWSim language
   1.140  * 
   1.141  *It has two timelines, each with one input port and one output port, and
   1.142  * a single span-type.
   1.143  *
   1.144  *The timelines are cross-coupled, so output port of one connects to input
   1.145  * port of the other.  The input port has a single trigger, which fires
   1.146  * the one span-type.
   1.147  * 
   1.148  *The span does nothing, except send a NULL message on the output port.
   1.149  * 
   1.150  *The span-sim-time and communication-sim-time are both constants.
   1.151  *
   1.152  *Note that timelines are generic.  They are specialized by declaring
   1.153  * inports and outports, and by registering triggers that fire particular
   1.154  * span-types.
   1.155  */
   1.156 HWSimNetlist *
   1.157 createPingPongNetlist()
   1.158  { HWSimNetlist *netlist;
   1.159    HWSimWire   **wires;
   1.160    HWSimTimeline    **timelines;
   1.161    
   1.162    int numTimelines;
   1.163    int numWires;
   1.164  
   1.165    netlist = malloc( sizeof(HWSimNetlist) );
   1.166    
   1.167       //declare timelines
   1.168    numTimelines = 2;
   1.169    timelines = malloc( numTimelines * sizeof(HWSimTimeline) );
   1.170    netlist->numTimelines = numTimelines;
   1.171    netlist->timelines    = timelines;
   1.172    
   1.173    timelines[0] = createAPingPongTimeline();
   1.174    timelines[1] = createAPingPongTimeline();
   1.175    
   1.176       //add a trigger to reset port of one of the timelines, to start things
   1.177    HWSimSpanType *pingPongSpanType;
   1.178    pingPongSpanType = malloc( sizeof(HWSimSpanType) );
   1.179    pingPongSpanType->behaviorFn = &behaviorOf_ping_pong_span;
   1.180    pingPongSpanType->timingFn   = &timingOf_ping_pong_span;
   1.181    
   1.182    timelines[1]->triggers[0]->inPortNum = -1//the reset port
   1.183    timelines[1]->triggers[0]->spanType = pingPongSpanType;
   1.184    
   1.185       //Connect timelines together
   1.186    numWires = 2;
   1.187    wires = malloc( numWires * sizeof(HWSimWire) );
   1.188    netlist->numWires = numWires;
   1.189    netlist->wires    = wires;
   1.190    
   1.191    //TODO:For wires, have many design decisions to make -- driven by impl, so
   1.192    // have to be delayed until get into guts of impl.
   1.193    //TODO: maybe make HWSimWire a union with a 5 (or 6) elem array
   1.194    //TODO: decide if each wire transports only one kind of message or many
   1.195    //TODO: decide if inports accept one wire or many (msg type set by inport)
   1.196    //tl 0, out-port 0 to tl 1, in-port 0, msg-type 0
   1.197    wires[0] = {0,0,1,0,0}; 
   1.198    wires[1] = {1,0,0,0,0};
   1.199 
   1.200  }
   1.201 
   1.202 HWSimTimeline *
   1.203 createAPingPongTimeline()
   1.204  { HWSimTimeline *tl;
   1.205    HWSimTrigger **triggers;
   1.206    
   1.207    tl = malloc( sizeof(HWSimTimeline) );
   1.208     
   1.209    tl->numInPorts  = 1;
   1.210    tl->numOutPorts = 1;
   1.211    tl->numTriggers = 2;
   1.212    
   1.213    triggers = malloc( 2 * sizeof(HWSimTrigger) ); //extra is reset trig
   1.214    tl->triggers[0].inPortNum = -1; //reset trigger
   1.215    tl->triggers[0].spanType = IDLE_SPAN;
   1.216    
   1.217    HWSimSpanType *pingPongSpanType;
   1.218    pingPongSpanType = malloc( sizeof(HWSimSpanType) );
   1.219    pingPongSpanType->behaviorFn = &behaviorOf_ping_pong_span;
   1.220    pingPongSpanType->timingFn   = &timingOf_ping_pong_span;
   1.221    
   1.222    tl->triggers[1].inPortNum = 0; //TODO: Debug: verify whether . or ->
   1.223    tl->triggers[1].spanType = pingPongSpanType;
   1.224  }
   1.225 \ No newline at end of file