6 Commits

62 changed files with 952 additions and 854 deletions

View File

@ -2,7 +2,7 @@
<feature
id="com.minres.rdl.platform.feature"
label="Xtext Platform Feature"
version="1.0.0.qualifier"
version="1.1.0.qualifier"
provider-name="MINRES Technologies GmbH">
<description url="http://www.example.com/description">
@ -130,21 +130,6 @@
version="0.0.0"
unpack="false"/>
<plugin
id="org.eclipse.jdt.compiler.tool"
download-size="0"
install-size="0"
version="0.0.0"
fragment="true"
unpack="false"/>
<plugin
id="org.eclipse.pde.ui"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
<plugin
id="org.eclipse.equinox.p2.repository"
download-size="0"
@ -278,13 +263,6 @@
version="0.0.0"
unpack="false"/>
<plugin
id="org.eclipse.pde.core"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
<plugin
id="org.eclipse.emf.codegen"
download-size="0"
@ -398,13 +376,6 @@
version="0.0.0"
unpack="false"/>
<plugin
id="org.eclipse.jdt.junit"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
<plugin
id="org.eclipse.xtext"
download-size="0"
@ -488,12 +459,6 @@
install-size="0"
version="0.0.0"/>
<plugin
id="org.eclipse.jdt.debug"
download-size="0"
install-size="0"
version="0.0.0"/>
<plugin
id="org.eclipse.emf.mwe2.language"
download-size="0"
@ -578,13 +543,6 @@
version="0.0.0"
unpack="false"/>
<plugin
id="org.eclipse.jdt.launching"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
<plugin
id="org.eclipse.emf.mwe2.runtime"
download-size="0"
@ -683,13 +641,6 @@
version="0.0.0"
unpack="false"/>
<plugin
id="org.eclipse.jdt.debug.ui"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
<plugin
id="org.eclipse.equinox.p2.operations"
download-size="0"
@ -697,13 +648,6 @@
version="0.0.0"
unpack="false"/>
<plugin
id="org.eclipse.jdt.junit.runtime"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
<plugin
id="org.eclipse.ant.launching"
download-size="0"
@ -1018,13 +962,6 @@
version="0.0.0"
unpack="false"/>
<plugin
id="org.eclipse.jdt.ui"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
<plugin
id="org.w3c.dom.svg"
download-size="0"
@ -1046,13 +983,6 @@
version="0.0.0"
unpack="false"/>
<plugin
id="org.eclipse.jdt.junit.core"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
<plugin
id="org.eclipse.e4.ui.workbench"
download-size="0"
@ -1137,12 +1067,6 @@
version="0.0.0"
unpack="false"/>
<plugin
id="org.eclipse.pde.build"
download-size="0"
install-size="0"
version="0.0.0"/>
<plugin
id="org.eclipse.ant.core"
download-size="0"
@ -1220,13 +1144,6 @@
version="0.0.0"
unpack="false"/>
<plugin
id="org.eclipse.jdt.core.manipulation"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
<plugin
id="org.eclipse.ui.trace"
download-size="0"
@ -1248,13 +1165,6 @@
version="0.0.0"
unpack="false"/>
<plugin
id="org.eclipse.pde.launching"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
<plugin
id="org.apache.commons.lang"
download-size="0"
@ -1290,14 +1200,6 @@
version="0.0.0"
unpack="false"/>
<plugin
id="org.eclipse.jdt.compiler.apt"
download-size="0"
install-size="0"
version="0.0.0"
fragment="true"
unpack="false"/>
<plugin
id="org.eclipse.osgi.services"
download-size="0"
@ -1340,13 +1242,6 @@
version="0.0.0"
unpack="false"/>
<plugin
id="org.eclipse.jdt.core"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
<plugin
id="org.eclipse.ui.editors"
download-size="0"

View File

@ -8,6 +8,7 @@
</parent>
<artifactId>com.minres.rdl.platform.feature</artifactId>
<packaging>eclipse-feature</packaging>
<version>1.1.0-SNAPSHOT</version>
<build>
<plugins>

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<?pde version="3.5"?>
<product name="RDL Editor" uid="com.minres.rdl.product.product" id="com.minres.rdl.product.product" application="org.eclipse.ui.ide.workbench" version="1.2.0.qualifier" useFeatures="true" includeLaunchers="true">
<product name="RDL Editor" uid="com.minres.rdl.product.product" id="com.minres.rdl.product.product" application="org.eclipse.ui.ide.workbench" version="1.2.1.qualifier" useFeatures="true" includeLaunchers="true">
<configIni use="default">
</configIni>
@ -100,9 +100,9 @@
</plugins>
<features>
<feature id="com.minres.rdl.platform.feature" version="1.0.0.qualifier"/>
<feature id="com.minres.rdl.product.feature" version="1.0.0.qualifier"/>
<feature id="com.minres.rdl.feature" version="1.0.0.qualifier"/>
<feature id="com.minres.rdl.platform.feature"/>
<feature id="com.minres.rdl.product.feature"/>
<feature id="com.minres.rdl.feature"/>
<feature id="org.eclipse.emf.ecore"/>
<feature id="org.eclipse.rcp"/>
<feature id="org.eclipse.emf.common"/>

View File

@ -4,7 +4,8 @@
<artifactId>com.minres.rdl.product.releng</artifactId>
<packaging>eclipse-repository</packaging>
<name>RDL EEditor</name>
<name>RDL Editor</name>
<version>1.2.1-SNAPSHOT</version>
<parent>
<version>1.0.0-SNAPSHOT</version>
@ -24,6 +25,12 @@
<linux>tar.gz</linux>
<macosx>tar.gz</macosx>
</formats>
<products>
<product>
<id>com.minres.rdl.product.product</id>
<archiveFileName>RDL-Editor-${project.version}</archiveFileName>
</product>
</products>
</configuration>
<executions>
<execution>

View File

@ -7,7 +7,7 @@
<version>1.0.0-SNAPSHOT</version>
</parent>
<artifactId>com.minres.rdl.repository</artifactId>
<version>1.1.1-SNAPSHOT</version>
<version>1.2.0-SNAPSHOT</version>
<packaging>eclipse-repository</packaging>
<build>

View File

@ -1,7 +1,13 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>com.minres.rdl.parent</artifactId>
<groupId>com.minres.rdl</groupId>
<version>1.0.0-SNAPSHOT</version>
</parent>
<artifactId>com.minres.rdl.standalone</artifactId>
<version>1.2.0-SNAPSHOT</version>
<packaging>eclipse-repository</packaging>
<build>
<pluginManagement>
@ -165,10 +171,4 @@
</snapshots>
</repository>
</repositories>
<parent>
<artifactId>com.minres.rdl.parent</artifactId>
<groupId>com.minres.rdl</groupId>
<version>1.0.0-SNAPSHOT</version>
</parent>
<version>1.1.1-SNAPSHOT</version>
</project>
</project>

View File

@ -18,7 +18,7 @@
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-surefire-plugin</artifactId>
<version>${tycho-version}</version>
<!-- <version>${tycho-version}</version> -->
<configuration>
<failIfNoTests>false</failIfNoTests>
</configuration>

View File

@ -19,10 +19,12 @@ Require-Bundle: com.minres.rdl,
org.eclipse.xtext.xbase.lib;bundle-version="2.14.0",
org.eclipse.xtend.lib;resolution:=optional,
org.eclipse.core.runtime,
org.eclipse.core.resources
org.eclipse.core.resources,
org.eclipse.ui.forms
Import-Package: org.apache.log4j
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Export-Package: com.minres.rdl.ui.internal,
com.minres.rdl.ui.contentassist,
com.minres.rdl.ui.quickfix
com.minres.rdl.ui.quickfix,
com.minres.rdl.ui.wizard
Bundle-Activator: com.minres.rdl.ui.internal.RdlActivator

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 493 B

View File

@ -439,16 +439,28 @@
</extension>
<extension
point="org.eclipse.ui.newWizards">
<category id="com.minres.category" name="MINRES">
</category>
<wizard
category="com.minres.category"
class="com.minres.rdl.ui.RDLExecutableExtensionFactory:com.minres.rdl.ui.wizard.RDLNewProjectWizard"
class="com.minres.rdl.ui.RDLExecutableExtensionFactory:org.eclipse.xtext.ui.wizard.template.TemplateNewProjectWizard"
id="com.minres.rdl.ui.wizard.RDLNewProjectWizard"
name="RDL Project"
icon="icons/new_RDL_proj.gif"
project="true">
</wizard>
<category
id="com.minres.category"
name="MINRES">
</category>
</extension>
<extension
point="org.eclipse.xtext.ui.projectTemplate">
<projectTemplateProvider
class="com.minres.rdl.ui.wizard.RDLProjectTemplateProvider"
grammarName="com.minres.rdl.RDL">
</projectTemplateProvider>
</extension>
<extension
point="org.eclipse.ui.perspectiveExtensions">
<perspectiveExtension targetID="org.eclipse.ui.resourcePerspective">
<newWizardShortcut id="com.minres.rdl.ui.wizard.RDLNewProjectWizard"/>
</perspectiveExtension>
</extension>
</plugin>

View File

@ -14,7 +14,6 @@ import com.minres.rdl.ui.labeling.RDLDescriptionLabelProvider;
import com.minres.rdl.ui.labeling.RDLLabelProvider;
import com.minres.rdl.ui.outline.RDLOutlineTreeProvider;
import com.minres.rdl.ui.quickfix.RDLQuickfixProvider;
import com.minres.rdl.ui.wizard.RDLProjectCreator;
import com.minres.rdl.validation.RDLValidatorConfigurationBlock;
import org.eclipse.compare.IViewerCreator;
import org.eclipse.core.resources.IWorkspaceRoot;
@ -60,6 +59,8 @@ import org.eclipse.xtext.ui.editor.contentassist.IProposalConflictHelper;
import org.eclipse.xtext.ui.editor.contentassist.PrefixMatcher;
import org.eclipse.xtext.ui.editor.contentassist.antlr.AntlrProposalConflictHelper;
import org.eclipse.xtext.ui.editor.contentassist.antlr.DelegatingContentAssistContextFactory;
import org.eclipse.xtext.ui.editor.formatting.IContentFormatterFactory;
import org.eclipse.xtext.ui.editor.formatting2.ContentFormatterFactory;
import org.eclipse.xtext.ui.editor.outline.IOutlineTreeProvider;
import org.eclipse.xtext.ui.editor.outline.impl.IOutlineTreeStructureProvider;
import org.eclipse.xtext.ui.editor.preferences.IPreferenceStoreInitializer;
@ -80,6 +81,7 @@ import org.eclipse.xtext.ui.resource.ResourceServiceDescriptionLabelProvider;
import org.eclipse.xtext.ui.shared.Access;
import org.eclipse.xtext.ui.validation.AbstractValidatorConfigurationBlock;
import org.eclipse.xtext.ui.wizard.IProjectCreator;
import org.eclipse.xtext.ui.wizard.template.DefaultTemplateProjectCreator;
/**
* Manual modifications go to {@link RDLUiModule}.
@ -189,6 +191,11 @@ public abstract class AbstractRDLUiModule extends DefaultUiModule {
.to(BuilderPreferenceAccess.Initializer.class);
}
// contributed by org.eclipse.xtext.xtext.generator.formatting.Formatter2Fragment2
public Class<? extends IContentFormatterFactory> bindIContentFormatterFactory() {
return ContentFormatterFactory.class;
}
// contributed by org.eclipse.xtext.xtext.generator.ui.labeling.LabelProviderFragment2
public Class<? extends ILabelProvider> bindILabelProvider() {
return RDLLabelProvider.class;
@ -287,9 +294,9 @@ public abstract class AbstractRDLUiModule extends DefaultUiModule {
binder.bind(String.class).annotatedWith(Names.named(UIBindings.COMPARE_VIEWER_TITLE)).toInstance("RDL Compare");
}
// contributed by org.eclipse.xtext.xtext.generator.ui.projectWizard.SimpleProjectWizardFragment2
// contributed by org.eclipse.xtext.xtext.generator.ui.projectWizard.TemplateProjectWizardFragment
public Class<? extends IProjectCreator> bindIProjectCreator() {
return RDLProjectCreator.class;
return DefaultTemplateProjectCreator.class;
}
// contributed by org.eclipse.xtext.xtext.generator.exporting.SimpleNamesFragment2

View File

@ -1,55 +0,0 @@
/*
* generated by Xtext 2.14.0
*/
package com.minres.rdl.ui.wizard;
import org.eclipse.xtext.ui.wizard.XtextNewProjectWizard;
import org.eclipse.xtext.ui.wizard.IExtendedProjectInfo;
import org.eclipse.xtext.ui.wizard.IProjectCreator;
import com.google.inject.Inject;
public class RDLNewProjectWizard extends XtextNewProjectWizard {
private RDLWizardNewProjectCreationPage mainPage;
@Inject
public RDLNewProjectWizard(IProjectCreator projectCreator) {
super(projectCreator);
setWindowTitle("New RDL Project");
}
protected RDLWizardNewProjectCreationPage getMainPage() {
return mainPage;
}
/**
* Use this method to add pages to the wizard.
* The one-time generated version of this class will add a default new project page to the wizard.
*/
@Override
public void addPages() {
mainPage = createMainPage("basicNewProjectPage");
mainPage.setTitle("RDL Project");
mainPage.setDescription("Create a new RDL project.");
addPage(mainPage);
}
protected RDLWizardNewProjectCreationPage createMainPage(String pageName) {
return new RDLWizardNewProjectCreationPage(pageName);
}
/**
* Use this method to read the project settings from the wizard pages and feed them into the project info class.
*/
@Override
protected IExtendedProjectInfo getProjectInfo() {
RDLProjectInfo projectInfo = new RDLProjectInfo();
projectInfo.setProjectName(mainPage.getProjectName());
if (!mainPage.useDefaults()) {
projectInfo.setLocationPath(mainPage.getLocationPath());
}
return projectInfo;
}
}

View File

@ -1,98 +0,0 @@
/*
* generated by Xtext 2.14.0
*/
package com.minres.rdl.ui.wizard;
import org.eclipse.xtext.ui.wizard.AbstractPluginProjectCreator;
import java.util.HashMap;
import java.util.List;
import java.util.Set;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.xtext.builder.EclipseResourceFileSystemAccess2;
import org.eclipse.xtext.generator.IFileSystemAccess;
import org.eclipse.xtext.generator.IFileSystemAccess2;
import org.eclipse.xtext.generator.IOutputConfigurationProvider;
import org.eclipse.xtext.generator.OutputConfiguration;
import org.eclipse.xtext.ui.util.PluginProjectFactory;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Lists;
import com.google.inject.Inject;
import com.google.inject.Provider;
public class RDLProjectCreator extends AbstractPluginProjectCreator {
protected static final String DSL_PROJECT_NAME = "com.minres.rdl";
@Inject
private RDLNewProjectWizardInitialContents initialContents;
@Inject
private Provider<EclipseResourceFileSystemAccess2> fileSystemAccessProvider;
@Inject
private IOutputConfigurationProvider outputConfigurationProvider;
@Override
protected PluginProjectFactory createProjectFactory() {
PluginProjectFactory projectFactory = super.createProjectFactory();
projectFactory.setWithPluginXml(false);
return projectFactory;
}
@Override
protected RDLProjectInfo getProjectInfo() {
return (RDLProjectInfo) super.getProjectInfo();
}
@Override
protected String getModelFolderName() {
return "src";
}
@Override
protected List<String> getAllFolders() {
Set<OutputConfiguration> outputConfigurations = outputConfigurationProvider.getOutputConfigurations();
String outputFolder = "src-gen";
for (OutputConfiguration outputConfiguration : outputConfigurations) {
if (IFileSystemAccess.DEFAULT_OUTPUT.equals(outputConfiguration.getName())) {
outputFolder = outputConfiguration.getOutputDirectory();
break;
}
}
return ImmutableList.of(getModelFolderName(), outputFolder);
}
@Override
protected List<String> getRequiredBundles() {
return Lists.newArrayList(DSL_PROJECT_NAME);
}
@Override
protected void enhanceProject(final IProject project, final IProgressMonitor monitor) throws CoreException {
IFileSystemAccess2 access = getFileSystemAccess(project, monitor);
initialContents.generateInitialContents(access);
project.refreshLocal(IResource.DEPTH_INFINITE, monitor);
}
protected IFileSystemAccess2 getFileSystemAccess(final IProject project, final IProgressMonitor monitor) {
EclipseResourceFileSystemAccess2 access = fileSystemAccessProvider.get();
access.setContext(project);
access.setMonitor(monitor);
OutputConfiguration defaultOutput = new OutputConfiguration(IFileSystemAccess.DEFAULT_OUTPUT);
defaultOutput.setDescription("Output Folder");
defaultOutput.setOutputDirectory("./");
defaultOutput.setOverrideExistingResources(true);
defaultOutput.setCreateOutputDirectory(true);
defaultOutput.setCleanUpDerivedResources(false);
defaultOutput.setSetDerivedProperty(false);
defaultOutput.setKeepLocalHistory(false);
HashMap<String, OutputConfiguration> outputConfigurations = new HashMap<String, OutputConfiguration>();
outputConfigurations.put(IFileSystemAccess.DEFAULT_OUTPUT, defaultOutput);
access.setOutputConfigurations(outputConfigurations);
return access;
}
}

View File

@ -1,17 +0,0 @@
package com.minres.rdl.ui;
import org.eclipse.xtext.ui.XtextProjectHelper;
import com.minres.rdl.ui.wizard.RDLProjectCreator;
public class JDTFreeStructuralProjectCreator extends RDLProjectCreator {
@Override
protected String[] getProjectNatures() {
return new String[] {XtextProjectHelper.NATURE_ID};
}
@Override
protected String[] getBuilders() {
return new String[] {XtextProjectHelper.BUILDER_ID};
}
}

View File

@ -3,16 +3,15 @@
*/
package com.minres.rdl.ui
import com.minres.structural.ui.hyperlink.MyHyperlinkHelper
import com.minres.structural.ui.hyperlink.MyXtextHyperlink
import org.eclipse.xtend.lib.annotations.FinalFieldsConstructor
import org.eclipse.xtext.ui.editor.hover.IEObjectHoverProvider
import org.eclipse.xtext.documentation.IEObjectDocumentationProvider
import org.eclipse.xtext.ui.wizard.IProjectCreator
import org.eclipse.xtext.ui.editor.hover.IEObjectHoverProvider
import org.eclipse.xtext.ui.editor.hyperlinking.HyperlinkHelper
import org.eclipse.xtext.ui.editor.hyperlinking.XtextHyperlink
import org.eclipse.xtext.ui.resource.IResourceSetProvider
import org.eclipse.xtext.ui.resource.SimpleResourceSetProvider
import org.eclipse.xtext.ui.editor.hyperlinking.HyperlinkHelper
import com.minres.structural.ui.hyperlink.MyHyperlinkHelper
import org.eclipse.xtext.ui.editor.hyperlinking.XtextHyperlink
import com.minres.structural.ui.hyperlink.MyXtextHyperlink
/**
* Use this class to register components to be used within the Eclipse IDE.
@ -28,9 +27,9 @@ class RDLUiModule extends AbstractRDLUiModule {
typeof(RDLEObjectDocumentationProvider);
}
override Class<? extends IProjectCreator> bindIProjectCreator() {
return JDTFreeStructuralProjectCreator;
}
// override Class<? extends IProjectCreator> bindIProjectCreator() {
// return JDTFreeStructuralProjectCreator;
// }
override Class<? extends IResourceSetProvider> bindIResourceSetProvider() {
return SimpleResourceSetProvider

View File

@ -0,0 +1,20 @@
package com.minres.rdl.ui.wizard;
import org.eclipse.osgi.util.NLS;
public class Messages extends NLS {
private static final String BUNDLE_NAME = "com.minres.rdl.ui.wizard.messages"; //$NON-NLS-1$
public static String HelloWorldProject_Label;
public static String HelloWorldProject_Description;
public static String RdlProject_Label;
public static String RdlProject_Description;
static {
// initialize resource bundle
NLS.initializeMessages(BUNDLE_NAME, Messages.class);
}
private Messages() {
}
}

View File

@ -1,26 +0,0 @@
/*
* generated by Xtext 2.14.0
*/
package com.minres.rdl.ui.wizard
import com.google.inject.Inject
import org.eclipse.xtext.generator.IFileSystemAccess2
import org.eclipse.xtext.resource.FileExtensionProvider
class RDLNewProjectWizardInitialContents {
@Inject
FileExtensionProvider fileExtensionProvider
def generateInitialContents(IFileSystemAccess2 fsa) {
fsa.generateFile(
"src/model/Model." + fileExtensionProvider.primaryFileExtension,
'''
/*
* This is an example model
*/
Hello Xtext!
'''
)
}
}

View File

@ -1,10 +0,0 @@
/*
* generated by Xtext 2.14.0
*/
package com.minres.rdl.ui.wizard;
import org.eclipse.xtext.ui.wizard.DefaultProjectInfo;
public class RDLProjectInfo extends DefaultProjectInfo {
}

View File

@ -0,0 +1,81 @@
/*
* generated by Xtext 2.14.0
*/
package com.minres.rdl.ui.wizard
import org.eclipse.xtext.ui.XtextProjectHelper
import org.eclipse.xtext.ui.util.PluginProjectFactory
import org.eclipse.xtext.ui.wizard.template.IProjectGenerator
import org.eclipse.xtext.ui.wizard.template.IProjectTemplateProvider
import org.eclipse.xtext.ui.wizard.template.ProjectTemplate
/**
* Create a list with all project templates to be shown in the template new project wizard.
*
* Each template is able to generate one or more projects. Each project can be configured such that any number of files are included.
*/
class RDLProjectTemplateProvider implements IProjectTemplateProvider {
override getProjectTemplates() {
#[new RdlProject]
}
}
@ProjectTemplate(
label="RDL template",
icon="project_template.png",
description="<p><b>RDL</b></p><p>This is a simple project for RDL.</p>")
final class RdlProject {
// val advanced = check("Advanced:", false)
// val advancedGroup = group("Properties")
// val name = combo("Name:", #["Xtext", "World", "Foo", "Bar"], "The name to say 'Hello' to", advancedGroup)
// val path = text("Package:", "mydsl", "The package path to place the files in", advancedGroup)
//
// override protected updateVariables() {
// name.enabled = advanced.value
// path.enabled = advanced.value
// if (!advanced.value) {
// name.value = "Xtext"
// path.value = "rdl"
// }
// }
//
// override protected validate() {
// if (path.value.matches('[a-z][a-z0-9_]*(/[a-z][a-z0-9_]*)*'))
// null
// else
// new Status(ERROR, "Wizard", "'" + path + "' is not a valid package name")
// }
override generateProjects(IProjectGenerator generator) {
generator.generate(new PluginProjectFactory => [
projectName = projectInfo.projectName
location = projectInfo.locationPath
projectNatures += XtextProjectHelper.NATURE_ID //#[JavaCore.NATURE_ID, "org.eclipse.pde.PluginNature", XtextProjectHelper.NATURE_ID]
builderIds += XtextProjectHelper.BUILDER_ID //JavaCore.BUILDER_ID
folders += "src"
addFile('''src/Model.rdl''', '''
enum ERRSLICE0_MISSIONERR_ENABLE_ERR25_enum{
DISABLE = 1'd0;
ENABLE = 1'd1;
};
addrmap {
name = "foo registers";
desc = "this is a bunch of foo regs bla bla bla";
regfile bar_regs {
name = "bar registers";
desc = "this is a bunch of bar regs bla bla bla";
reg {
field { name="field 1"; sw=rw; hw=rw; we; } fld1[9:0] = 10'd0;
field { name="field 2"; sw=rw; hw=r; } fld2[15:15];
field {encode=ERRSLICE0_MISSIONERR_ENABLE_ERR25_enum; sw=rw; hw=r; reset=1'h1;} ERR25[25:25];
} a_reg[2];
} bar;
} foo;
''')
])
}
}

View File

@ -1,14 +0,0 @@
/*
* generated by Xtext 2.14.0
*/
package com.minres.rdl.ui.wizard;
import org.eclipse.ui.dialogs.WizardNewProjectCreationPage;
public class RDLWizardNewProjectCreationPage extends WizardNewProjectCreationPage {
public RDLWizardNewProjectCreationPage(String pageName) {
super(pageName);
}
}

View File

@ -0,0 +1,4 @@
HelloWorldProject_Label=Hello World
HelloWorldProject_Description=<p><b>Hello World</b></p> <p>This is a parameterized hello world for RDL. You can set a parameter to modify the content in the generated file and a parameter to set the package the file is created in.</p>
RdlProject_Label=RDL template
RdlProject_Description=<p><b>RDL</b></p><p>This is a simple project for RDL.</p>

View File

@ -4,7 +4,6 @@
package com.minres.rdl.ui;
import com.minres.rdl.ui.AbstractRDLUiModule;
import com.minres.rdl.ui.JDTFreeStructuralProjectCreator;
import com.minres.rdl.ui.RDLEObjectDocumentationProvider;
import com.minres.rdl.ui.RDLEObjectHoverProvider;
import com.minres.structural.ui.hyperlink.MyHyperlinkHelper;
@ -17,7 +16,6 @@ import org.eclipse.xtext.ui.editor.hyperlinking.HyperlinkHelper;
import org.eclipse.xtext.ui.editor.hyperlinking.XtextHyperlink;
import org.eclipse.xtext.ui.resource.IResourceSetProvider;
import org.eclipse.xtext.ui.resource.SimpleResourceSetProvider;
import org.eclipse.xtext.ui.wizard.IProjectCreator;
/**
* Use this class to register components to be used within the Eclipse IDE.
@ -33,11 +31,6 @@ public class RDLUiModule extends AbstractRDLUiModule {
return RDLEObjectDocumentationProvider.class;
}
@Override
public Class<? extends IProjectCreator> bindIProjectCreator() {
return JDTFreeStructuralProjectCreator.class;
}
@Override
public Class<? extends IResourceSetProvider> bindIResourceSetProvider() {
return SimpleResourceSetProvider.class;
@ -51,7 +44,7 @@ public class RDLUiModule extends AbstractRDLUiModule {
return MyXtextHyperlink.class;
}
public RDLUiModule(final AbstractUIPlugin arg0) {
super(arg0);
public RDLUiModule(final AbstractUIPlugin plugin) {
super(plugin);
}
}

View File

@ -1,32 +0,0 @@
/**
* generated by Xtext 2.14.0
*/
package com.minres.rdl.ui.wizard;
import com.google.inject.Inject;
import org.eclipse.xtend2.lib.StringConcatenation;
import org.eclipse.xtext.generator.IFileSystemAccess2;
import org.eclipse.xtext.resource.FileExtensionProvider;
@SuppressWarnings("all")
public class RDLNewProjectWizardInitialContents {
@Inject
private FileExtensionProvider fileExtensionProvider;
public void generateInitialContents(final IFileSystemAccess2 fsa) {
String _primaryFileExtension = this.fileExtensionProvider.getPrimaryFileExtension();
String _plus = ("src/model/Model." + _primaryFileExtension);
StringConcatenation _builder = new StringConcatenation();
_builder.append("/*");
_builder.newLine();
_builder.append(" ");
_builder.append("* This is an example model");
_builder.newLine();
_builder.append(" ");
_builder.append("*/");
_builder.newLine();
_builder.append("Hello Xtext!");
_builder.newLine();
fsa.generateFile(_plus, _builder);
}
}

View File

@ -0,0 +1,22 @@
/**
* generated by Xtext 2.14.0
*/
package com.minres.rdl.ui.wizard;
import com.minres.rdl.ui.wizard.RdlProject;
import org.eclipse.xtext.ui.wizard.template.AbstractProjectTemplate;
import org.eclipse.xtext.ui.wizard.template.IProjectTemplateProvider;
/**
* Create a list with all project templates to be shown in the template new project wizard.
*
* Each template is able to generate one or more projects. Each project can be configured such that any number of files are included.
*/
@SuppressWarnings("all")
public class RDLProjectTemplateProvider implements IProjectTemplateProvider {
@Override
public AbstractProjectTemplate[] getProjectTemplates() {
RdlProject _rdlProject = new RdlProject();
return new AbstractProjectTemplate[] { _rdlProject };
}
}

View File

@ -0,0 +1,94 @@
/**
* generated by Xtext 2.14.0
*/
package com.minres.rdl.ui.wizard;
import java.util.List;
import org.eclipse.xtend2.lib.StringConcatenation;
import org.eclipse.xtext.ui.XtextProjectHelper;
import org.eclipse.xtext.ui.util.PluginProjectFactory;
import org.eclipse.xtext.ui.wizard.template.AbstractProjectTemplate;
import org.eclipse.xtext.ui.wizard.template.IProjectGenerator;
import org.eclipse.xtext.ui.wizard.template.ProjectTemplate;
import org.eclipse.xtext.xbase.lib.ObjectExtensions;
import org.eclipse.xtext.xbase.lib.Procedures.Procedure1;
@ProjectTemplate(label = "RDL template", icon = "project_template.png", description = "<p><b>RDL</b></p><p>This is a simple project for RDL.</p>")
@SuppressWarnings("all")
public final class RdlProject extends AbstractProjectTemplate {
@Override
public void generateProjects(final IProjectGenerator generator) {
PluginProjectFactory _pluginProjectFactory = new PluginProjectFactory();
final Procedure1<PluginProjectFactory> _function = (PluginProjectFactory it) -> {
it.setProjectName(this.getProjectInfo().getProjectName());
it.setLocation(this.getProjectInfo().getLocationPath());
List<String> _projectNatures = it.getProjectNatures();
_projectNatures.add(XtextProjectHelper.NATURE_ID);
List<String> _builderIds = it.getBuilderIds();
_builderIds.add(XtextProjectHelper.BUILDER_ID);
List<String> _folders = it.getFolders();
_folders.add("src");
StringConcatenation _builder = new StringConcatenation();
_builder.append("src/Model.rdl");
StringConcatenation _builder_1 = new StringConcatenation();
_builder_1.append("enum ERRSLICE0_MISSIONERR_ENABLE_ERR25_enum{");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append("DISABLE = 1\'d0;");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append("ENABLE = 1\'d1;");
_builder_1.newLine();
_builder_1.append("};");
_builder_1.newLine();
_builder_1.append("addrmap {");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append("name = \"foo registers\";");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append("desc = \"this is a bunch of foo regs bla bla bla\";");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append("regfile bar_regs {");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append("name = \"bar registers\";");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append("desc = \"this is a bunch of bar regs bla bla bla\";");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.newLine();
_builder_1.append("\t ");
_builder_1.append("reg {");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append("field { name=\"field 1\"; sw=rw; hw=rw; we; } fld1[9:0] = 10\'d0;");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append("field { name=\"field 2\"; sw=rw; hw=r; } fld2[15:15];");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append("field {encode=ERRSLICE0_MISSIONERR_ENABLE_ERR25_enum; sw=rw; hw=r; reset=1\'h1;} ERR25[25:25];");
_builder_1.newLine();
_builder_1.append("\t ");
_builder_1.append("} a_reg[2];\t ");
_builder_1.newLine();
_builder_1.append("\t ");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append("} bar;");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.newLine();
_builder_1.append("} foo;");
_builder_1.newLine();
this.addFile(it, _builder, _builder_1);
};
PluginProjectFactory _doubleArrow = ObjectExtensions.<PluginProjectFactory>operator_doubleArrow(_pluginProjectFactory, _function);
generator.generate(_doubleArrow);
}
}

View File

@ -3,7 +3,7 @@ Automatic-Module-Name: com.minres.rdl
Bundle-ManifestVersion: 2
Bundle-Name: com.minres.rdl
Bundle-Vendor: MINRES Technologies GmbH
Bundle-Version: 1.1.0.qualifier
Bundle-Version: 1.1.1.qualifier
Bundle-SymbolicName: com.minres.rdl; singleton:=true
Bundle-ActivationPolicy: lazy
Require-Bundle: org.eclipse.xtext,
@ -28,5 +28,6 @@ Export-Package: com.minres.rdl,
com.minres.rdl.scoping,
com.minres.rdl.serializer,
com.minres.rdl.services,
com.minres.rdl.validation
com.minres.rdl.validation,
com.minres.rdl.formatting2
Import-Package: org.apache.log4j

View File

@ -3,7 +3,7 @@
xmlns:genmodel="http://www.eclipse.org/emf/2002/GenModel" copyrightText="generated by Xtext 2.14.0" modelDirectory="/com.minres.rdl/src-gen"
modelPluginID="com.minres.rdl" forceOverwrite="true" modelName="RDL" updateClasspath="false"
rootExtendsClass="org.eclipse.emf.ecore.impl.MinimalEObjectImpl$Container" complianceLevel="6.0"
copyrightFields="false" runtimeVersion="2.12">
copyrightFields="false" runtimeVersion="2.14">
<genPackages prefix="Rdl" basePackage="com.minres.rdl" disposableProviderFactory="true"
fileExtensions="rdl" ecorePackage="RDL.ecore#/">
<genEnums typeSafeEnumCompatible="false" ecoreEnum="RDL.ecore#//PropertyTypeName">

View File

@ -152,5 +152,5 @@
</pluginManagement>
</build>
<version>1.1.0-SNAPSHOT</version>
<version>1.1.1-SNAPSHOT</version>
</project>

View File

@ -6,6 +6,7 @@ package com.minres.rdl;
import com.google.inject.Binder;
import com.google.inject.Provider;
import com.google.inject.name.Names;
import com.minres.rdl.formatting2.RDLFormatter;
import com.minres.rdl.generator.RDLGenerator;
import com.minres.rdl.parser.antlr.RDLAntlrTokenFileProvider;
import com.minres.rdl.parser.antlr.RDLParser;
@ -19,6 +20,9 @@ import com.minres.rdl.validation.RDLValidator;
import java.util.Properties;
import org.eclipse.xtext.Constants;
import org.eclipse.xtext.IGrammarAccess;
import org.eclipse.xtext.formatting2.FormatterPreferenceValuesProvider;
import org.eclipse.xtext.formatting2.FormatterPreferences;
import org.eclipse.xtext.formatting2.IFormatter2;
import org.eclipse.xtext.generator.IGenerator2;
import org.eclipse.xtext.naming.IQualifiedNameProvider;
import org.eclipse.xtext.naming.SimpleNameProvider;
@ -31,6 +35,7 @@ import org.eclipse.xtext.parser.antlr.ITokenDefProvider;
import org.eclipse.xtext.parser.antlr.Lexer;
import org.eclipse.xtext.parser.antlr.LexerBindings;
import org.eclipse.xtext.parser.antlr.LexerProvider;
import org.eclipse.xtext.preferences.IPreferenceValuesProvider;
import org.eclipse.xtext.resource.IContainer;
import org.eclipse.xtext.resource.IResourceDescriptions;
import org.eclipse.xtext.resource.containers.IAllContainersState;
@ -193,6 +198,16 @@ public abstract class AbstractRDLRuntimeModule extends DefaultRuntimeModule {
return RDLGenerator.class;
}
// contributed by org.eclipse.xtext.xtext.generator.formatting.Formatter2Fragment2
public Class<? extends IFormatter2> bindIFormatter2() {
return RDLFormatter.class;
}
// contributed by org.eclipse.xtext.xtext.generator.formatting.Formatter2Fragment2
public void configureFormatterPreferences(Binder binder) {
binder.bind(IPreferenceValuesProvider.class).annotatedWith(FormatterPreferences.class).to(FormatterPreferenceValuesProvider.class);
}
// contributed by org.eclipse.xtext.xtext.generator.exporting.SimpleNamesFragment2
public Class<? extends IQualifiedNameProvider> bindIQualifiedNameProvider() {
return SimpleNameProvider.class;

View File

@ -402,7 +402,7 @@ public class ComponentDefinitionImpl extends MinimalEObjectImpl.Container implem
{
if (eIsProxy()) return super.toString();
StringBuffer result = new StringBuffer(super.toString());
StringBuilder result = new StringBuilder(super.toString());
result.append(" (type: ");
result.append(type);
result.append(", name: ");

View File

@ -417,7 +417,7 @@ public class ComponentInstanceImpl extends EntityImpl implements ComponentInstan
{
if (eIsProxy()) return super.toString();
StringBuffer result = new StringBuffer(super.toString());
StringBuilder result = new StringBuilder(super.toString());
result.append(" (reset: ");
result.append(reset);
result.append(", address: ");

View File

@ -256,7 +256,7 @@ public class ConcatElemImpl extends MinimalEObjectImpl.Container implements Conc
{
if (eIsProxy()) return super.toString();
StringBuffer result = new StringBuffer(super.toString());
StringBuilder result = new StringBuilder(super.toString());
result.append(" (value: ");
result.append(value);
result.append(')');

View File

@ -168,7 +168,7 @@ public class EntityImpl extends MinimalEObjectImpl.Container implements Entity
{
if (eIsProxy()) return super.toString();
StringBuffer result = new StringBuffer(super.toString());
StringBuilder result = new StringBuilder(super.toString());
result.append(" (name: ");
result.append(name);
result.append(')');

View File

@ -285,7 +285,7 @@ public class EnumEntryImpl extends MinimalEObjectImpl.Container implements EnumE
{
if (eIsProxy()) return super.toString();
StringBuffer result = new StringBuffer(super.toString());
StringBuilder result = new StringBuilder(super.toString());
result.append(" (name: ");
result.append(name);
result.append(", index: ");

View File

@ -222,7 +222,7 @@ public class EnumInstanceTypeImpl extends MinimalEObjectImpl.Container implement
{
if (eIsProxy()) return super.toString();
StringBuffer result = new StringBuffer(super.toString());
StringBuilder result = new StringBuilder(super.toString());
result.append(" (EXTERNAL: ");
result.append(external);
result.append(", INTERNAL: ");

View File

@ -222,7 +222,7 @@ public class EnumPropertyImpl extends MinimalEObjectImpl.Container implements En
{
if (eIsProxy()) return super.toString();
StringBuffer result = new StringBuffer(super.toString());
StringBuilder result = new StringBuilder(super.toString());
result.append(" (name: ");
result.append(name);
result.append(", value: ");

View File

@ -311,7 +311,7 @@ public class ExplicitPropertyAssignmentImpl extends PropertyAssignmentImpl imple
{
if (eIsProxy()) return super.toString();
StringBuffer result = new StringBuffer(super.toString());
StringBuilder result = new StringBuilder(super.toString());
result.append(" (modifier: ");
result.append(modifier);
result.append(", name: ");

View File

@ -168,7 +168,7 @@ public class IncludeImpl extends MinimalEObjectImpl.Container implements Include
{
if (eIsProxy()) return super.toString();
StringBuffer result = new StringBuffer(super.toString());
StringBuilder result = new StringBuilder(super.toString());
result.append(" (importURI: ");
result.append(importURI);
result.append(')');

View File

@ -323,7 +323,7 @@ public class InstancePropertyRefImpl extends MinimalEObjectImpl.Container implem
{
if (eIsProxy()) return super.toString();
StringBuffer result = new StringBuffer(super.toString());
StringBuilder result = new StringBuilder(super.toString());
result.append(" (propertyEnum: ");
result.append(propertyEnum);
result.append(')');

View File

@ -440,7 +440,7 @@ public class InstantiationImpl extends MinimalEObjectImpl.Container implements I
{
if (eIsProxy()) return super.toString();
StringBuffer result = new StringBuffer(super.toString());
StringBuilder result = new StringBuilder(super.toString());
result.append(" (alias: ");
result.append(alias);
result.append(')');

View File

@ -394,7 +394,7 @@ public class PostPropertyAssignmentImpl extends PropertyAssignmentImpl implement
{
if (eIsProxy()) return super.toString();
StringBuffer result = new StringBuffer(super.toString());
StringBuilder result = new StringBuilder(super.toString());
result.append(" (propertyEnum: ");
result.append(propertyEnum);
result.append(')');

View File

@ -222,7 +222,7 @@ public class PropertyDefaultImpl extends MinimalEObjectImpl.Container implements
{
if (eIsProxy()) return super.toString();
StringBuffer result = new StringBuffer(super.toString());
StringBuilder result = new StringBuilder(super.toString());
result.append(" (string: ");
result.append(string);
result.append(", value: ");

View File

@ -328,7 +328,7 @@ public class PropertyDefinitionImpl extends EntityImpl implements PropertyDefini
{
if (eIsProxy()) return super.toString();
StringBuffer result = new StringBuffer(super.toString());
StringBuilder result = new StringBuilder(super.toString());
result.append(" (type: ");
result.append(type);
result.append(')');

View File

@ -155,7 +155,7 @@ public class PropertyUsageImpl extends MinimalEObjectImpl.Container implements P
{
if (eIsProxy()) return super.toString();
StringBuffer result = new StringBuffer(super.toString());
StringBuilder result = new StringBuilder(super.toString());
result.append(" (components: ");
result.append(components);
result.append(')');

View File

@ -277,7 +277,7 @@ public class RValueImpl extends MinimalEObjectImpl.Container implements RValue
{
if (eIsProxy()) return super.toString();
StringBuffer result = new StringBuffer(super.toString());
StringBuilder result = new StringBuilder(super.toString());
result.append(" (val: ");
result.append(val);
result.append(", num: ");

View File

@ -276,7 +276,7 @@ public class RangeImpl extends MinimalEObjectImpl.Container implements Range
{
if (eIsProxy()) return super.toString();
StringBuffer result = new StringBuffer(super.toString());
StringBuilder result = new StringBuilder(super.toString());
result.append(" (left: ");
result.append(left);
result.append(", right: ");

View File

@ -299,7 +299,7 @@ public class RdlPackageImpl extends EPackageImpl implements RdlPackage
/**
* Creates, registers, and initializes the <b>Package</b> for this model, and for any others upon which it depends.
*
*
* <p>This method is used to initialize {@link RdlPackage#eINSTANCE} when that field is accessed.
* Clients should not invoke it directly. Instead, they should simply access that field to obtain the package.
* <!-- begin-user-doc -->
@ -314,7 +314,8 @@ public class RdlPackageImpl extends EPackageImpl implements RdlPackage
if (isInited) return (RdlPackage)EPackage.Registry.INSTANCE.getEPackage(RdlPackage.eNS_URI);
// Obtain or create and register package
RdlPackageImpl theRdlPackage = (RdlPackageImpl)(EPackage.Registry.INSTANCE.get(eNS_URI) instanceof RdlPackageImpl ? EPackage.Registry.INSTANCE.get(eNS_URI) : new RdlPackageImpl());
Object registeredRdlPackage = EPackage.Registry.INSTANCE.get(eNS_URI);
RdlPackageImpl theRdlPackage = registeredRdlPackage instanceof RdlPackageImpl ? (RdlPackageImpl)registeredRdlPackage : new RdlPackageImpl();
isInited = true;
@ -327,7 +328,6 @@ public class RdlPackageImpl extends EPackageImpl implements RdlPackage
// Mark meta-data to indicate it can't be changed
theRdlPackage.freeze();
// Update the registry and return the package
EPackage.Registry.INSTANCE.put(RdlPackage.eNS_URI, theRdlPackage);
return theRdlPackage;

View File

@ -7,7 +7,10 @@ import java.util.ArrayList;
import java.util.List;
import org.eclipse.emf.ecore.EPackage;
import org.eclipse.xtext.validation.AbstractDeclarativeValidator;
import org.eclipse.xtext.validation.ComposedChecks;
import org.eclipse.xtext.validation.ImportUriValidator;
@ComposedChecks(validators = {ImportUriValidator.class})
public abstract class AbstractRDLValidator extends AbstractDeclarativeValidator {
@Override

View File

@ -43,16 +43,25 @@ Workflow {
backtrack = true
}
}
formatter = {
generateStub = true
}
serializer = {
generateStub = false
}
validator = {
// composedCheck = "org.eclipse.xtext.validation.NamesAreUniqueValidator"
composedCheck = "org.eclipse.xtext.validation.ImportUriValidator"
}
generator = {
generateXtendMain = true
}
newProjectWizardForEclipse = {
projectWizard = {
generate = true
}
}

View File

@ -0,0 +1,157 @@
package com.minres.rdl
import com.minres.rdl.rdl.ComponentInstance
import com.minres.rdl.rdl.ComponentDefinition
import com.minres.rdl.rdl.ExplicitPropertyAssignment
import com.minres.rdl.rdl.PropertyAssignment
import com.minres.rdl.rdl.Instantiation
import com.minres.rdl.rdl.ComponentDefinitionType
import com.minres.rdl.rdl.PropertyEnum
import com.minres.rdl.rdl.PropertyAssignmentRhs
import com.minres.rdl.rdl.RValue
import com.minres.rdl.rdl.RValueConstant
import com.minres.rdl.rdl.InstancePropertyRef
class RdlUtil {
static def IntegerWithRadix addressValue(ComponentInstance instance) {
if (instance.address !== null)
return instance.address as IntegerWithRadix
else
return new IntegerWithRadix(0)
}
def long accessWidth(ComponentDefinition definition){
var size = 32L
val pa = definition.propertyAssignments.findFirst[PropertyAssignment pa |
pa instanceof ExplicitPropertyAssignment && (pa as ExplicitPropertyAssignment).name==PropertyEnum.ACCESSWIDTH
]
if(pa !== null){
val sz = new IntegerWithRadix((pa as ExplicitPropertyAssignment).rhs.effectiveValue)
size=sz.value
}
return size
}
static def long regWidth(ComponentDefinition definition){
var size = 32L
val pa = definition.propertyAssignments.findFirst[PropertyAssignment pa |
pa instanceof ExplicitPropertyAssignment && (pa as ExplicitPropertyAssignment).name==PropertyEnum.REGWIDTH
]
if(pa !== null){
val sz = new IntegerWithRadix((pa as ExplicitPropertyAssignment).rhs.effectiveValue)
size=sz.value
}
return size
}
static def long getSize(Instantiation instantiation){
val componentDef= instantiation.definingComponent
switch (componentDef.type) {
case ComponentDefinitionType.REG: {
val pa = componentDef.propertyAssignments.findFirst[PropertyAssignment pa |
pa instanceof ExplicitPropertyAssignment && (pa as ExplicitPropertyAssignment).name==PropertyEnum.REGWIDTH
]
if(pa !== null){
val sz = new IntegerWithRadix((pa as ExplicitPropertyAssignment).rhs.effectiveValue)
return sz.value
}
return 32L
}
case ComponentDefinitionType.FIELD:{
val pa = componentDef.propertyAssignments.findFirst[PropertyAssignment pa |
pa instanceof ExplicitPropertyAssignment && (pa as ExplicitPropertyAssignment).name==PropertyEnum.FIELDWIDTH
]
if(pa !== null){
val sz = new IntegerWithRadix((pa as ExplicitPropertyAssignment).rhs.effectiveValue)
return sz.value
}
return 1L
}
default: {
return 0L;
}
}
}
static def String effectiveName(ComponentDefinition definition){
if(definition.name!==null){
return definition.name.replaceAll('\\s+', '_')
} else{
val pa = definition.propertyAssignments.findFirst[PropertyAssignment pa |
pa instanceof ExplicitPropertyAssignment && (pa as ExplicitPropertyAssignment).name==PropertyEnum.NAME
]
if(pa !== null)
return (pa as ExplicitPropertyAssignment).rhs.effectiveValue.replaceAll('\\s+', '_')
else
return ('unnamed_'+definition.type).replaceAll('\\s+', '_')
}
}
static def String effectiveValue(PropertyAssignmentRhs rhs){
if(rhs.value!== null)
rhs.value.effectiveValue
else if(rhs.instPropRef!==null)
rhs.instPropRef.effectiveValue
else if(rhs.enumRef!==null)
rhs.enumRef.name
}
static def String effectiveValue(RValue rvalue){
if(rvalue.str!==null){
rvalue.str
} else if(rvalue.^val!=RValueConstant.UNDEFINED)
rvalue.^val.literal
else if(rvalue.num!==null){
val num = rvalue.num as IntegerWithRadix
num.toString
}
}
static def String effectiveValue(InstancePropertyRef ref){
throw new RuntimeException()
}
static def ComponentDefinition definingComponent(Instantiation instantiation){
if(instantiation.componentRef!==null) instantiation.componentRef else instantiation.component
}
static def int instanceCount(ComponentDefinition definition, ComponentDefinitionType type){
definition.instantiationsOfType(type).map[it.componentInstances.size].reduce[p1, p2| p1+p2]
}
static def instantiationsOfType(ComponentDefinition definition, ComponentDefinitionType type){
definition.instantiations.filter[it.definingComponent.type == type]
}
static def long byteSize(Instantiation instantiation, long start){
val componentDefinition = instantiation.definingComponent
var long componentSize=0;
if(instantiation.definingComponent.type == ComponentDefinitionType.REG){
componentSize=instantiation.definingComponent.regWidth/8
} else
for(subInstantiation: componentDefinition.instantiations)
componentSize = subInstantiation.byteSize(componentSize)
var long lastTopAddress = start
var long topAddress=start
for(componentInstance: instantiation.componentInstances ){
val byteSize = if(componentInstance.address !== null) (componentInstance.address as IntegerWithRadix).value+componentSize else componentSize + lastTopAddress
topAddress = Math.max(topAddress, byteSize)
lastTopAddress = byteSize
}
return topAddress
}
static def long byteSize(Instantiation instantiation){
val componentDefinition = instantiation.definingComponent
var long componentSize=0;
if(instantiation.definingComponent.type == ComponentDefinitionType.REG){
componentSize=instantiation.definingComponent.regWidth/8
} else
for(subInstantiation: componentDefinition.instantiations)
componentSize = subInstantiation.byteSize(componentSize)
return componentSize
}
}

View File

@ -0,0 +1,44 @@
/*
* generated by Xtext 2.14.0
*/
package com.minres.rdl.formatting2
import com.minres.rdl.rdl.PropertyDefinition
import com.minres.rdl.rdl.Root
import org.eclipse.xtext.formatting2.AbstractFormatter2
import org.eclipse.xtext.formatting2.IFormattableDocument
class RDLFormatter extends AbstractFormatter2 {
//@Inject extension RDLGrammarAccess
def dispatch void format(Root root, extension IFormattableDocument document) {
// TODO: format HiddenRegions around keywords, attributes, cross references, etc.
for (include : root.includes) {
include.format
}
for (componentDefinition : root.componentDefinitions) {
componentDefinition.format
}
for (enumDefinition : root.enumDefinitions) {
enumDefinition.format
}
for (instantiation : root.instantiations) {
instantiation.format
}
for (propertyAssignment : root.propertyAssignments) {
propertyAssignment.format
}
for (propertyDefinition : root.propertyDefinitions) {
propertyDefinition.format
}
}
def dispatch void format(PropertyDefinition propertyDefinition, extension IFormattableDocument document) {
// TODO: format HiddenRegions around keywords, attributes, cross references, etc.
propertyDefinition.usage.format
propertyDefinition.^default.format
}
// TODO: implement for ComponentDefinition, Instantiation, ComponentInstance, ExplicitPropertyAssignment, PostPropertyAssignment, InstancePropertyRef, InstanceRef, PropertyAssignmentRhs, Concat, ConcatElem, EnumDefinition, EnumBody, EnumEntry
}

View File

@ -4,6 +4,10 @@ import com.minres.rdl.generator.RdlBaseGenerator
import com.minres.rdl.rdl.ComponentDefinition
import com.minres.rdl.IntegerWithRadix
import com.minres.rdl.rdl.ComponentDefinitionType
import com.minres.rdl.rdl.ComponentInstance
import com.minres.rdl.rdl.Instantiation
import static extension com.minres.rdl.RdlUtil.*
class AddrmapGenerator extends RdlBaseGenerator {
@ -14,21 +18,21 @@ class AddrmapGenerator extends RdlBaseGenerator {
}
override generateHeader() {'''
#ifndef _E300_PLAT_MAP_H_
#define _E300_PLAT_MAP_H_
#ifndef _«componentDefinition.effectiveName.toUpperCase»_MAP_H_
#define _«componentDefinition.effectiveName.toUpperCase»_MAP_H_
// need double braces, see https://stackoverflow.com/questions/6893700/how-to-construct-stdarray-object-with-initializer-list#6894191
const std::array<sysc::target_memory_map_entry<32>, «componentDefinition.instanceCount(ComponentDefinitionType.REGFILE)»> e300_plat_map = {{
const std::array<sysc::target_memory_map_entry<32>, «componentDefinition.instanceCount(ComponentDefinitionType.REGFILE)»> «componentDefinition.effectiveName»_map = {{
«FOR instantiation : componentDefinition.instantiationsOfType(ComponentDefinitionType.REGFILE)»
«FOR instance : instantiation.componentInstances»
{&i_«instance.name», 0x«Long.toHexString((instance.address as IntegerWithRadix).value)», 0x«Long.toHexString(instantiation.byteSize)»},
{&i_«instance.name», «instance.addressValue», 0x«Long.toHexString(instantiation.byteSize)»},
«ENDFOR»
«ENDFOR»
}};
#endif /* _E300_PLAT_MAP_H_ */
#endif /* _«componentDefinition.effectiveName.toUpperCase»_MAP_H_ */
'''
}
override generateSource() {
''
}

View File

@ -9,6 +9,7 @@ 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 static extension com.minres.rdl.RdlUtil.*
/**
* Generates code from your model files on save.
@ -22,13 +23,13 @@ class RDLGenerator extends AbstractGenerator {
val gen = it.fileGenerator
if(gen!==null){
val header = gen.generateHeader
if(header!==null && header.length>0) fsa.generateFile(it.name+'.h', fsa.outputConfig('incl-out'), header)
if(header!==null && header.length>0) fsa.generateFile(it.effectiveName+'.h', fsa.outputConfig('incl-out'), header)
val source = gen.generateSource
if(source!==null && source.length>0) fsa.generateFile(it.name+'.cpp', fsa.outputConfig('src-out'), source)
if(source!==null && source.length>0) fsa.generateFile(it.effectiveName+'.cpp', fsa.outputConfig('src-out'), source)
}
]
}
def RdlBaseGenerator fileGenerator(ComponentDefinition definition){
switch(definition.type){
case ComponentDefinitionType.REGFILE: new RegfileGenerator(definition)

View File

@ -13,138 +13,7 @@ import com.minres.rdl.rdl.InstancePropertyRef
import com.minres.rdl.rdl.ComponentDefinitionType
abstract class RdlBaseGenerator {
def long accessWidth(ComponentDefinition definition){
var size = 32L
val pa = definition.propertyAssignments.findFirst[PropertyAssignment pa |
pa instanceof ExplicitPropertyAssignment && (pa as ExplicitPropertyAssignment).name==PropertyEnum.ACCESSWIDTH
]
if(pa !== null){
val sz = new IntegerWithRadix((pa as ExplicitPropertyAssignment).rhs.effectiveValue)
size=sz.value
}
return size
}
def long regWidth(ComponentDefinition definition){
var size = 32L
val pa = definition.propertyAssignments.findFirst[PropertyAssignment pa |
pa instanceof ExplicitPropertyAssignment && (pa as ExplicitPropertyAssignment).name==PropertyEnum.REGWIDTH
]
if(pa !== null){
val sz = new IntegerWithRadix((pa as ExplicitPropertyAssignment).rhs.effectiveValue)
size=sz.value
}
return size
}
def long getSize(Instantiation instantiation){
val componentDef= instantiation.definingComponent
switch (componentDef.type) {
case ComponentDefinitionType.REG: {
val pa = componentDef.propertyAssignments.findFirst[PropertyAssignment pa |
pa instanceof ExplicitPropertyAssignment && (pa as ExplicitPropertyAssignment).name==PropertyEnum.REGWIDTH
]
if(pa !== null){
val sz = new IntegerWithRadix((pa as ExplicitPropertyAssignment).rhs.effectiveValue)
return sz.value
}
return 32L
}
case ComponentDefinitionType.FIELD:{
val pa = componentDef.propertyAssignments.findFirst[PropertyAssignment pa |
pa instanceof ExplicitPropertyAssignment && (pa as ExplicitPropertyAssignment).name==PropertyEnum.FIELDWIDTH
]
if(pa !== null){
val sz = new IntegerWithRadix((pa as ExplicitPropertyAssignment).rhs.effectiveValue)
return sz.value
}
return 1L
}
default: {
return 0L;
}
}
}
def String effectiveName(ComponentDefinition definition){
if(definition.name!==null){
definition.name
} else{
val pa = definition.propertyAssignments.findFirst[PropertyAssignment pa |
pa instanceof ExplicitPropertyAssignment && (pa as ExplicitPropertyAssignment).name==PropertyEnum.NAME
]
(pa as ExplicitPropertyAssignment).rhs.effectiveValue
}
}
def String effectiveValue(PropertyAssignmentRhs rhs){
if(rhs.value!== null)
rhs.value.effectiveValue
else if(rhs.instPropRef!==null)
rhs.instPropRef.effectiveValue
else if(rhs.enumRef!==null)
rhs.enumRef.name
}
def String effectiveValue(RValue rvalue){
if(rvalue.str!==null){
rvalue.str
} else if(rvalue.^val!=RValueConstant.UNDEFINED)
rvalue.^val.literal
else if(rvalue.num!==null){
val num = rvalue.num as IntegerWithRadix
num.toString
}
}
def String effectiveValue(InstancePropertyRef ref){
throw new RuntimeException()
}
def ComponentDefinition definingComponent(Instantiation instantiation){
if(instantiation.componentRef!==null) instantiation.componentRef else instantiation.component
}
def int instanceCount(ComponentDefinition definition, ComponentDefinitionType type){
definition.instantiationsOfType(type).map[it.componentInstances.size].reduce[p1, p2| p1+p2]
}
def instantiationsOfType(ComponentDefinition definition, ComponentDefinitionType type){
definition.instantiations.filter[it.definingComponent.type == type]
}
def long byteSize(Instantiation instantiation, long start){
val componentDefinition = instantiation.definingComponent
var long componentSize=0;
if(instantiation.definingComponent.type == ComponentDefinitionType.REG){
componentSize=instantiation.definingComponent.regWidth/8
} else
for(subInstantiation: componentDefinition.instantiations)
componentSize = subInstantiation.byteSize(componentSize)
var long lastTopAddress = start
var long topAddress=start
for(componentInstance: instantiation.componentInstances ){
val byteSize = if(componentInstance.address !== null) (componentInstance.address as IntegerWithRadix).value+componentSize else componentSize + lastTopAddress
topAddress = Math.max(topAddress, byteSize)
lastTopAddress = byteSize
}
return topAddress
}
def long byteSize(Instantiation instantiation){
val componentDefinition = instantiation.definingComponent
var long componentSize=0;
if(instantiation.definingComponent.type == ComponentDefinitionType.REG){
componentSize=instantiation.definingComponent.regWidth/8
} else
for(subInstantiation: componentDefinition.instantiations)
componentSize = subInstantiation.byteSize(componentSize)
return componentSize
}
def String generateHeader()
def String generateSource()

View File

@ -8,6 +8,8 @@ import com.minres.rdl.rdl.Instantiation
import java.util.Date
import com.minres.rdl.rdl.Range
import static extension com.minres.rdl.RdlUtil.*
class RegfileGenerator extends RdlBaseGenerator{
val ComponentDefinition componentDefinition
@ -145,7 +147,7 @@ class RegfileGenerator extends RdlBaseGenerator{
inline void sysc::«componentDefinition.name»::registerResources(sysc::tlm_target<BUSWIDTH>& target) {
«FOR instantiation : componentDefinition.instantiations»
«FOR instance : instantiation.componentInstances»
target.addResource(«instance.name», 0x«Long.toHexString((instance.address as IntegerWithRadix).value)»UL);
target.addResource(«instance.name», «instance.addressValue»UL);
«ENDFOR»
«ENDFOR»
}

View File

@ -0,0 +1,263 @@
package com.minres.rdl;
import com.google.common.base.Objects;
import com.minres.rdl.IntegerWithRadix;
import com.minres.rdl.rdl.ComponentDefinition;
import com.minres.rdl.rdl.ComponentDefinitionType;
import com.minres.rdl.rdl.ComponentInstance;
import com.minres.rdl.rdl.EnumDefinition;
import com.minres.rdl.rdl.ExplicitPropertyAssignment;
import com.minres.rdl.rdl.InstancePropertyRef;
import com.minres.rdl.rdl.Instantiation;
import com.minres.rdl.rdl.PropertyAssignment;
import com.minres.rdl.rdl.PropertyAssignmentRhs;
import com.minres.rdl.rdl.PropertyEnum;
import com.minres.rdl.rdl.RValue;
import com.minres.rdl.rdl.RValueConstant;
import org.eclipse.emf.common.util.EList;
import org.eclipse.xtext.xbase.lib.Functions.Function1;
import org.eclipse.xtext.xbase.lib.Functions.Function2;
import org.eclipse.xtext.xbase.lib.IterableExtensions;
@SuppressWarnings("all")
public class RdlUtil {
public static IntegerWithRadix addressValue(final ComponentInstance instance) {
Object _address = instance.getAddress();
boolean _tripleNotEquals = (_address != null);
if (_tripleNotEquals) {
Object _address_1 = instance.getAddress();
return ((IntegerWithRadix) _address_1);
} else {
return new IntegerWithRadix(Integer.valueOf(0));
}
}
public long accessWidth(final ComponentDefinition definition) {
long size = 32L;
final Function1<PropertyAssignment, Boolean> _function = (PropertyAssignment pa) -> {
return Boolean.valueOf(((pa instanceof ExplicitPropertyAssignment) && Objects.equal(((ExplicitPropertyAssignment) pa).getName(), PropertyEnum.ACCESSWIDTH)));
};
final PropertyAssignment pa = IterableExtensions.<PropertyAssignment>findFirst(definition.getPropertyAssignments(), _function);
if ((pa != null)) {
String _effectiveValue = RdlUtil.effectiveValue(((ExplicitPropertyAssignment) pa).getRhs());
final IntegerWithRadix sz = new IntegerWithRadix(_effectiveValue);
size = sz.value;
}
return size;
}
public static long regWidth(final ComponentDefinition definition) {
long size = 32L;
final Function1<PropertyAssignment, Boolean> _function = (PropertyAssignment pa) -> {
return Boolean.valueOf(((pa instanceof ExplicitPropertyAssignment) && Objects.equal(((ExplicitPropertyAssignment) pa).getName(), PropertyEnum.REGWIDTH)));
};
final PropertyAssignment pa = IterableExtensions.<PropertyAssignment>findFirst(definition.getPropertyAssignments(), _function);
if ((pa != null)) {
String _effectiveValue = RdlUtil.effectiveValue(((ExplicitPropertyAssignment) pa).getRhs());
final IntegerWithRadix sz = new IntegerWithRadix(_effectiveValue);
size = sz.value;
}
return size;
}
public static long getSize(final Instantiation instantiation) {
final ComponentDefinition componentDef = RdlUtil.definingComponent(instantiation);
ComponentDefinitionType _type = componentDef.getType();
if (_type != null) {
switch (_type) {
case REG:
final Function1<PropertyAssignment, Boolean> _function = (PropertyAssignment pa) -> {
return Boolean.valueOf(((pa instanceof ExplicitPropertyAssignment) && Objects.equal(((ExplicitPropertyAssignment) pa).getName(), PropertyEnum.REGWIDTH)));
};
final PropertyAssignment pa = IterableExtensions.<PropertyAssignment>findFirst(componentDef.getPropertyAssignments(), _function);
if ((pa != null)) {
String _effectiveValue = RdlUtil.effectiveValue(((ExplicitPropertyAssignment) pa).getRhs());
final IntegerWithRadix sz = new IntegerWithRadix(_effectiveValue);
return sz.value;
}
return 32L;
case FIELD:
final Function1<PropertyAssignment, Boolean> _function_1 = (PropertyAssignment pa_1) -> {
return Boolean.valueOf(((pa_1 instanceof ExplicitPropertyAssignment) && Objects.equal(((ExplicitPropertyAssignment) pa_1).getName(), PropertyEnum.FIELDWIDTH)));
};
final PropertyAssignment pa_1 = IterableExtensions.<PropertyAssignment>findFirst(componentDef.getPropertyAssignments(), _function_1);
if ((pa_1 != null)) {
String _effectiveValue_1 = RdlUtil.effectiveValue(((ExplicitPropertyAssignment) pa_1).getRhs());
final IntegerWithRadix sz_1 = new IntegerWithRadix(_effectiveValue_1);
return sz_1.value;
}
return 1L;
default:
return 0L;
}
} else {
return 0L;
}
}
public static String effectiveName(final ComponentDefinition definition) {
String _name = definition.getName();
boolean _tripleNotEquals = (_name != null);
if (_tripleNotEquals) {
return definition.getName().replaceAll("\\s+", "_");
} else {
final Function1<PropertyAssignment, Boolean> _function = (PropertyAssignment pa) -> {
return Boolean.valueOf(((pa instanceof ExplicitPropertyAssignment) && Objects.equal(((ExplicitPropertyAssignment) pa).getName(), PropertyEnum.NAME)));
};
final PropertyAssignment pa = IterableExtensions.<PropertyAssignment>findFirst(definition.getPropertyAssignments(), _function);
if ((pa != null)) {
return RdlUtil.effectiveValue(((ExplicitPropertyAssignment) pa).getRhs()).replaceAll("\\s+", "_");
} else {
ComponentDefinitionType _type = definition.getType();
return ("unnamed_" + _type).replaceAll("\\s+", "_");
}
}
}
public static String effectiveValue(final PropertyAssignmentRhs rhs) {
String _xifexpression = null;
RValue _value = rhs.getValue();
boolean _tripleNotEquals = (_value != null);
if (_tripleNotEquals) {
_xifexpression = RdlUtil.effectiveValue(rhs.getValue());
} else {
String _xifexpression_1 = null;
InstancePropertyRef _instPropRef = rhs.getInstPropRef();
boolean _tripleNotEquals_1 = (_instPropRef != null);
if (_tripleNotEquals_1) {
_xifexpression_1 = RdlUtil.effectiveValue(rhs.getInstPropRef());
} else {
String _xifexpression_2 = null;
EnumDefinition _enumRef = rhs.getEnumRef();
boolean _tripleNotEquals_2 = (_enumRef != null);
if (_tripleNotEquals_2) {
_xifexpression_2 = rhs.getEnumRef().getName();
}
_xifexpression_1 = _xifexpression_2;
}
_xifexpression = _xifexpression_1;
}
return _xifexpression;
}
public static String effectiveValue(final RValue rvalue) {
String _xifexpression = null;
String _str = rvalue.getStr();
boolean _tripleNotEquals = (_str != null);
if (_tripleNotEquals) {
_xifexpression = rvalue.getStr();
} else {
String _xifexpression_1 = null;
RValueConstant _val = rvalue.getVal();
boolean _notEquals = (!Objects.equal(_val, RValueConstant.UNDEFINED));
if (_notEquals) {
_xifexpression_1 = rvalue.getVal().getLiteral();
} else {
String _xifexpression_2 = null;
Object _num = rvalue.getNum();
boolean _tripleNotEquals_1 = (_num != null);
if (_tripleNotEquals_1) {
String _xblockexpression = null;
{
Object _num_1 = rvalue.getNum();
final IntegerWithRadix num = ((IntegerWithRadix) _num_1);
_xblockexpression = num.toString();
}
_xifexpression_2 = _xblockexpression;
}
_xifexpression_1 = _xifexpression_2;
}
_xifexpression = _xifexpression_1;
}
return _xifexpression;
}
public static String effectiveValue(final InstancePropertyRef ref) {
throw new RuntimeException();
}
public static ComponentDefinition definingComponent(final Instantiation instantiation) {
ComponentDefinition _xifexpression = null;
ComponentDefinition _componentRef = instantiation.getComponentRef();
boolean _tripleNotEquals = (_componentRef != null);
if (_tripleNotEquals) {
_xifexpression = instantiation.getComponentRef();
} else {
_xifexpression = instantiation.getComponent();
}
return _xifexpression;
}
public static int instanceCount(final ComponentDefinition definition, final ComponentDefinitionType type) {
final Function1<Instantiation, Integer> _function = (Instantiation it) -> {
return Integer.valueOf(it.getComponentInstances().size());
};
final Function2<Integer, Integer, Integer> _function_1 = (Integer p1, Integer p2) -> {
return Integer.valueOf(((p1).intValue() + (p2).intValue()));
};
return (int) IterableExtensions.<Integer>reduce(IterableExtensions.<Instantiation, Integer>map(RdlUtil.instantiationsOfType(definition, type), _function), _function_1);
}
public static Iterable<Instantiation> instantiationsOfType(final ComponentDefinition definition, final ComponentDefinitionType type) {
final Function1<Instantiation, Boolean> _function = (Instantiation it) -> {
ComponentDefinitionType _type = RdlUtil.definingComponent(it).getType();
return Boolean.valueOf(Objects.equal(_type, type));
};
return IterableExtensions.<Instantiation>filter(definition.getInstantiations(), _function);
}
public static long byteSize(final Instantiation instantiation, final long start) {
final ComponentDefinition componentDefinition = RdlUtil.definingComponent(instantiation);
long componentSize = 0;
ComponentDefinitionType _type = RdlUtil.definingComponent(instantiation).getType();
boolean _equals = Objects.equal(_type, ComponentDefinitionType.REG);
if (_equals) {
long _regWidth = RdlUtil.regWidth(RdlUtil.definingComponent(instantiation));
long _divide = (_regWidth / 8);
componentSize = _divide;
} else {
EList<Instantiation> _instantiations = componentDefinition.getInstantiations();
for (final Instantiation subInstantiation : _instantiations) {
componentSize = RdlUtil.byteSize(subInstantiation, componentSize);
}
}
long lastTopAddress = start;
long topAddress = start;
EList<ComponentInstance> _componentInstances = instantiation.getComponentInstances();
for (final ComponentInstance componentInstance : _componentInstances) {
{
long _xifexpression = (long) 0;
Object _address = componentInstance.getAddress();
boolean _tripleNotEquals = (_address != null);
if (_tripleNotEquals) {
Object _address_1 = componentInstance.getAddress();
_xifexpression = (((IntegerWithRadix) _address_1).value + componentSize);
} else {
_xifexpression = (componentSize + lastTopAddress);
}
final long byteSize = _xifexpression;
topAddress = Math.max(topAddress, byteSize);
lastTopAddress = byteSize;
}
}
return topAddress;
}
public static long byteSize(final Instantiation instantiation) {
final ComponentDefinition componentDefinition = RdlUtil.definingComponent(instantiation);
long componentSize = 0;
ComponentDefinitionType _type = RdlUtil.definingComponent(instantiation).getType();
boolean _equals = Objects.equal(_type, ComponentDefinitionType.REG);
if (_equals) {
long _regWidth = RdlUtil.regWidth(RdlUtil.definingComponent(instantiation));
long _divide = (_regWidth / 8);
componentSize = _divide;
} else {
EList<Instantiation> _instantiations = componentDefinition.getInstantiations();
for (final Instantiation subInstantiation : _instantiations) {
componentSize = RdlUtil.byteSize(subInstantiation, componentSize);
}
}
return componentSize;
}
}

View File

@ -0,0 +1,81 @@
/**
* generated by Xtext 2.14.0
*/
package com.minres.rdl.formatting2;
import com.minres.rdl.rdl.ComponentDefinition;
import com.minres.rdl.rdl.EnumDefinition;
import com.minres.rdl.rdl.Include;
import com.minres.rdl.rdl.Instantiation;
import com.minres.rdl.rdl.PropertyAssignment;
import com.minres.rdl.rdl.PropertyDefault;
import com.minres.rdl.rdl.PropertyDefinition;
import com.minres.rdl.rdl.PropertyUsage;
import com.minres.rdl.rdl.Root;
import java.util.Arrays;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.xtext.formatting2.AbstractFormatter2;
import org.eclipse.xtext.formatting2.IFormattableDocument;
import org.eclipse.xtext.resource.XtextResource;
import org.eclipse.xtext.xbase.lib.Extension;
@SuppressWarnings("all")
public class RDLFormatter extends AbstractFormatter2 {
protected void _format(final Root root, @Extension final IFormattableDocument document) {
EList<Include> _includes = root.getIncludes();
for (final Include include : _includes) {
document.<Include>format(include);
}
EList<ComponentDefinition> _componentDefinitions = root.getComponentDefinitions();
for (final ComponentDefinition componentDefinition : _componentDefinitions) {
document.<ComponentDefinition>format(componentDefinition);
}
EList<EnumDefinition> _enumDefinitions = root.getEnumDefinitions();
for (final EnumDefinition enumDefinition : _enumDefinitions) {
document.<EnumDefinition>format(enumDefinition);
}
EList<Instantiation> _instantiations = root.getInstantiations();
for (final Instantiation instantiation : _instantiations) {
document.<Instantiation>format(instantiation);
}
EList<PropertyAssignment> _propertyAssignments = root.getPropertyAssignments();
for (final PropertyAssignment propertyAssignment : _propertyAssignments) {
document.<PropertyAssignment>format(propertyAssignment);
}
EList<PropertyDefinition> _propertyDefinitions = root.getPropertyDefinitions();
for (final PropertyDefinition propertyDefinition : _propertyDefinitions) {
document.<PropertyDefinition>format(propertyDefinition);
}
}
protected void _format(final PropertyDefinition propertyDefinition, @Extension final IFormattableDocument document) {
document.<PropertyUsage>format(propertyDefinition.getUsage());
document.<PropertyDefault>format(propertyDefinition.getDefault());
}
public void format(final Object propertyDefinition, final IFormattableDocument document) {
if (propertyDefinition instanceof XtextResource) {
_format((XtextResource)propertyDefinition, document);
return;
} else if (propertyDefinition instanceof PropertyDefinition) {
_format((PropertyDefinition)propertyDefinition, document);
return;
} else if (propertyDefinition instanceof Root) {
_format((Root)propertyDefinition, document);
return;
} else if (propertyDefinition instanceof EObject) {
_format((EObject)propertyDefinition, document);
return;
} else if (propertyDefinition == null) {
_format((Void)null, document);
return;
} else if (propertyDefinition != null) {
_format(propertyDefinition, document);
return;
} else {
throw new IllegalArgumentException("Unhandled parameter types: " +
Arrays.<Object>asList(propertyDefinition, document).toString());
}
}
}

View File

@ -1,6 +1,7 @@
package com.minres.rdl.generator;
import com.minres.rdl.IntegerWithRadix;
import com.minres.rdl.RdlUtil;
import com.minres.rdl.generator.RdlBaseGenerator;
import com.minres.rdl.rdl.ComponentDefinition;
import com.minres.rdl.rdl.ComponentDefinitionType;
@ -20,19 +21,28 @@ public class AddrmapGenerator extends RdlBaseGenerator {
@Override
public String generateHeader() {
StringConcatenation _builder = new StringConcatenation();
_builder.append("#ifndef _E300_PLAT_MAP_H_");
_builder.newLine();
_builder.append("#define _E300_PLAT_MAP_H_");
_builder.newLine();
_builder.append("#ifndef _");
String _upperCase = RdlUtil.effectiveName(this.componentDefinition).toUpperCase();
_builder.append(_upperCase);
_builder.append("_MAP_H_");
_builder.newLineIfNotEmpty();
_builder.append("#define _");
String _upperCase_1 = RdlUtil.effectiveName(this.componentDefinition).toUpperCase();
_builder.append(_upperCase_1);
_builder.append("_MAP_H_");
_builder.newLineIfNotEmpty();
_builder.append("// need double braces, see https://stackoverflow.com/questions/6893700/how-to-construct-stdarray-object-with-initializer-list#6894191");
_builder.newLine();
_builder.append("const std::array<sysc::target_memory_map_entry<32>, ");
int _instanceCount = this.instanceCount(this.componentDefinition, ComponentDefinitionType.REGFILE);
int _instanceCount = RdlUtil.instanceCount(this.componentDefinition, ComponentDefinitionType.REGFILE);
_builder.append(_instanceCount);
_builder.append("> e300_plat_map = {{");
_builder.append("> ");
String _effectiveName = RdlUtil.effectiveName(this.componentDefinition);
_builder.append(_effectiveName);
_builder.append("_map = {{");
_builder.newLineIfNotEmpty();
{
Iterable<Instantiation> _instantiationsOfType = this.instantiationsOfType(this.componentDefinition, ComponentDefinitionType.REGFILE);
Iterable<Instantiation> _instantiationsOfType = RdlUtil.instantiationsOfType(this.componentDefinition, ComponentDefinitionType.REGFILE);
for(final Instantiation instantiation : _instantiationsOfType) {
{
EList<ComponentInstance> _componentInstances = instantiation.getComponentInstances();
@ -41,13 +51,12 @@ public class AddrmapGenerator extends RdlBaseGenerator {
_builder.append("{&i_");
String _name = instance.getName();
_builder.append(_name, " ");
_builder.append(", ");
IntegerWithRadix _addressValue = RdlUtil.addressValue(instance);
_builder.append(_addressValue, " ");
_builder.append(", 0x");
Object _address = instance.getAddress();
String _hexString = Long.toHexString(((IntegerWithRadix) _address).value);
String _hexString = Long.toHexString(RdlUtil.byteSize(instantiation));
_builder.append(_hexString, " ");
_builder.append(", 0x");
String _hexString_1 = Long.toHexString(this.byteSize(instantiation));
_builder.append(_hexString_1, " ");
_builder.append("},");
_builder.newLineIfNotEmpty();
}
@ -57,8 +66,11 @@ public class AddrmapGenerator extends RdlBaseGenerator {
_builder.append("}};");
_builder.newLine();
_builder.newLine();
_builder.append("#endif /* _E300_PLAT_MAP_H_ */");
_builder.newLine();
_builder.append("#endif /* _");
String _upperCase_2 = RdlUtil.effectiveName(this.componentDefinition).toUpperCase();
_builder.append(_upperCase_2);
_builder.append("_MAP_H_ */");
_builder.newLineIfNotEmpty();
return _builder.toString();
}

View File

@ -3,6 +3,7 @@
*/
package com.minres.rdl.generator;
import com.minres.rdl.RdlUtil;
import com.minres.rdl.generator.AddrmapGenerator;
import com.minres.rdl.generator.RdlBaseGenerator;
import com.minres.rdl.generator.RegfileGenerator;
@ -38,14 +39,14 @@ public class RDLGenerator extends AbstractGenerator {
if ((gen != null)) {
final String header = gen.generateHeader();
if (((header != null) && (header.length() > 0))) {
String _name = it.getName();
String _plus = (_name + ".h");
String _effectiveName = RdlUtil.effectiveName(it);
String _plus = (_effectiveName + ".h");
fsa.generateFile(_plus, this.outputConfig(fsa, "incl-out"), header);
}
final String source = gen.generateSource();
if (((source != null) && (source.length() > 0))) {
String _name_1 = it.getName();
String _plus_1 = (_name_1 + ".cpp");
String _effectiveName_1 = RdlUtil.effectiveName(it);
String _plus_1 = (_effectiveName_1 + ".cpp");
fsa.generateFile(_plus_1, this.outputConfig(fsa, "src-out"), source);
}
}

View File

@ -1,256 +1,7 @@
package com.minres.rdl.generator;
import com.google.common.base.Objects;
import com.minres.rdl.IntegerWithRadix;
import com.minres.rdl.rdl.ComponentDefinition;
import com.minres.rdl.rdl.ComponentDefinitionType;
import com.minres.rdl.rdl.ComponentInstance;
import com.minres.rdl.rdl.EnumDefinition;
import com.minres.rdl.rdl.ExplicitPropertyAssignment;
import com.minres.rdl.rdl.InstancePropertyRef;
import com.minres.rdl.rdl.Instantiation;
import com.minres.rdl.rdl.PropertyAssignment;
import com.minres.rdl.rdl.PropertyAssignmentRhs;
import com.minres.rdl.rdl.PropertyEnum;
import com.minres.rdl.rdl.RValue;
import com.minres.rdl.rdl.RValueConstant;
import org.eclipse.emf.common.util.EList;
import org.eclipse.xtext.xbase.lib.Functions.Function1;
import org.eclipse.xtext.xbase.lib.Functions.Function2;
import org.eclipse.xtext.xbase.lib.IterableExtensions;
@SuppressWarnings("all")
public abstract class RdlBaseGenerator {
public long accessWidth(final ComponentDefinition definition) {
long size = 32L;
final Function1<PropertyAssignment, Boolean> _function = (PropertyAssignment pa) -> {
return Boolean.valueOf(((pa instanceof ExplicitPropertyAssignment) && Objects.equal(((ExplicitPropertyAssignment) pa).getName(), PropertyEnum.ACCESSWIDTH)));
};
final PropertyAssignment pa = IterableExtensions.<PropertyAssignment>findFirst(definition.getPropertyAssignments(), _function);
if ((pa != null)) {
String _effectiveValue = this.effectiveValue(((ExplicitPropertyAssignment) pa).getRhs());
final IntegerWithRadix sz = new IntegerWithRadix(_effectiveValue);
size = sz.value;
}
return size;
}
public long regWidth(final ComponentDefinition definition) {
long size = 32L;
final Function1<PropertyAssignment, Boolean> _function = (PropertyAssignment pa) -> {
return Boolean.valueOf(((pa instanceof ExplicitPropertyAssignment) && Objects.equal(((ExplicitPropertyAssignment) pa).getName(), PropertyEnum.REGWIDTH)));
};
final PropertyAssignment pa = IterableExtensions.<PropertyAssignment>findFirst(definition.getPropertyAssignments(), _function);
if ((pa != null)) {
String _effectiveValue = this.effectiveValue(((ExplicitPropertyAssignment) pa).getRhs());
final IntegerWithRadix sz = new IntegerWithRadix(_effectiveValue);
size = sz.value;
}
return size;
}
public long getSize(final Instantiation instantiation) {
final ComponentDefinition componentDef = this.definingComponent(instantiation);
ComponentDefinitionType _type = componentDef.getType();
if (_type != null) {
switch (_type) {
case REG:
final Function1<PropertyAssignment, Boolean> _function = (PropertyAssignment pa) -> {
return Boolean.valueOf(((pa instanceof ExplicitPropertyAssignment) && Objects.equal(((ExplicitPropertyAssignment) pa).getName(), PropertyEnum.REGWIDTH)));
};
final PropertyAssignment pa = IterableExtensions.<PropertyAssignment>findFirst(componentDef.getPropertyAssignments(), _function);
if ((pa != null)) {
String _effectiveValue = this.effectiveValue(((ExplicitPropertyAssignment) pa).getRhs());
final IntegerWithRadix sz = new IntegerWithRadix(_effectiveValue);
return sz.value;
}
return 32L;
case FIELD:
final Function1<PropertyAssignment, Boolean> _function_1 = (PropertyAssignment pa_1) -> {
return Boolean.valueOf(((pa_1 instanceof ExplicitPropertyAssignment) && Objects.equal(((ExplicitPropertyAssignment) pa_1).getName(), PropertyEnum.FIELDWIDTH)));
};
final PropertyAssignment pa_1 = IterableExtensions.<PropertyAssignment>findFirst(componentDef.getPropertyAssignments(), _function_1);
if ((pa_1 != null)) {
String _effectiveValue_1 = this.effectiveValue(((ExplicitPropertyAssignment) pa_1).getRhs());
final IntegerWithRadix sz_1 = new IntegerWithRadix(_effectiveValue_1);
return sz_1.value;
}
return 1L;
default:
return 0L;
}
} else {
return 0L;
}
}
public String effectiveName(final ComponentDefinition definition) {
String _xifexpression = null;
String _name = definition.getName();
boolean _tripleNotEquals = (_name != null);
if (_tripleNotEquals) {
_xifexpression = definition.getName();
} else {
String _xblockexpression = null;
{
final Function1<PropertyAssignment, Boolean> _function = (PropertyAssignment pa) -> {
return Boolean.valueOf(((pa instanceof ExplicitPropertyAssignment) && Objects.equal(((ExplicitPropertyAssignment) pa).getName(), PropertyEnum.NAME)));
};
final PropertyAssignment pa = IterableExtensions.<PropertyAssignment>findFirst(definition.getPropertyAssignments(), _function);
_xblockexpression = this.effectiveValue(((ExplicitPropertyAssignment) pa).getRhs());
}
_xifexpression = _xblockexpression;
}
return _xifexpression;
}
public String effectiveValue(final PropertyAssignmentRhs rhs) {
String _xifexpression = null;
RValue _value = rhs.getValue();
boolean _tripleNotEquals = (_value != null);
if (_tripleNotEquals) {
_xifexpression = this.effectiveValue(rhs.getValue());
} else {
String _xifexpression_1 = null;
InstancePropertyRef _instPropRef = rhs.getInstPropRef();
boolean _tripleNotEquals_1 = (_instPropRef != null);
if (_tripleNotEquals_1) {
_xifexpression_1 = this.effectiveValue(rhs.getInstPropRef());
} else {
String _xifexpression_2 = null;
EnumDefinition _enumRef = rhs.getEnumRef();
boolean _tripleNotEquals_2 = (_enumRef != null);
if (_tripleNotEquals_2) {
_xifexpression_2 = rhs.getEnumRef().getName();
}
_xifexpression_1 = _xifexpression_2;
}
_xifexpression = _xifexpression_1;
}
return _xifexpression;
}
public String effectiveValue(final RValue rvalue) {
String _xifexpression = null;
String _str = rvalue.getStr();
boolean _tripleNotEquals = (_str != null);
if (_tripleNotEquals) {
_xifexpression = rvalue.getStr();
} else {
String _xifexpression_1 = null;
RValueConstant _val = rvalue.getVal();
boolean _notEquals = (!Objects.equal(_val, RValueConstant.UNDEFINED));
if (_notEquals) {
_xifexpression_1 = rvalue.getVal().getLiteral();
} else {
String _xifexpression_2 = null;
Object _num = rvalue.getNum();
boolean _tripleNotEquals_1 = (_num != null);
if (_tripleNotEquals_1) {
String _xblockexpression = null;
{
Object _num_1 = rvalue.getNum();
final IntegerWithRadix num = ((IntegerWithRadix) _num_1);
_xblockexpression = num.toString();
}
_xifexpression_2 = _xblockexpression;
}
_xifexpression_1 = _xifexpression_2;
}
_xifexpression = _xifexpression_1;
}
return _xifexpression;
}
public String effectiveValue(final InstancePropertyRef ref) {
throw new RuntimeException();
}
public ComponentDefinition definingComponent(final Instantiation instantiation) {
ComponentDefinition _xifexpression = null;
ComponentDefinition _componentRef = instantiation.getComponentRef();
boolean _tripleNotEquals = (_componentRef != null);
if (_tripleNotEquals) {
_xifexpression = instantiation.getComponentRef();
} else {
_xifexpression = instantiation.getComponent();
}
return _xifexpression;
}
public int instanceCount(final ComponentDefinition definition, final ComponentDefinitionType type) {
final Function1<Instantiation, Integer> _function = (Instantiation it) -> {
return Integer.valueOf(it.getComponentInstances().size());
};
final Function2<Integer, Integer, Integer> _function_1 = (Integer p1, Integer p2) -> {
return Integer.valueOf(((p1).intValue() + (p2).intValue()));
};
return (int) IterableExtensions.<Integer>reduce(IterableExtensions.<Instantiation, Integer>map(this.instantiationsOfType(definition, type), _function), _function_1);
}
public Iterable<Instantiation> instantiationsOfType(final ComponentDefinition definition, final ComponentDefinitionType type) {
final Function1<Instantiation, Boolean> _function = (Instantiation it) -> {
ComponentDefinitionType _type = this.definingComponent(it).getType();
return Boolean.valueOf(Objects.equal(_type, type));
};
return IterableExtensions.<Instantiation>filter(definition.getInstantiations(), _function);
}
public long byteSize(final Instantiation instantiation, final long start) {
final ComponentDefinition componentDefinition = this.definingComponent(instantiation);
long componentSize = 0;
ComponentDefinitionType _type = this.definingComponent(instantiation).getType();
boolean _equals = Objects.equal(_type, ComponentDefinitionType.REG);
if (_equals) {
long _regWidth = this.regWidth(this.definingComponent(instantiation));
long _divide = (_regWidth / 8);
componentSize = _divide;
} else {
EList<Instantiation> _instantiations = componentDefinition.getInstantiations();
for (final Instantiation subInstantiation : _instantiations) {
componentSize = this.byteSize(subInstantiation, componentSize);
}
}
long lastTopAddress = start;
long topAddress = start;
EList<ComponentInstance> _componentInstances = instantiation.getComponentInstances();
for (final ComponentInstance componentInstance : _componentInstances) {
{
long _xifexpression = (long) 0;
Object _address = componentInstance.getAddress();
boolean _tripleNotEquals = (_address != null);
if (_tripleNotEquals) {
Object _address_1 = componentInstance.getAddress();
_xifexpression = (((IntegerWithRadix) _address_1).value + componentSize);
} else {
_xifexpression = (componentSize + lastTopAddress);
}
final long byteSize = _xifexpression;
topAddress = Math.max(topAddress, byteSize);
lastTopAddress = byteSize;
}
}
return topAddress;
}
public long byteSize(final Instantiation instantiation) {
final ComponentDefinition componentDefinition = this.definingComponent(instantiation);
long componentSize = 0;
ComponentDefinitionType _type = this.definingComponent(instantiation).getType();
boolean _equals = Objects.equal(_type, ComponentDefinitionType.REG);
if (_equals) {
long _regWidth = this.regWidth(this.definingComponent(instantiation));
long _divide = (_regWidth / 8);
componentSize = _divide;
} else {
EList<Instantiation> _instantiations = componentDefinition.getInstantiations();
for (final Instantiation subInstantiation : _instantiations) {
componentSize = this.byteSize(subInstantiation, componentSize);
}
}
return componentSize;
}
public abstract String generateHeader();
public abstract String generateSource();

View File

@ -2,6 +2,7 @@ package com.minres.rdl.generator;
import com.google.common.base.Objects;
import com.minres.rdl.IntegerWithRadix;
import com.minres.rdl.RdlUtil;
import com.minres.rdl.generator.RdlBaseGenerator;
import com.minres.rdl.rdl.ComponentDefinition;
import com.minres.rdl.rdl.ComponentDefinitionType;
@ -152,7 +153,7 @@ public class RegfileGenerator extends RdlBaseGenerator {
if (_equals) {
_builder.append(" ");
_builder.append("BEGIN_BF_DECL(");
String _effectiveName = this.effectiveName(cdef);
String _effectiveName = RdlUtil.effectiveName(cdef);
_builder.append(_effectiveName, " ");
_builder.append("+\'_t\'», uint");
_builder.append(cdef, " ");
@ -175,7 +176,7 @@ public class RegfileGenerator extends RdlBaseGenerator {
{
if (((instantiation.getComponentRef() != null) && Objects.equal(instantiation.getComponentRef().getType(), ComponentDefinitionType.REG))) {
_builder.append(" ");
String _effectiveName_1 = this.effectiveName(instantiation.getComponentRef());
String _effectiveName_1 = RdlUtil.effectiveName(instantiation.getComponentRef());
_builder.append(_effectiveName_1, " ");
_builder.append("+\'_t\' ");
final Function1<ComponentInstance, String> _function = (ComponentInstance it) -> {
@ -202,7 +203,7 @@ public class RegfileGenerator extends RdlBaseGenerator {
if (_greaterThan) {
_builder.append(" ");
_builder.append("uint");
long _size_1 = this.getSize(instantiation);
long _size_1 = RdlUtil.getSize(instantiation);
_builder.append(_size_1, " ");
_builder.append("_t ");
final Function1<ComponentInstance, Boolean> _function_2 = (ComponentInstance it) -> {
@ -228,7 +229,7 @@ public class RegfileGenerator extends RdlBaseGenerator {
for(final ComponentInstance componentInstance : _filter) {
_builder.append(" ");
_builder.append("std::array<uint");
long _size_2 = this.getSize(instantiation);
long _size_2 = RdlUtil.getSize(instantiation);
_builder.append(_size_2, " ");
_builder.append("_t, ");
long _absSize = this.absSize(componentInstance.getRange());
@ -248,16 +249,16 @@ public class RegfileGenerator extends RdlBaseGenerator {
if (_not) {
_builder.append(" ");
_builder.append("BEGIN_BF_DECL(");
String _effectiveName_2 = this.effectiveName(instantiation.getComponent());
String _effectiveName_2 = RdlUtil.effectiveName(instantiation.getComponent());
_builder.append(_effectiveName_2, " ");
_builder.append("_t, uint");
long _size_3 = this.getSize(instantiation);
long _size_3 = RdlUtil.getSize(instantiation);
_builder.append(_size_3, " ");
_builder.append("_t);");
_builder.newLineIfNotEmpty();
_builder.append(" ");
_builder.append(" ");
String _genFieldDeclarations_1 = this.genFieldDeclarations(this.definingComponent(instantiation));
String _genFieldDeclarations_1 = this.genFieldDeclarations(RdlUtil.definingComponent(instantiation));
_builder.append(_genFieldDeclarations_1, " ");
_builder.newLineIfNotEmpty();
_builder.append(" ");
@ -283,7 +284,7 @@ public class RegfileGenerator extends RdlBaseGenerator {
for(final ComponentInstance componentInstance_1 : _filter_1) {
_builder.append(" ");
_builder.append("std::array<");
String _effectiveName_3 = this.effectiveName(instantiation.getComponent());
String _effectiveName_3 = RdlUtil.effectiveName(instantiation.getComponent());
_builder.append(_effectiveName_3, " ");
_builder.append("_t, ");
long _absSize_1 = this.absSize(componentInstance_1.getRange());
@ -321,7 +322,7 @@ public class RegfileGenerator extends RdlBaseGenerator {
if (_isFilledByField_2) {
_builder.append(" ");
_builder.append("sysc::sc_register<uint");
long _size_4 = this.getSize(instantiation_1);
long _size_4 = RdlUtil.getSize(instantiation_1);
_builder.append(_size_4, " ");
_builder.append("_t> ");
String _name_4 = instance.getName();
@ -336,7 +337,7 @@ public class RegfileGenerator extends RdlBaseGenerator {
if (_not_1) {
_builder.append(" ");
_builder.append("sysc::sc_register<");
String _effectiveName_4 = this.effectiveName(instantiation_1.getComponent());
String _effectiveName_4 = RdlUtil.effectiveName(instantiation_1.getComponent());
_builder.append(_effectiveName_4, " ");
_builder.append("_t> ");
String _name_5 = instance.getName();
@ -356,7 +357,7 @@ public class RegfileGenerator extends RdlBaseGenerator {
if (_isFilledByField_4) {
_builder.append(" ");
_builder.append("sysc::sc_register_indexed<uint");
long _size_5 = this.getSize(instantiation_1);
long _size_5 = RdlUtil.getSize(instantiation_1);
_builder.append(_size_5, " ");
_builder.append("_t, ");
long _absSize_2 = this.absSize(instance.getRange());
@ -374,7 +375,7 @@ public class RegfileGenerator extends RdlBaseGenerator {
if (_not_2) {
_builder.append(" ");
_builder.append("sysc::sc_register_indexed<");
String _effectiveName_5 = this.effectiveName(instantiation_1.getComponent());
String _effectiveName_5 = RdlUtil.effectiveName(instantiation_1.getComponent());
_builder.append(_effectiveName_5, " ");
_builder.append("_t, ");
long _absSize_3 = this.absSize(instance.getRange());
@ -467,10 +468,9 @@ public class RegfileGenerator extends RdlBaseGenerator {
_builder.append("target.addResource(");
String _name_14 = instance_2.getName();
_builder.append(_name_14, " ");
_builder.append(", 0x");
Object _address = instance_2.getAddress();
String _hexString = Long.toHexString(((IntegerWithRadix) _address).value);
_builder.append(_hexString, " ");
_builder.append(", ");
IntegerWithRadix _addressValue = RdlUtil.addressValue(instance_2);
_builder.append(_addressValue, " ");
_builder.append("UL);");
_builder.newLineIfNotEmpty();
}
@ -505,12 +505,12 @@ public class RegfileGenerator extends RdlBaseGenerator {
public boolean isFilledByField(final Instantiation instantiation) {
final int fieldCount = this.instanceCountOfType(instantiation.getComponent(), ComponentDefinitionType.FIELD);
if ((fieldCount == 1)) {
final long instSize = this.getSize(instantiation);
final Instantiation field = ((Instantiation[])Conversions.unwrapArray(this.instantiationsOfType(instantiation.getComponent(), ComponentDefinitionType.FIELD), Instantiation.class))[0];
final long instSize = RdlUtil.getSize(instantiation);
final Instantiation field = ((Instantiation[])Conversions.unwrapArray(RdlUtil.instantiationsOfType(instantiation.getComponent(), ComponentDefinitionType.FIELD), Instantiation.class))[0];
final ComponentInstance inst = field.getComponentInstances().get(0);
final Range range = inst.getRange();
if ((range == null)) {
long _size = this.getSize(field);
long _size = RdlUtil.getSize(field);
return (instSize == _size);
}
Object _size_1 = range.getSize();
@ -543,7 +543,7 @@ public class RegfileGenerator extends RdlBaseGenerator {
final Function2<Integer, Integer, Integer> _function_1 = (Integer p1, Integer p2) -> {
return Integer.valueOf(((p1).intValue() + (p1).intValue()));
};
return (int) IterableExtensions.<Integer>reduce(IterableExtensions.<Instantiation, Integer>map(this.instantiationsOfType(definition, type), _function), _function_1);
return (int) IterableExtensions.<Integer>reduce(IterableExtensions.<Instantiation, Integer>map(RdlUtil.instantiationsOfType(definition, type), _function), _function_1);
}
@Override