Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » How to generate .vhdl code/template from my grammar(I have a written a short grammar in Xtext and I will like to write the Codegenerator to produce .vhdl code. I will paste the image of my grammar and my eclipse Application. Thanks for your help)
How to generate .vhdl code/template from my grammar [message #1793070] Mon, 30 July 2018 13:55 Go to next message
Stevo McLaren is currently offline Stevo McLarenFriend
Messages: 26
Registered: July 2018
Junior Member
No Message Body
Re: How to generate .vhdl code/template from my grammar [message #1793081 is a reply to message #1793070] Mon, 30 July 2018 18:56 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 12388
Registered: July 2009
Senior Member
hi, what is your question?

Need professional support for Xtext, Xpand, EMF?
Go to: https://xtext.itemis.com
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: How to generate .vhdl code/template from my grammar [message #1793084 is a reply to message #1793081] Mon, 30 July 2018 21:25 Go to previous messageGo to next message
Stevo McLaren is currently offline Stevo McLarenFriend
Messages: 26
Registered: July 2018
Junior Member
My question is how to write a Codegenerator for my above grammar so as to generate a .vhdl template.
Re: How to generate .vhdl code/template from my grammar [message #1793091 is a reply to message #1793084] Tue, 31 July 2018 04:35 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 12388
Registered: July 2009
Senior Member
Did. you have a Look at the. code Generation Parts of the Tutorial?
What did. you Try so far.


Need professional support for Xtext, Xpand, EMF?
Go to: https://xtext.itemis.com
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: How to generate .vhdl code/template from my grammar [message #1793095 is a reply to message #1793091] Tue, 31 July 2018 06:40 Go to previous messageGo to next message
Stevo McLaren is currently offline Stevo McLarenFriend
Messages: 26
Registered: July 2018
Junior Member
Hi Dietrich, this is what I have tried so far.

/*
* generated by Xtext 2.13.0
*/
package org.xtext.vhdlinterface.generator

import org.eclipse.emf.ecore.resource.Resource
import org.eclipse.xtext.generator.AbstractGenerator
import org.eclipse.xtext.generator.IFileSystemAccess2
import org.eclipse.xtext.generator.IGeneratorContext
import org.xtext.vhdlinterface.myVHDL.Model

/**
* Generates code from your model files on save.
*
* See https://www.eclipse.org/Xtext/documentation/303_runtime_concepts.html#code-generation
*/
class MyVHDLGenerator extends AbstractGenerator {

override void doGenerate(Resource resource, IFileSystemAccess2 fsa, IGeneratorContext context) {
fsa.generateFile('code.vhdl', '' +
resource.allContents
.filter(Model)
.join(''))
}
}

Please throw a look and I will be very greatful for your feedback. Thanks
NB: I am completely new to this field.
Re: How to generate .vhdl code/template from my grammar [message #1793098 is a reply to message #1793095] Tue, 31 July 2018 07:39 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 6112
Registered: July 2009
Senior Member
Hi

What do you mean by generate VHDL? It seems that you have (re)developed a VHDL grammar enabling you to edit VHDL files with Xtext. As such your input file is VHDL so there is nothing more to generate.

Regards

Ed Willink
Re: How to generate .vhdl code/template from my grammar [message #1793101 is a reply to message #1793098] Tue, 31 July 2018 08:32 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 12388
Registered: July 2009
Senior Member
i cannot help you until you tell us what your problem is and what you try to achive

Need professional support for Xtext, Xpand, EMF?
Go to: https://xtext.itemis.com
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: How to generate .vhdl code/template from my grammar [message #1793138 is a reply to message #1793098] Tue, 31 July 2018 14:18 Go to previous messageGo to next message
Stevo McLaren is currently offline Stevo McLarenFriend
Messages: 26
Registered: July 2018
Junior Member
Exactly you got me right. I already have a .vhdl file and my aim was to write the grammar of that .vhdl file in xtext. So these were my ideas:
-> Develop the grammar
-> Run the developed grammar as an Eclipse Application
-> Write some common validators
-> Generate some codes with the code generator

Attached is the original .vhdl file which I wish to regenerate using XTEXT. I hope you will understand me now. Thanks alot
  • Attachment: file.vhd
    (Size: 4.24KB, Downloaded 14 times)

[Updated on: Tue, 31 July 2018 14:27]

Report message to a moderator

Re: How to generate .vhdl code/template from my grammar [message #1793141 is a reply to message #1793138] Tue, 31 July 2018 14:32 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 12388
Registered: July 2009
Senior Member
well what is not clear for me:

- is your question regarding the last point ( Generate some codes with the code generator)
- and of yes what is the specific problem you have. you should be able to create a simple file with some content with whats in the tutorial


Need professional support for Xtext, Xpand, EMF?
Go to: https://xtext.itemis.com
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: How to generate .vhdl code/template from my grammar [message #1793143 is a reply to message #1793141] Tue, 31 July 2018 14:42 Go to previous messageGo to next message
Stevo McLaren is currently offline Stevo McLarenFriend
Messages: 26
Registered: July 2018
Junior Member
lwell what is not clear for me:

- is your question regarding the last point ( Generate some codes with the code generator)
- and of yes what is the specific problem you have. you should be able to create a simple file with some content with whats in the tutorial


Yes my question is how to generate some codes with the code generator. From the grammar I posted right up. Please could you write a code generator for my grammar and show me? I think that will be the solution to my problem.

Do you mean the tutorials on the eclipse page(https://www.eclipse.org/Xtext/documentation/102_domainmodelwalkthrough.html)?

Re: How to generate .vhdl code/template from my grammar [message #1793149 is a reply to message #1793143] Tue, 31 July 2018 16:10 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 12388
Registered: July 2009
Senior Member
still cannot follow you

override void doGenerate(Resource resource, IFileSystemAccess2 fsa, IGeneratorContext context) {
fsa.generateFile('code.vhdl', '''Hello World''')
}



and i mean this one: https://www.eclipse.org/Xtext/documentation/103_domainmodelnextsteps.html#tutorial-code-generation


Need professional support for Xtext, Xpand, EMF?
Go to: https://xtext.itemis.com
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de

[Updated on: Tue, 31 July 2018 16:12]

Report message to a moderator

Re: How to generate .vhdl code/template from my grammar [message #1793159 is a reply to message #1793149] Tue, 31 July 2018 18:25 Go to previous message
Ed Willink is currently offline Ed WillinkFriend
Messages: 6112
Registered: July 2009
Senior Member
Hi

What code do you expect to generate?

If you want to convert the VHDL to masks for a silicon then you should look to the various silicon synthesis tools.

If you want to simulate the VHDL look at VHDL simulation tools.

Regards

Ed Willink
Previous Topic:How to notified that the building of all my files finished ?
Next Topic:RuntimeException - Context not valid for type
Goto Forum:
  


Current Time: Mon Nov 19 10:16:31 GMT 2018

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

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

Back to the top