Mercurial > cgi-bin > hgwebdir.cgi > PR > Applications > HWSim > HWSim__LPGPU_Arch__HWDef
changeset 3:03de56d9aad5
Netlist for New GPU Arch
| author | sohan |
|---|---|
| date | Wed, 07 Mar 2012 17:25:19 +0100 |
| parents | f068965d9269 |
| children | ddfcbc21b5c2 |
| files | HWSim__LPGPU_Arch__HWDef/GpuArchitectureNetlistreator.c |
| diffstat | 1 files changed, 114 insertions(+), 0 deletions(-) [+] |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/HWSim__LPGPU_Arch__HWDef/GpuArchitectureNetlistreator.c Wed Mar 07 17:25:19 2012 +0100 1.3 @@ -0,0 +1,114 @@ 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 +#include "HWSim__LPGPU_Arch__HWDef/HWSim__LPGPU_Arch__HWDef.h" 1.12 + 1.13 +/*'' is an expr resolves to an actual commPath struct instance 1.14 + */ 1.15 +#define setCommPathValuesTo( commPath, fromElIdx, outPort, toElIdx, inPort,\ 1.16 + commTimeFnPtr, dataPtr)\ 1.17 +do{\ 1.18 + commPath->idxOfFromElem = fromElIdx; \ 1.19 + commPath->idxOfFromOutPort = fromElIdx; \ 1.20 + commPath->idxOfToElem = toElIdx; \ 1.21 + commPath->idxOfToInPort = inPort; \ 1.22 + commPath->commTimeFnPtr = commTimeFnPtr;\ 1.23 + commPath->archSpecCommPathData = dataPtr; \ 1.24 + }while(0); //macro magic for namespace 1.25 + 1.26 + 1.27 +/*This file constructs the netlist for the New GPU Architecture. 1.28 + * 1.29 + * It has two elements, each with one input port and one output port, and 1.30 + * a single activity-type. 1.31 + * 1.32 + *The elements are cross-coupled, so output port of one connects to input 1.33 + * port of the other. The input port has a single trigger, which fires 1.34 + * the one activity-type. 1.35 + * 1.36 + *The activity does nothing, except send a NULL message on the output port. 1.37 + *The activity-sim-time and communication-sim-time are both constants. 1.38 + * 1.39 + *Note that elements are generic. They are specialized by declaring 1.40 + * inports and outports, and by registering triggers that fire particular 1.41 + * activity-types. 1.42 + */ 1.43 +HWSimNetlist *createGpuArchitectureNetlist() 1.44 + { HWSimNetlist *netlist; 1.45 + HWSimCommPath **commPaths; 1.46 + HWSimElem **elems; 1.47 + int32 numElems; 1.48 + int32 numCommPaths; 1.49 + HWSimActivityType *foo; 1.50 + 1.51 + netlist = malloc( sizeof(HWSimNetlist) ); 1.52 + // numElems will change as we add more Elements 1.53 + numElems = 1; 1.54 + elems = malloc( numElems * sizeof(HWSimElem) ); 1.55 + netlist->numElems = numElems; 1.56 + netlist->elems = elems; 1.57 + //numActivityTypes will change as we add more Elements 1.58 + netlist->numActivityTypes = 3; 1.59 + netlist->activityTypes = malloc(netlist->numActivityTypes*sizeof(HWSimActivityType*)); 1.60 + netlist->activityTypes[CONTEXT_SCHEDULER_TYPE] = createContextSchedulerActivityType(); 1.61 + netlist->activityTypes[FSM_STATE_UPDATE_TYPE] = createFsmUpdateActivityType(); 1.62 + netlist->activityTypes[INSTRUCTION_FETCH_TYPE] = createInstructionFetchActivityType(); 1.63 + elems[0] = createContextUnitElem( netlist ); //use info from netlist 1.64 + 1.65 + //on one of the elems, make reset trigger an action 1.66 + elems[1]->inPorts[-1].triggeredActivityType = 1.67 + netlist->activityTypes[PING_PONG_TYPE]; //Connect elems together 1.68 + 1.69 + /*OutPorts and InPorts may have many commPaths attached. 1.70 + * but an inPort only 1.71 + * has one kind of activity that all incoming communications trigger. That 1.72 + * activity can be zero time and then switch on the type of message then 1.73 + * end with a continuation, where the continuation activity is chosen by the 1.74 + * switch. 1.75 + *So, a commPath only connects an out port to an in port 1.76 + *The format is: sending TL-index, out-port, dest TL-index, in-port 1.77 + */ 1.78 + numCommPaths = 2; 1.79 + commPaths = malloc( numCommPaths * sizeof(HWSimCommPath) ); 1.80 + netlist->numCommPaths= numCommPaths; 1.81 + netlist->commPaths= commPaths; 1.82 + //TL 0, out-port 0 to TL 1, in-port 0 1.83 + setCommPathValuesTo(commPaths[0], 0,0,1,0, &commPath_TimeSpanCalc, NULL); 1.84 + //TL 1, out-port 0 to TL 0, in-port 0 1.85 + setCommPathValuesTo(commPaths[1], 1,0,0,0, &commPath_TimeSpanCalc, NULL); 1.86 + 1.87 + //TODO: decide how do in-out bidirectional commPaths -- thinking make it two 1.88 + // separate commPaths with guard between in-port and out-port 1.89 + } 1.90 + 1.91 + //Stefan: copy netlist struct with VMS malloc after VMS initialized? 1.92 +HWSimElem * 1.93 +createContextUnitElem( HWSimNetlist *netlist ) 1.94 + { HWSimElem *CU; 1.95 + CU = malloc( sizeof(HWSimElem) ); 1.96 + //Sean: how do we define this state 1.97 + CU->state=malloc(numContextUnit*sizeof(contextUnit)); 1.98 + //numInPorts may change with change in Design 1.99 + CU->numInPorts = 8; 1.100 + CU->numOutPorts = 2; 1.101 + CU->inPorts = HWSim_ext__make_inPortsArray( CU->numInPorts ); 1.102 + CU->inPorts[-1].triggeredActivityType = IDLE_SPAN; //reset port 1.103 + CU->inPorts[0].triggeredActivityType = netlist->activityTypes[CONTEXT_SCHEDULER_TYPE]; 1.104 + CU->inPorts[1].triggeredActivityType = netlist->activityTypes[FSM_STATE_UPDATE_TYPE]; 1.105 + CU->inPorts[2].triggeredActivityType = netlist->activityTypes[INSTRUCTION_FETCH_TYPE]; 1.106 + } 1.107 + 1.108 +HWSimActivityType * 1.109 +createContextSchedulerActivityType() 1.110 + { HWSimActivityType *contextSchedulerActivityType; 1.111 + contextSchedulerActivityType = malloc( sizeof(HWSimActivityType) ); 1.112 + contextSchedulerActivityType->behaviorFn = &contextUnitElem_SchedulerActivity_behavior; 1.113 + contextSchedulerActivityType->timingFn = &contextUnitElem_SchedulerActivity_timing; 1.114 + return contextSchedulerActivityType; 1.115 + } 1.116 + 1.117 +
