streamblocks / streamblocks-platforms Goto Github PK
View Code? Open in Web Editor NEWStreamBlocks available platforms
License: GNU General Public License v3.0
StreamBlocks available platforms
License: GNU General Public License v3.0
namespace hetero.stencil.denoise2d:
actor Filter(uint lower_bound, uint upper_bound, int max_index) int In ==> int Out:
uint index := 0;
drop: action In:[t] ==>
guard index < lower_bound and index > upper_bound
do
if index = max_index - 1 then
index := 0;
else
index := index + 1;
end
end
pass: action In:[t] ==> Out:[t]
guard index >= lower_bound and index <= upper_bound
do
index := index + 1;
end
end
actor Splitter() int In ==> int Left, int Right:
split: action In:[t] ==> Left:[t], Right:[t] end
end
actor Denoise2DKernel()
int Ref_1_0,
int Ref_0_1,
int Ref_0_0,
int Ref_0_m1,
int Ref_m1_0
==> int Out:
kernel:action
Ref_1_0:[t10],
Ref_0_1:[t01],
Ref_0_0:[t00],
Ref_0_m1:[t0m1],
Ref_m1_0:[tm10] ==>
Out:[(t00 - t0m1) * (t00 - t0m1) +
(t00 - t01 ) * (t00 - t01 ) +
(t00 - tm10) * (t00 - tm10) +
(t00 - t10 ) * (t00 - t10 )]
end
end
network Denoise2D(uint x_dim, uint y_dim) int In ==> int Out:
entities
f0 = Filter(
max_index = x_dim * y_dim,
lower_bound = 2 * y_dim + 1,
upper_bound = (x_dim - 1) * y_dim + (y_dim - 2));
f1 = Filter(
max_index = x_dim * y_dim,
lower_bound = 1 * y_dim + 2,
upper_bound = (x_dim - 2) * y_dim + (y_dim - 1)
);
f2 = Filter(
max_index = x_dim * y_dim,
lower_bound = 1 * y_dim + 1,
upper_bound = (x_dim - 2) * y_dim + (y_dim - 2)
);
f3 = Filter(
max_index = x_dim * y_dim,
lower_bound = 1 * y_dim + 0,
upper_bound = (x_dim - 2) * y_dim + (y_dim - 3)
);
f4 = Filter(
max_index = x_dim * y_dim,
lower_bound = 0 * y_dim + 1,
upper_bound = (x_dim - 3) * y_dim + (y_dim - 2)
);
s0 = Splitter(); s1 = Splitter(); s2 = Splitter(); s3 = Splitter();
kernel = Denoise2DKernel();
structure
In --> s0.In;
s0.Left --> f0.In;
s0.Right --> s1.In;
s1.Left --> f1.In;
s1.Right --> s2.In;
s2.Left --> f2.In;
s2.Right --> s3.In;
s3.Left --> f3.In;
s3.Right --> f4.In;
f0.Out --> kernel.Ref_1_0;
f1.Out --> kernel.Ref_0_1;
f2.Out --> kernel.Ref_0_0;
f3.Out --> kernel.Ref_0_m1;
f4.Out --> kernel.Ref_m1_0;
**// kernel.Out --> Out; this connection is left out on purpose.**
end
network Denoise2D_5x5() int In ==> int Out:
entities
stencil_network = Denoise2D(x_dim = 5, y_dim = 5);
structure
In --> stencil_network.In;
stencil_network.Out --> Out;
end
end
Compiled with
streamblocks vivado-hls --source-path ${CA_SOURCE_PATH} --target-path ${TARGET_PATH} hetero.stencil.denoise2d.Denoise2D_5x5
Yields
Exception in thread "main" java.util.NoSuchElementException: The node is not part of this tree.
at se.lth.cs.tycho.phase.TreeShadowImpl.parent(TreeShadowImpl.java:31)
at se.lth.cs.tycho.attribute.GlobalNames$Implementation.globalName(GlobalNames.java:55)
at se.lth.cs.tycho.attribute.GlobalNames$Implementation$MultiJ.globalName(GlobalNames$Implementation$MultiJ.java:100)
at se.lth.cs.tycho.phase.ResolveGlobalEntityNamesPhase$Transformation.apply(ResolveGlobalEntityNamesPhase.java:50)
at se.lth.cs.tycho.phase.ResolveGlobalEntityNamesPhase$Transformation$MultiJ.apply(ResolveGlobalEntityNamesPhase$Transformation$MultiJ.java:78)
at se.lth.cs.tycho.ir.IRNode$Transformation.applyChecked(IRNode.java:147)
at se.lth.cs.tycho.phase.ResolveGlobalEntityNamesPhase$Transformation$MultiJ.applyChecked(ResolveGlobalEntityNamesPhase$Transformation$MultiJ.java:89)
at se.lth.cs.tycho.ir.entity.nl.EntityInstanceExpr.transformChildren(EntityInstanceExpr.java:87)
at se.lth.cs.tycho.ir.entity.nl.EntityInstanceExpr.transformChildren(EntityInstanceExpr.java:21)
at se.lth.cs.tycho.phase.ResolveGlobalEntityNamesPhase$Transformation.apply(ResolveGlobalEntityNamesPhase.java:45)
at se.lth.cs.tycho.phase.ResolveGlobalEntityNamesPhase$Transformation$MultiJ.apply(ResolveGlobalEntityNamesPhase$Transformation$MultiJ.java:80)
at se.lth.cs.tycho.ir.IRNode$Transformation.applyChecked(IRNode.java:147)
at se.lth.cs.tycho.phase.ResolveGlobalEntityNamesPhase$Transformation$MultiJ.applyChecked(ResolveGlobalEntityNamesPhase$Transformation$MultiJ.java:89)
at se.lth.cs.tycho.ir.entity.nl.InstanceDecl.transformChildren(InstanceDecl.java:53)
at se.lth.cs.tycho.ir.entity.nl.InstanceDecl.transformChildren(InstanceDecl.java:8)
at se.lth.cs.tycho.phase.ResolveGlobalEntityNamesPhase$Transformation.apply(ResolveGlobalEntityNamesPhase.java:45)
at se.lth.cs.tycho.phase.ResolveGlobalEntityNamesPhase$Transformation$MultiJ.apply(ResolveGlobalEntityNamesPhase$Transformation$MultiJ.java:80)
at se.lth.cs.tycho.phase.ResolveGlobalEntityNamesPhase$Transformation$MultiJ.apply(ResolveGlobalEntityNamesPhase$Transformation$MultiJ.java:2)
at se.lth.cs.tycho.ir.util.ImmutableList.map(ImmutableList.java:35)
at se.lth.cs.tycho.ir.entity.nl.NlNetwork.transformChildren(NlNetwork.java:73)
at se.lth.cs.tycho.ir.entity.nl.NlNetwork.transformChildren(NlNetwork.java:17)
at se.lth.cs.tycho.phase.ResolveGlobalEntityNamesPhase$Transformation.apply(ResolveGlobalEntityNamesPhase.java:45)
at se.lth.cs.tycho.phase.ResolveGlobalEntityNamesPhase$Transformation$MultiJ.apply(ResolveGlobalEntityNamesPhase$Transformation$MultiJ.java:80)
at se.lth.cs.tycho.ir.decl.GlobalEntityDecl.transformChildren(GlobalEntityDecl.java:54)
at se.lth.cs.tycho.ir.decl.GlobalEntityDecl.transformChildren(GlobalEntityDecl.java:8)
at se.lth.cs.tycho.phase.ResolveGlobalEntityNamesPhase$Transformation.apply(ResolveGlobalEntityNamesPhase.java:45)
at se.lth.cs.tycho.phase.ResolveGlobalEntityNamesPhase$Transformation$MultiJ.apply(ResolveGlobalEntityNamesPhase$Transformation$MultiJ.java:80)
at se.lth.cs.tycho.phase.ResolveGlobalEntityNamesPhase$Transformation$MultiJ.apply(ResolveGlobalEntityNamesPhase$Transformation$MultiJ.java:2)
at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195)
at java.base/java.util.Iterator.forEachRemaining(Iterator.java:133)
at java.base/java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1801)
at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484)
at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474)
at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:913)
at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:578)
at se.lth.cs.tycho.ir.IRNode$Transformation.mapChecked(IRNode.java:162)
at se.lth.cs.tycho.phase.ResolveGlobalEntityNamesPhase$Transformation$MultiJ.mapChecked(ResolveGlobalEntityNamesPhase$Transformation$MultiJ.java:69)
at se.lth.cs.tycho.ir.NamespaceDecl.transformChildren(NamespaceDecl.java:115)
at se.lth.cs.tycho.ir.NamespaceDecl.transformChildren(NamespaceDecl.java:11)
at se.lth.cs.tycho.phase.ResolveGlobalEntityNamesPhase$Transformation.apply(ResolveGlobalEntityNamesPhase.java:45)
at se.lth.cs.tycho.phase.ResolveGlobalEntityNamesPhase$Transformation$MultiJ.apply(ResolveGlobalEntityNamesPhase$Transformation$MultiJ.java:80)
at se.lth.cs.tycho.compiler.SourceUnit.transformChildren(SourceUnit.java:29)
at se.lth.cs.tycho.compiler.SourceUnit.transformChildren(SourceUnit.java:10)
at se.lth.cs.tycho.phase.ResolveGlobalEntityNamesPhase$Transformation.apply(ResolveGlobalEntityNamesPhase.java:45)
at se.lth.cs.tycho.phase.ResolveGlobalEntityNamesPhase$Transformation$MultiJ.apply(ResolveGlobalEntityNamesPhase$Transformation$MultiJ.java:80)
at se.lth.cs.tycho.phase.ResolveGlobalEntityNamesPhase$Transformation$MultiJ.apply(ResolveGlobalEntityNamesPhase$Transformation$MultiJ.java:2)
at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195)
at java.base/java.util.Iterator.forEachRemaining(Iterator.java:133)
at java.base/java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1801)
at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484)
at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474)
at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:913)
at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:578)
at se.lth.cs.tycho.ir.IRNode$Transformation.mapChecked(IRNode.java:162)
at se.lth.cs.tycho.phase.ResolveGlobalEntityNamesPhase$Transformation$MultiJ.mapChecked(ResolveGlobalEntityNamesPhase$Transformation$MultiJ.java:69)
at se.lth.cs.tycho.compiler.CompilationTask.transformChildren(CompilationTask.java:98)
at se.lth.cs.tycho.phase.ResolveGlobalEntityNamesPhase.execute(ResolveGlobalEntityNamesPhase.java:32)
at se.lth.cs.tycho.compiler.Compiler.compile(Compiler.java:279)
at se.lth.cs.tycho.compiler.Main.run(Main.java:140)
at se.lth.cs.tycho.compiler.Main.main(Main.java:23)
Instead of throwing an error.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.