forked from custom-computing-ic/dfe-snippets
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
10,604 additions
and
4,815 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
76 changes: 76 additions & 0 deletions
76
...experimental-results/160wide-64bits-shiftreg-simplified-noalign/FetchSubTupleKernel.maxja
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
LUTs FFs BRAMs DSPs : FetchSubTupleKernel.maxj | ||
37304 826 4 0 : resources used by this file | ||
7.11% 0.08% 0.16% 0.00% : % of available | ||
77.61% 1.10% 0.69% 0.00% : % of total used | ||
98.39% 1.55% 100.00% 0.00% : % of user resources | ||
|
||
: /*** | ||
: Here we provide an example use case of irregular fetch buffer. | ||
: | ||
: Normally, each cycle we push tupleSize values to the buffer and fetch | ||
: only the number of entries specified by control stream 'sizes'. | ||
: | ||
: The buffer occasionally issues stall signal (nextPushEnable() == 0) | ||
: to avoid overflow of internal FIFOs. To complicate the example further, | ||
: we occasionally disable data pushes and pops. | ||
: | ||
: */ | ||
: | ||
: import com.maxeler.maxcompiler.v2.kernelcompiler.Kernel; | ||
: import com.maxeler.maxcompiler.v2.kernelcompiler.KernelParameters; | ||
: import com.maxeler.maxcompiler.v2.kernelcompiler.types.base.DFEVar; | ||
: import com.maxeler.maxcompiler.v2.kernelcompiler.types.base.DFEType; | ||
: import com.maxeler.maxcompiler.v2.kernelcompiler.types.composite.DFEVector; | ||
: import com.maxeler.maxcompiler.v2.kernelcompiler.types.composite.DFEVectorType; | ||
: | ||
: //import com.custom_computing_ic.dfe_snippets.utils.FetchSubTuple; | ||
: | ||
: class FetchSubTupleKernel extends Kernel | ||
: { | ||
: private static final DFEType floatType = dfeFloat(11,53); | ||
: private static final DFEType scalarType = dfeUInt(32); | ||
: | ||
: protected FetchSubTupleKernel(KernelParameters parameters, int tupleSize) | ||
: { | ||
: super(parameters); | ||
: | ||
: DFEVectorType<DFEVar> tupleType = | ||
: new DFEVectorType<DFEVar> (floatType, tupleSize); | ||
: | ||
70 105 0 0 : DFEVar cycleCounter = control.count.simpleCounter(32); | ||
3 1 0 0 : DFEVar prefetchEnable = cycleCounter < 1; | ||
5 4 0 0 : DFEVar pushEnable = ~prefetchEnable & ( (cycleCounter < 27) | (cycleCounter > 30) ); | ||
14 4 0 0 : DFEVar popEnable = ~prefetchEnable & ( (cycleCounter < 10) | (cycleCounter > 11) ); | ||
: | ||
: | ||
: | ||
: | ||
: DFEVar dataRequestEnableLoop = dfeBool().newInstance(this); | ||
2 4 0 0 : DFEVar dataRequestEnable = control.count.pulse(1)? 0 : stream.offset(dataRequestEnableLoop,-1); | ||
: | ||
1 1 0 0 : DFEVar pushEnable2 = dataRequestEnable & pushEnable; | ||
: | ||
: //debug.simPrintf("\ncycle=%d, pushEnable2=%d | ", cycleCounter, pushEnable2); | ||
: | ||
1 1 0 0 : DFEVector<DFEVar> input = io.input("input", tupleType, dataRequestEnable); | ||
1 9 0 0 : DFEVar size = io.input("sizes", scalarType, popEnable); | ||
: | ||
: boolean alignOutput = false; | ||
: FetchSubTuple buffer = new FetchSubTuple(this, "test", tupleSize, 64, floatType, alignOutput); | ||
0 12 0 0 : DFEVar subTupleSize = (popEnable)? size: 0; | ||
37207 685 4 0 : DFEVector<DFEVar> outTuple = buffer.popPush(subTupleSize, pushEnable2, input); | ||
: | ||
: dataRequestEnableLoop <== buffer.nextPushEnable(); | ||
: | ||
: /* | ||
: debug.simPrintf("|prefetchEnable=%d, pushEnable=%d, popEnable=%d, size=%d, subTupleSize=%d, dataRequestEnable=%d, nextPushEnable=%d, ", | ||
: prefetchEnable, pushEnable, popEnable, size, subTupleSize, dataRequestEnable, dataRequestEnableLoop); | ||
: debug.simPrintf("outTuple: "); | ||
: for (int i = 0; i < tupleSize; i++) | ||
: { | ||
: debug.simPrintf("%f ", outTuple[i]); | ||
: } | ||
: */ | ||
: io.output("output", outTuple, tupleType); | ||
: } | ||
: } |
60 changes: 60 additions & 0 deletions
60
...xperimental-results/160wide-64bits-shiftreg-simplified-noalign/FetchSubTupleManager.maxja
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
LUTs FFs BRAMs DSPs : FetchSubTupleManager.maxj | ||
37842 42581 4 0 : resources used by this file | ||
7.21% 4.06% 0.16% 0.00% : % of available | ||
78.73% 56.57% 0.69% 0.00% : % of total used | ||
99.80% 80.07% 100.00% 0.00% : % of user resources | ||
|
||
: import com.maxeler.maxcompiler.v2.managers.engine_interfaces.CPUTypes; | ||
: import com.maxeler.maxcompiler.v2.managers.engine_interfaces.EngineInterface; | ||
: import com.maxeler.maxcompiler.v2.managers.engine_interfaces.InterfaceParam; | ||
: import com.maxeler.maxcompiler.v2.managers.custom.CustomManager; | ||
: import com.maxeler.maxcompiler.v2.managers.custom.blocks.KernelBlock; | ||
: import com.maxeler.maxcompiler.v2.build.EngineParameters; | ||
: | ||
: public class FetchSubTupleManager extends CustomManager{ | ||
: | ||
: private static final String s_kernelName = "FetchSubTupleKernel"; | ||
: private static final int tupleSize = 160; | ||
: | ||
: FetchSubTupleManager(EngineParameters ep) | ||
: { | ||
: super(ep); | ||
: | ||
: config.setDefaultStreamClockFrequency(200); | ||
: | ||
: | ||
37532 1189 4 0 : KernelBlock k = addKernel(new FetchSubTupleKernel(makeKernelParameters(s_kernelName), tupleSize)); | ||
: | ||
: k.getInput("input") <== addStreamFromCPU("input"); | ||
: k.getInput("sizes") <== addStreamFromCPU("sizes"); | ||
: addStreamToCPU("output") <== k.getOutput("output"); | ||
: } | ||
: | ||
: private static EngineInterface interfaceDefault() { | ||
: EngineInterface engine_interface = new EngineInterface(); | ||
: CPUTypes type = CPUTypes.INT32; | ||
: int size = type.sizeInBytes(); | ||
: CPUTypes typeDouble = CPUTypes.DOUBLE; | ||
: int sizeDouble = typeDouble.sizeInBytes(); | ||
: | ||
: InterfaceParam numInputs = engine_interface.addParam("numInputs", CPUTypes.INT); | ||
: InterfaceParam numCycles = engine_interface.addParam("numCycles", CPUTypes.INT); | ||
: InterfaceParam inputSizeBytes = numInputs * sizeDouble; | ||
: InterfaceParam sizesSizeBytes = numCycles * size; | ||
: | ||
: engine_interface.setTicks(s_kernelName, numCycles); | ||
: | ||
: engine_interface.setStream("input", typeDouble, inputSizeBytes); | ||
: engine_interface.setStream("output", typeDouble, inputSizeBytes); | ||
: engine_interface.setStream("sizes", type, sizesSizeBytes); | ||
: return engine_interface; | ||
: } | ||
: | ||
: | ||
: public static void main(String[] args) { | ||
37532 1189 4 0 : FetchSubTupleManager manager = new FetchSubTupleManager(new EngineParameters(args)); | ||
: manager.createSLiCinterface(interfaceDefault()); | ||
: manager.addMaxFileConstant("tupleSize", tupleSize); | ||
310 41392 0 0 : manager.build(); | ||
: } | ||
: } |
Oops, something went wrong.