Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » [Acceleo] Netlist Generation (nested loops+ variables?)
icon5.gif  [Acceleo] Netlist Generation (nested loops+ variables?) [message #1690179] Wed, 25 March 2015 15:08 Go to next message
Frank W. is currently offline Frank W.Friend
Messages: 10
Registered: March 2015
Junior Member
Hi,

I am basically trying to generate a net list from my implementation in the internal block diagram. It should look like this for two modules with ref_src1 being a part out the name of the port and iref the name of the connection and so on:

  ref_src ref_src1("ref_src1", ref_val, t_step);
   ref_src1.out(iref);

  diff diff1("diff1");
   diff1.ref(iref);
   diff1.meas(imeas);
   diff1.err(ierr);


Now I basically have the problem that when i am in between the for loops I can access certain elements which I cannot access in different parts of my uml model iterations.

My Code looks like this:
[comment Connections/]
[for (p:Package | aModel.eContents(Package))]
	[if (p.name = 'Testbenches')]
		[for (c:Class | p.eContents(Class))]
			[for (parts:Property | c.eContents(Property))]
[let myPartsName : String = parts.name]
[for (p:Package | aModel.eContents(Package))]
	[if (p.name = 'scp_comlib')]
		[for (cl:Class | p.eContents(Class))]
			[if parts.type.name = cl.name] 
				[for (property :Property | cl.ownedElement->select(p | p.oclIsKindOf(Port)))]
[myPartsName/].[property.name/]([property./])
				[/for]
			[/if]
		[/for]
	[/if]
[/for]
[/let]
			[/for]
		[/for]
	[/if]
[/for]


My Output of this code is this:

ref_src1.out()
diff1.ref()
diff1.err()
diff1.meas()

So I put one 'let' in there so that the instance name gets repeated. But when I want to check the connections I am in a different for loop from which I loose the control of the other parameters. And the let scope is limited.

Like this:
[for (p:Package | aModel.eContents(Package))]
	[if (p.name = 'Testbenches')]
		[for (c:Class | p.eContents(Class))]
			[for (property :Feature | c.ownedElement->select(p | 
			p.oclIsKindOf(Connector)))]
				[property.name/]
				[for (cend:ConnectorEnd | property.eContents(ConnectorEnd))]


How can I solve this?
If you have some code example, that would be great.
Or maybe someone has already set up a net list generation.

-Frank

[Updated on: Wed, 25 March 2015 15:23]

Report message to a moderator

Re: [Acceleo] Netlist Generation (nested loops+ variables?) [message #1690209 is a reply to message #1690179] Wed, 25 March 2015 16:58 Go to previous message
Frank W. is currently offline Frank W.Friend
Messages: 10
Registered: March 2015
Junior Member
Can this be marked as solved?
I just wanted to let you know that I solved the issues with a simple parameterized template call. I was just not seeing it a few hours ago. Thank you

[comment Connections/]
[for (p:Package | aModel.eContents(Package))]
	[if (p.name = 'Testbenches')]
		[for (c:Class | p.eContents(Class))]
			[for (parts:Property | c.eContents(Property))]
[let myPartsName : String = parts.name]
[for (p:Package | aModel.eContents(Package))]
	[if (p.name = 'scp_comlib')]
		[for (cl:Class | p.eContents(Class))]
			[if parts.type.name = cl.name] 
				[for (property :Property | cl.ownedElement->select(p | p.oclIsKindOf(Port)))]
[myPartsName/].[property.name/]([generateConnectors(c, myPartsName, property.name)/]
				[/for]
			[/if]
		[/for]
	[/if]
[/for]
[/let]
			[/for]
		[/for]
	[/if]
[/for]
[template public generateConnectors(c:Class, myPartsName:String, myPortName:String)]
[for (property :Feature | c.ownedElement->select(p | p.oclIsKindOf(Connector)))]
	[for (cend:ConnectorEnd | property.eContents(ConnectorEnd))]
		[if myPartsName = cend.partWithPort.name and myPortName= cend.role.name]			
[property.name/]);	
		[/if]	
	[/for]
[/for]
[/template]

Previous Topic:Problems with flow port stereotype with Luna and Acceleo
Next Topic:[Acceleo] Easiest way to deploy a generator
Goto Forum:
  


Current Time: Sat Oct 20 13:02:38 GMT 2018

Powered by FUDForum. Page generated in 0.02529 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top