annotate main.c @ 27:fb4970a0c337

fix up comment in main.c
author kshalle
date Wed, 25 Feb 2015 15:40:06 -0800
parents 0deed3ee0b02
children
rev   line source
kshalle@26 1 /*
kshalle@26 2 * Copyright 2011 OpenSourceResearchInstitute.org
kshalle@26 3 * Licensed under BSD
kshalle@26 4 *
kshalle@26 5 * author seanhalle@yahoo.com
kshalle@26 6 */
kshalle@26 7
kshalle@26 8 #include <malloc.h>
kshalle@26 9 #include <stdlib.h>
kshalle@26 10
kshalle@26 11 #include "SimParams.h"
kshalle@26 12 #include "HWSim__PingPong__HWDef/HWSim__PingPong__HWDef.h"
kshalle@26 13 #include "ParamHelper/Param.h"
kshalle@26 14
kshalle@26 15 #include "HWSim_impl/HWSim_tests.h"
kshalle@26 16
kshalle@26 17
kshalle@26 18
kshalle@27 19 /*This Hello World sample code demonstrates the bare structure of an HWSim
kshalle@27 20 * based simulator.
kshalle@27 21 *The application code creates a netlist, which is populated with element
kshalle@27 22 * structures and activity structures.
kshalle@27 23 *The elements register activities, which represent triggered behaviors.
kshalle@27 24 * During a run, the arrival of a communication on the inport of an
kshalle@27 25 * element triggers the registered activity, which in turn calls the
kshalle@27 26 * activity's behavior function and its time-width calculation function.
kshalle@27 27 *The behavior function can access and modify the state of the element,
kshalle@27 28 * and it can send out communications on the elements outports.
kshalle@27 29 *When a communication is sent, a separate function is called to calculate
kshalle@27 30 * the time of flight of that communication.
kshalle@26 31 *
kshalle@27 32 *Commands of the HWSim langlet are invoked by calling a function. Such
kshalle@27 33 * functions have a name that begins with "HWSim__" for example,
kshalle@27 34 * "HWSim__run_simulation" is a command to tell HWSim to perform a
kshalle@27 35 * simulation run.
kshalle@27 36 *
kshalle@27 37 *Data structures that are defined by the HWSim langlet have names that
kshalle@27 38 * begin with "HWSim", for example "HWSimNetlist" is a data structure
kshalle@27 39 * defined by the HWSim langlet.
kshalle@26 40 */
kshalle@26 41
kshalle@26 42 int main(int argc, char **argv)
kshalle@26 43 {
kshalle@26 44 ParamBag *simParams;
kshalle@26 45 HWSimNetlist *netlist;
kshalle@26 46 HWSimResults *simResults;
kshalle@26 47 int result;
kshalle@26 48
kshalle@26 49 //Use a helper called ParamBag to read in paramters from file
kshalle@26 50 simParams = makeParamBag();
kshalle@26 51 readParamFileIntoBag( argv[1], simParams );
kshalle@26 52
kshalle@26 53 //Create the simulated objects and connect them to each other
kshalle@26 54 netlist = createPingPongNetlist(); //defined in CircuitNetlistCreator.c
kshalle@26 55
kshalle@26 56 simResults = HWSim__run_simulation( simParams, netlist );
kshalle@26 57
kshalle@26 58 exit(0); //cleans up
kshalle@26 59 }
kshalle@26 60