# HG changeset patch # User Me@portablequad # Date 1322671230 28800 # Node ID d872169e58fa2858cdb5a637c6476f91ad1257bf # Parent 7566745e812a43866e1814863aa2b437409a3a4b Minor changes -- mostly renaming structs and vars diff -r 7566745e812a -r d872169e58fa src/Application/CircuitNetlistCreator.c --- a/src/Application/CircuitNetlistCreator.c Sat Nov 19 17:58:21 2011 -0800 +++ b/src/Application/CircuitNetlistCreator.c Wed Nov 30 08:40:30 2011 -0800 @@ -1,1 +1,1 @@ -/* * Copyright 2011 OpenSourceStewardshipFoundation.org * Licensed under GNU General Public License version 2 * * Author: seanhalle@yahoo.com * */ #include "HWSim__Hello_World_HW/HWSim__Hello_World_HW.h" /*This file constructs the netlist for the Hello World circuit, which is * used during design and implementation of the HWSim language * *It has two timelines, each with one input port and one output port, and * a single span-type. * *The timelines are cross-coupled, so output port of one connects to input * port of the other. The input port has a single trigger, which fires * the one span-type. * *The span does nothing, except send a NULL message on the output port. * *The span-sim-time and communication-sim-time are both constants. * *Note that timelines are generic. They are specialized by declaring * inports and outports, and by registering triggers that fire particular * span-types. */ HWSimNetlist * createPingPongNetlist() { HWSimNetlist *netlist; HWSimWire **wires; TimeLine **timelines; int numTimelines; int numWires; netlist = malloc( sizeof(HWSimNetlist) ); //declare timelines numTimelines = 2; timelines = malloc( numTimelines * sizeof(TimeLine) ); netlist->numTimelines = numTimelines; netlist->timelines = timelines; timelines[0] = createAPingPongTimeline(); timelines[1] = createAPingPongTimeline(); //add a trigger to reset port of one of the timelines, to start things HWSimSpanType *pingPongSpan; pingPongSpan = malloc( sizeof(HWSimSpanType) ); pingPongSpan->behaviorFn = &behaviorOf_ping_pong_span; pingPongSpan->timingFn = &timingOf_ping_pong_span; timelines[1]->triggers[0]->inPortNum = -1//the reset port timelines[1]->triggers[0]->spanType = pingPongSpan; //Connect timelines together numWires = 2; wires = malloc( numWires * sizeof(HWSimWire) ); netlist->numWires = numWires; netlist->wires = wires; wires[0] = {0,0,1,0,0}; //tl 0, out-port 0 to tl 1, in-port 0, msg-type 0 wires[1] = {1,0,0,0,0}; /* For starters, not doing time-domains.. will add later (Nov 2011) //Create time domains numTimeDomains = 2; timeDomains = malloc( numTimeDomains * sizeof(TimeDomain) ); netlist->numTimeDomains = numTimeDomains; netlist->timeDomains = timeDomains; timeDomains[0]->numDomains = 0; timeDomains[0]->numTimelines = 1; timeDomains[0]->timelines[0] = 0;//is index into netlist->timelines[] timeDomains[1]->numDomains = 0; timeDomains[1]->numTimelines = 1; timeDomains[1]->timelines[0] = 1;//index into netlist->timelines[] //Create time domain connections -- must respect hierarchy numDomainConnections = 2; domainConnects = malloc( numDomainConnections * sizeof(HWSimDomainConn) ); netlist->numDomainConns = numDomainConnections; netlist->domainConns = domainConnects; domainConnects[0] = {0,1}; //domain 0 sends sim-time updates to domain 1 domainConnects[1] = {1,0}; //domain 1 sends sim-time updates to domain 0 */ } TimeLine * createAPingPongTimeline() { TimeLine *tl; HWSimTrigger **triggers; tl = malloc( sizeof(TimeLine) ); tl->numInPorts = 1; tl->numOutPorts = 1; tl->numTriggers = 2; triggers = malloc( 2 * sizeof(HWSimTrigger) ); //extra is reset trig tl->triggers[0].inPortNum = -1; //reset trigger tl->triggers[0].spanType = IDLE_SPAN; HWSimSpanType *pingPongSpan; pingPongSpan = malloc( sizeof(HWSimSpanType) ); pingPongSpan->behaviorFn = &behaviorOf_ping_pong_span; pingPongSpan->timingFn = &timingOf_ping_pong_span; tl->triggers[1].inPortNum = 0; //TODO: Debug: verify whether . or -> tl->triggers[1].spanType = pingPongSpan; } \ No newline at end of file +/* * Copyright 2011 OpenSourceStewardshipFoundation.org * Licensed under GNU General Public License version 2 * * Author: seanhalle@yahoo.com * */ #include "HWSim__Hello_World_HW/HWSim__Hello_World_HW.h" /*This file constructs the netlist for the Hello World circuit, which is * used during design and implementation of the HWSim language * *It has two timelines, each with one input port and one output port, and * a single span-type. * *The timelines are cross-coupled, so output port of one connects to input * port of the other. The input port has a single trigger, which fires * the one span-type. * *The span does nothing, except send a NULL message on the output port. * *The span-sim-time and communication-sim-time are both constants. * *Note that timelines are generic. They are specialized by declaring * inports and outports, and by registering triggers that fire particular * span-types. */ HWSimNetlist * createPingPongNetlist() { HWSimNetlist *netlist; HWSimWire **wires; HWSimTimeline **timelines; int numTimelines; int numWires; netlist = malloc( sizeof(HWSimNetlist) ); //declare timelines numTimelines = 2; timelines = malloc( numTimelines * sizeof(HWSimTimeline) ); netlist->numTimelines = numTimelines; netlist->timelines = timelines; timelines[0] = createAPingPongTimeline(); timelines[1] = createAPingPongTimeline(); //add a trigger to reset port of one of the timelines, to start things HWSimSpanType *pingPongSpan; pingPongSpan = malloc( sizeof(HWSimSpanType) ); pingPongSpan->behaviorFn = &behaviorOf_ping_pong_span; pingPongSpan->timingFn = &timingOf_ping_pong_span; timelines[1]->triggers[0]->inPortNum = -1//the reset port timelines[1]->triggers[0]->spanType = pingPongSpan; //Connect timelines together numWires = 2; wires = malloc( numWires * sizeof(HWSimWire) ); netlist->numWires = numWires; netlist->wires = wires; //TODO:For wires, have many design decisions to make -- driven by impl, so // have to be delayed until get into guts of impl. //TODO: maybe make HWSimWire a union with a 5 (or 6) elem array //TODO: decide if each wire transports only one kind of message or many //TODO: decide if inports accept one wire or many (msg type set by inport) //tl 0, out-port 0 to tl 1, in-port 0, msg-type 0 wires[0] = {0,0,1,0,0}; wires[1] = {1,0,0,0,0}; /* For starters, not doing time-domains.. will add later (Nov 2011) //Create time domains numTimeDomains = 2; timeDomains = malloc( numTimeDomains * sizeof(TimeDomain) ); netlist->numTimeDomains = numTimeDomains; netlist->timeDomains = timeDomains; timeDomains[0]->numDomains = 0; timeDomains[0]->numTimelines = 1; timeDomains[0]->timelines[0] = 0;//is index into netlist->timelines[] timeDomains[1]->numDomains = 0; timeDomains[1]->numTimelines = 1; timeDomains[1]->timelines[0] = 1;//index into netlist->timelines[] //Create time domain connections -- must respect hierarchy numDomainConnections = 2; domainConnects = malloc( numDomainConnections * sizeof(HWSimDomainConn) ); netlist->numDomainConns = numDomainConnections; netlist->domainConns = domainConnects; domainConnects[0] = {0,1}; //domain 0 sends sim-time updates to domain 1 domainConnects[1] = {1,0}; //domain 1 sends sim-time updates to domain 0 */ } HWSimTimeline * createAPingPongTimeline() { HWSimTimeline *tl; HWSimTrigger **triggers; tl = malloc( sizeof(HWSimTimeline) ); tl->numInPorts = 1; tl->numOutPorts = 1; tl->numTriggers = 2; triggers = malloc( 2 * sizeof(HWSimTrigger) ); //extra is reset trig tl->triggers[0].inPortNum = -1; //reset trigger tl->triggers[0].spanType = IDLE_SPAN; HWSimSpanType *pingPongSpan; pingPongSpan = malloc( sizeof(HWSimSpanType) ); pingPongSpan->behaviorFn = &behaviorOf_ping_pong_span; pingPongSpan->timingFn = &timingOf_ping_pong_span; tl->triggers[1].inPortNum = 0; //TODO: Debug: verify whether . or -> tl->triggers[1].spanType = pingPongSpan; } \ No newline at end of file diff -r 7566745e812a -r d872169e58fa src/Application/HWSim__Hello_World_HW/PingPong_TimeLine.c --- a/src/Application/HWSim__Hello_World_HW/PingPong_TimeLine.c Sat Nov 19 17:58:21 2011 -0800 +++ b/src/Application/HWSim__Hello_World_HW/PingPong_TimeLine.c Wed Nov 30 08:40:30 2011 -0800 @@ -1,1 +1,1 @@ -/* * Copyright 2011 OpenSourceStewardshipFoundation.org * Licensed under GNU General Public License version 2 * * Author: seanhalle@yahoo.com * */ #include "HWSim__Hello_World_HW.h" //==================================================================== /*This is the ping-pong timeline for the Hello World hardware * *It has only one kind of span, which only puts a communication on * the timeline's one out-port. * *The in-port has only one trigger registered on it, which fires that * span. */ #define NO_MSG NULL #define PORT0 0 /* *Note, the returned value is passed to the timing function */ void * behaviorOf_ping_pong_span( void *_params, TimeLine *timeline ) { PingPongParams *params; params = (PingPongParams *)_params; DEBUG( dbgHW, "ping pong span\n", clone_PingPongParams(params) ); HWSim__send_on_port( NO_MSG, PORT0, timeline ); } uint64 timingOf_ping_pong_span( void * dataFromBehaviorFn ) { return 10; } \ No newline at end of file +/* * Copyright 2011 OpenSourceStewardshipFoundation.org * Licensed under GNU General Public License version 2 * * Author: seanhalle@yahoo.com * */ #include "HWSim__Hello_World_HW.h" //==================================================================== /*This is the ping-pong timeline for the Hello World hardware * *It has only one kind of span, which only puts a communication on * the timeline's one out-port. * *The in-port has only one trigger registered on it, which fires that * span. */ #define NO_MSG NULL #define PORT0 0 /* *Note, the returned value is passed to the timing function */ void * behaviorOf_ping_pong_span( void *_params, HWSimTimeline *timeline ) { PingPongParams *params; params = (PingPongParams *)_params; DEBUG( dbgHW, "ping pong span\n", clone_PingPongParams(params) ); HWSim__send_on_port( NO_MSG, PORT0, timeline ); } uint64 timingOf_ping_pong_span( void * dataFromBehaviorFn ) { return 10; } \ No newline at end of file diff -r 7566745e812a -r d872169e58fa src/Application/main.c --- a/src/Application/main.c Sat Nov 19 17:58:21 2011 -0800 +++ b/src/Application/main.c Wed Nov 30 08:40:30 2011 -0800 @@ -19,6 +19,7 @@ int main( int argc, char **argv ) { ParamBag *simParams; HWSimResults *simResults; + HWSimNetlist *netlist; printf( "param file name: %s\n", argv[1] );