Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
monticore
EmbeddedMontiArc
languages
CNNArchLang
Commits
2c6ec817
Commit
2c6ec817
authored
Jul 23, 2019
by
Christian Fuß
Browse files
progress
parent
0052260f
Pipeline
#164100
passed with stages
in 17 minutes and 45 seconds
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/main/java/de/monticore/lang/monticar/cnnarch/_symboltable/CNNArchSymbolTableCreator.java
View file @
2c6ec817
...
...
@@ -149,6 +149,8 @@ public class CNNArchSymbolTableCreator extends de.monticore.symboltable.CommonSy
ASTStream
astStream
=
(
ASTStream
)
astInstruction
;
// TODO: For now all instructions are streams
streams
.
add
((
SerialCompositeElementSymbol
)
astStream
.
getSymbolOpt
().
get
());
}
System
.
err
.
println
(
"777333: streams set for architecture"
);
System
.
err
.
println
(
streams
.
get
(
0
).
getElements
().
toString
());
architecture
.
setStreams
(
streams
);
removeCurrentScope
();
...
...
@@ -356,6 +358,8 @@ public class CNNArchSymbolTableCreator extends de.monticore.symboltable.CommonSy
for
(
ASTArchitectureElement
astElement
:
ast
.
getBody
().
getElementsList
()){
elements
.
add
((
ArchitectureElementSymbol
)
astElement
.
getSymbolOpt
().
get
());
}
sces
.
setElements
(
elements
);
layer
.
setBody
(
sces
);
layer
.
getDeclaration
().
setBody
(
sces
);
layer
.
getDeclaration
().
getBody
().
setElements
(
elements
);
...
...
@@ -367,14 +371,10 @@ public class CNNArchSymbolTableCreator extends de.monticore.symboltable.CommonSy
}
layer
.
setArguments
(
arguments
);
int
elementNumber
=
0
;
for
(
ASTArchitectureElement
astElement
:
ast
.
getBody
().
getElementsList
()){
//TODO: assign parameters to layers in Unroll
//sublayer.getDeclaration().setBody((SerialCompositeElementSymbol) ast.getBody().getSymbolOpt().get());
List
<
ArgumentSymbol
>
subarguments
=
new
ArrayList
<>(
6
);
...
...
@@ -391,9 +391,46 @@ public class CNNArchSymbolTableCreator extends de.monticore.symboltable.CommonSy
if
(
elementNumber
==
0
&&
astElement
.
getSymbolOpt
().
get
()
instanceof
IOSymbol
){
layer
.
getDeclaration
().
getBody
().
setInputElement
((
ArchitectureElementSymbol
)
astElement
.
getSymbolOpt
().
get
());
((
IOSymbol
)
astElement
.
getSymbol
()).
getArchitecture
().
resolveIODeclaration
(((
IOSymbol
)
astElement
.
getSymbol
()).
getName
());
System
.
err
.
println
(
"Here 55566"
);
Iterator
iterator
=
((
IOSymbol
)
astElement
.
getSymbol
()).
getArchitecture
().
getIODeclarations
().
iterator
();
while
(
iterator
.
hasNext
()){
System
.
err
.
println
(
"0001111: "
+
iterator
.
next
().
toString
());
}
ASTIODeclaration
ioAST
=
(
ASTIODeclaration
)
((
IOSymbol
)
astElement
.
getSymbol
()).
getDefinition
().
getAstNode
().
get
();
IODeclarationSymbol
iODeclaration
=
((
IOSymbol
)
astElement
.
getSymbol
()).
getDefinition
();
if
(
ioAST
.
isPresentArrayDeclaration
()){
iODeclaration
.
setArrayLength
(
ioAST
.
getArrayDeclaration
().
getIntLiteral
().
getNumber
().
get
().
intValue
());
}
iODeclaration
.
setInput
(
ioAST
.
isPresentIn
());
iODeclaration
.
setType
((
ArchTypeSymbol
)
ioAST
.
getType
().
getSymbolOpt
().
get
());
try
{
((
IOSymbol
)
astElement
.
getSymbolOpt
().
get
()).
resolve
();
((
IOSymbol
)
ast
.
getBody
().
getElements
(
0
).
getSymbolOpt
().
get
()).
resolve
();
}
catch
(
ArchResolveException
e
)
{
e
.
printStackTrace
();
}
layer
.
getBody
().
setInputElement
((
ArchitectureElementSymbol
)
astElement
.
getSymbolOpt
().
get
());
layer
.
setInputElement
((
ArchitectureElementSymbol
)
astElement
.
getSymbolOpt
().
get
());
}
else
if
(
elementNumber
==
(
ast
.
getBody
().
getElementsList
().
size
()
-
1
)
&&
astElement
.
getSymbolOpt
().
get
()
instanceof
IOSymbol
){
layer
.
getDeclaration
().
getBody
().
setOutputElement
((
ArchitectureElementSymbol
)
astElement
.
getSymbolOpt
().
get
());
Iterator
iterator2
=
((
IOSymbol
)
astElement
.
getSymbol
()).
getArchitecture
().
getInputs
().
iterator
();
while
(
iterator2
.
hasNext
()){
System
.
err
.
println
(
"0002222: "
+
iterator2
.
next
().
toString
());
}
try
{
((
IOSymbol
)
astElement
.
getSymbolOpt
().
get
()).
resolve
();
((
IOSymbol
)
ast
.
getBody
().
getElements
(
ast
.
getBody
().
getElementsList
().
size
()
-
1
).
getSymbolOpt
().
get
()).
resolve
();
}
catch
(
ArchResolveException
e
)
{
e
.
printStackTrace
();
}
layer
.
getBody
().
setOutputElement
((
ArchitectureElementSymbol
)
astElement
.
getSymbolOpt
().
get
());
layer
.
setOutputElement
((
ArchitectureElementSymbol
)
astElement
.
getSymbolOpt
().
get
());
}
elementNumber
++;
}
...
...
src/main/java/de/monticore/lang/monticar/cnnarch/_symboltable/CompositeElementSymbol.java
View file @
2c6ec817
...
...
@@ -51,7 +51,7 @@ public abstract class CompositeElementSymbol extends ArchitectureElementSymbol {
isNetwork
|=
((
LayerSymbol
)
element
).
getDeclaration
().
isNetworkLayer
();
}
else
if
(
element
instanceof
UnrollSymbol
)
{
isNetwork
|=
((
UnrollSymbol
)
element
).
getDeclaration
().
isNetworkLayer
();
isNetwork
|=
((
UnrollSymbol
)
element
).
isNetworkLayer
();
}
}
...
...
src/main/java/de/monticore/lang/monticar/cnnarch/_symboltable/IOSymbol.java
View file @
2c6ec817
...
...
@@ -55,9 +55,6 @@ public class IOSymbol extends ArchitectureElementSymbol {
//returns null if IODeclaration does not exist. This is checked in coco CheckIOName.
public
IODeclarationSymbol
getDefinition
()
{
if
(
definition
==
null
){
System
.
err
.
println
(
"#1112 "
+
getEnclosingScope
().
getSpanningSymbol
().
get
().
toString
());
System
.
err
.
println
(
"#11123 "
+
getEnclosingScope
().
getSpanningSymbol
().
get
().
getEnclosingScope
().
getSpanningSymbol
().
get
().
toString
());
System
.
err
.
println
(
"#111234 "
+
getEnclosingScope
().
getSpanningSymbol
().
get
().
getEnclosingScope
().
getSpanningSymbol
().
get
().
getEnclosingScope
().
getSpanningSymbol
().
get
().
toString
());
this
.
definition
=
getArchitecture
().
resolveIODeclaration
(
getName
());
}
return
definition
;
...
...
src/main/java/de/monticore/lang/monticar/cnnarch/predefined/BeamSearchStart.java
View file @
2c6ec817
...
...
@@ -51,12 +51,12 @@ public class BeamSearchStart extends PredefinedUnrollDeclaration {
sublayer
.
resolve
();
System
.
err
.
println
(
"inputElement: "
+
sublayer
.
getInputElement
().
get
().
toString
());
System
.
err
.
println
(
"resolved: "
+
sublayer
.
getResolvedThis
().
get
().
getInputElement
().
get
().
getOutputTypes
().
get
(
0
).
getChannels
().
toString
());
output
=
sublayer
.
getResolvedThis
().
get
().
getInputElement
().
get
().
getOutputTypes
();
//
output = sublayer.getResolvedThis().get().getInputElement().get().getOutputTypes();
System
.
err
.
println
(
"inputTypes: "
+
sublayer
.
getInputTypes
().
toString
());
layers
.
add
((
LayerSymbol
)
sublayer
);
System
.
err
.
println
(
"outputTypes before: "
+
((
ArchitectureElementSymbol
)
sublayer
).
getOutputTypes
().
get
(
0
).
getChannels
());
System
.
err
.
println
(
"
LOL
_NAME: "
+
((
LayerSymbol
)
sublayer
).
getArguments
().
get
(
0
).
getName
());
System
.
err
.
println
(
"
LOL
: "
+
((
LayerSymbol
)
sublayer
).
getIntValue
((((
LayerSymbol
)
sublayer
).
getArguments
().
get
(
0
).
getName
())));
//
System.err.println("
arg0
_NAME: " + ((LayerSymbol) sublayer).getArguments().get(0).getName());
//
System.err.println("
arg0_VALUE
: " + ((LayerSymbol) sublayer).getIntValue((((LayerSymbol) sublayer).getArguments().get(0).getName())));
//item.setOutputTypes(item.getOutputTypes());
//System.err.println("outputTypes after: " + ((ArchitectureElementSymbol) astElement).getOutputTypes());
}
catch
(
Exception
e
)
{
...
...
@@ -69,11 +69,13 @@ public class BeamSearchStart extends PredefinedUnrollDeclaration {
//ArchitectureElementSymbol item = (ArchitectureElementSymbol) ASTitem;
IOSymbol
sublayer
=
(
IOSymbol
)
item
.
getSymbol
();
sublayer
.
resolve
();
//TODO setinputElement !!!!!
System
.
err
.
println
(
"resolved2: "
+
sublayer
.
getResolvedThis
().
get
().
getInputElement
().
get
().
toString
());
System
.
err
.
println
(
"isOutput?: "
+
sublayer
.
isOutput
());
System
.
err
.
println
(
"Definition: "
+
sublayer
.
getDefinition
().
toString
());
System
.
err
.
println
(
"Domain: "
+
sublayer
.
getDefinition
().
getType
().
getDomain
().
toString
());
System
.
err
.
println
(
"Type: "
+
sublayer
.
getDefinition
().
getType
().
getChannels
().
toString
());
output
=
sublayer
.
getResolvedThis
().
get
().
getInputElement
().
get
().
getOutputTypes
();
//
output = sublayer.getResolvedThis().get().getInputElement().get().getOutputTypes();
if
(
sublayer
.
isOutput
()){
output
=
new
ArrayList
<
ArchTypeSymbol
>();
}
...
...
@@ -87,6 +89,7 @@ public class BeamSearchStart extends PredefinedUnrollDeclaration {
}
}
System
.
err
.
println
(
"output: "
+
output
);
return
output
;
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment