mirror of
				https://github.com/Minres/RDL-Editor.git
				synced 2025-11-03 20:21:46 +00:00 
			
		
		
		
	fix #1 'Generate register access functions for FW'
This commit is contained in:
		@@ -0,0 +1,200 @@
 | 
			
		||||
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;
 | 
			
		||||
import com.minres.rdl.rdl.ComponentInstance;
 | 
			
		||||
import com.minres.rdl.rdl.Instantiation;
 | 
			
		||||
import java.util.Date;
 | 
			
		||||
import java.util.LinkedHashSet;
 | 
			
		||||
import org.eclipse.emf.common.util.EList;
 | 
			
		||||
import org.eclipse.xtend2.lib.StringConcatenation;
 | 
			
		||||
import org.eclipse.xtext.xbase.lib.CollectionLiterals;
 | 
			
		||||
 | 
			
		||||
@SuppressWarnings("all")
 | 
			
		||||
public class FwAddrmapGenerator extends RdlBaseGenerator {
 | 
			
		||||
  private final ComponentDefinition componentDefinition;
 | 
			
		||||
  
 | 
			
		||||
  public FwAddrmapGenerator(final ComponentDefinition definition) {
 | 
			
		||||
    this.componentDefinition = definition;
 | 
			
		||||
  }
 | 
			
		||||
  
 | 
			
		||||
  private final LinkedHashSet<Object> nameMap = CollectionLiterals.<Object>newLinkedHashSet();
 | 
			
		||||
  
 | 
			
		||||
  @Override
 | 
			
		||||
  public String generateHeader() {
 | 
			
		||||
    StringConcatenation _builder = new StringConcatenation();
 | 
			
		||||
    _builder.append("////////////////////////////////////////////////////////////////////////////////");
 | 
			
		||||
    _builder.newLine();
 | 
			
		||||
    _builder.append("// Copyright (C) 2020, MINRES Technologies GmbH");
 | 
			
		||||
    _builder.newLine();
 | 
			
		||||
    _builder.append("// All rights reserved.");
 | 
			
		||||
    _builder.newLine();
 | 
			
		||||
    _builder.append("//");
 | 
			
		||||
    _builder.newLine();
 | 
			
		||||
    _builder.append("// Redistribution and use in source and binary forms, with or without");
 | 
			
		||||
    _builder.newLine();
 | 
			
		||||
    _builder.append("// modification, are permitted provided that the following conditions are met:");
 | 
			
		||||
    _builder.newLine();
 | 
			
		||||
    _builder.append("//");
 | 
			
		||||
    _builder.newLine();
 | 
			
		||||
    _builder.append("// 1. Redistributions of source code must retain the above copyright notice,");
 | 
			
		||||
    _builder.newLine();
 | 
			
		||||
    _builder.append("//    this list of conditions and the following disclaimer.");
 | 
			
		||||
    _builder.newLine();
 | 
			
		||||
    _builder.append("//");
 | 
			
		||||
    _builder.newLine();
 | 
			
		||||
    _builder.append("// 2. Redistributions in binary form must reproduce the above copyright notice,");
 | 
			
		||||
    _builder.newLine();
 | 
			
		||||
    _builder.append("//    this list of conditions and the following disclaimer in the documentation");
 | 
			
		||||
    _builder.newLine();
 | 
			
		||||
    _builder.append("//    and/or other materials provided with the distribution.");
 | 
			
		||||
    _builder.newLine();
 | 
			
		||||
    _builder.append("//");
 | 
			
		||||
    _builder.newLine();
 | 
			
		||||
    _builder.append("// 3. Neither the name of the copyright holder nor the names of its contributors");
 | 
			
		||||
    _builder.newLine();
 | 
			
		||||
    _builder.append("//    may be used to endorse or promote products derived from this software");
 | 
			
		||||
    _builder.newLine();
 | 
			
		||||
    _builder.append("//    without specific prior written permission.");
 | 
			
		||||
    _builder.newLine();
 | 
			
		||||
    _builder.append("//");
 | 
			
		||||
    _builder.newLine();
 | 
			
		||||
    _builder.append("// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"");
 | 
			
		||||
    _builder.newLine();
 | 
			
		||||
    _builder.append("// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE");
 | 
			
		||||
    _builder.newLine();
 | 
			
		||||
    _builder.append("// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE");
 | 
			
		||||
    _builder.newLine();
 | 
			
		||||
    _builder.append("// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE");
 | 
			
		||||
    _builder.newLine();
 | 
			
		||||
    _builder.append("// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR");
 | 
			
		||||
    _builder.newLine();
 | 
			
		||||
    _builder.append("// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF");
 | 
			
		||||
    _builder.newLine();
 | 
			
		||||
    _builder.append("// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS");
 | 
			
		||||
    _builder.newLine();
 | 
			
		||||
    _builder.append("// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN");
 | 
			
		||||
    _builder.newLine();
 | 
			
		||||
    _builder.append("// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)");
 | 
			
		||||
    _builder.newLine();
 | 
			
		||||
    _builder.append("// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE");
 | 
			
		||||
    _builder.newLine();
 | 
			
		||||
    _builder.append("// POSSIBILITY OF SUCH DAMAGE.");
 | 
			
		||||
    _builder.newLine();
 | 
			
		||||
    _builder.append("//");
 | 
			
		||||
    _builder.newLine();
 | 
			
		||||
    _builder.append("// Created on: ");
 | 
			
		||||
    Date _date = new Date();
 | 
			
		||||
    _builder.append(_date);
 | 
			
		||||
    _builder.newLineIfNotEmpty();
 | 
			
		||||
    _builder.append("//             *      ");
 | 
			
		||||
    String _name = this.componentDefinition.getName();
 | 
			
		||||
    _builder.append(_name);
 | 
			
		||||
    _builder.append(".h Author: <RDL Generator>");
 | 
			
		||||
    _builder.newLineIfNotEmpty();
 | 
			
		||||
    _builder.append("//");
 | 
			
		||||
    _builder.newLine();
 | 
			
		||||
    _builder.append("////////////////////////////////////////////////////////////////////////////////");
 | 
			
		||||
    _builder.newLine();
 | 
			
		||||
    _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.newLine();
 | 
			
		||||
    {
 | 
			
		||||
      Iterable<Instantiation> _instantiationsOfType = RdlUtil.instantiationsOfType(this.componentDefinition, ComponentDefinitionType.REGFILE);
 | 
			
		||||
      for(final Instantiation instantiation : _instantiationsOfType) {
 | 
			
		||||
        {
 | 
			
		||||
          if (((instantiation.getComponent() != null) && (!this.nameMap.contains(instantiation.getComponent().getName())))) {
 | 
			
		||||
            _builder.append("#include \"");
 | 
			
		||||
            String _name_1 = instantiation.getComponent().getName();
 | 
			
		||||
            _builder.append(_name_1);
 | 
			
		||||
            _builder.append(".h\"");
 | 
			
		||||
            boolean _add = this.nameMap.add(instantiation.getComponent().getName());
 | 
			
		||||
            _builder.append(_add);
 | 
			
		||||
            _builder.newLineIfNotEmpty();
 | 
			
		||||
          }
 | 
			
		||||
        }
 | 
			
		||||
        {
 | 
			
		||||
          if (((instantiation.getComponentRef() != null) && (!this.nameMap.contains(instantiation.getComponentRef().getName())))) {
 | 
			
		||||
            _builder.append("#include \"");
 | 
			
		||||
            String _name_2 = instantiation.getComponentRef().getName();
 | 
			
		||||
            _builder.append(_name_2);
 | 
			
		||||
            _builder.append(".h\"");
 | 
			
		||||
            boolean _add_1 = this.nameMap.add(instantiation.getComponentRef().getName());
 | 
			
		||||
            _builder.append(_add_1);
 | 
			
		||||
            _builder.newLineIfNotEmpty();
 | 
			
		||||
          }
 | 
			
		||||
        }
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
    _builder.newLine();
 | 
			
		||||
    _builder.newLine();
 | 
			
		||||
    {
 | 
			
		||||
      Iterable<Instantiation> _instantiationsOfType_1 = RdlUtil.instantiationsOfType(this.componentDefinition, ComponentDefinitionType.REGFILE);
 | 
			
		||||
      for(final Instantiation instantiation_1 : _instantiationsOfType_1) {
 | 
			
		||||
        {
 | 
			
		||||
          EList<ComponentInstance> _componentInstances = instantiation_1.getComponentInstances();
 | 
			
		||||
          for(final ComponentInstance instance : _componentInstances) {
 | 
			
		||||
            {
 | 
			
		||||
              ComponentDefinition _component = instantiation_1.getComponent();
 | 
			
		||||
              boolean _tripleNotEquals = (_component != null);
 | 
			
		||||
              if (_tripleNotEquals) {
 | 
			
		||||
                _builder.append("using ");
 | 
			
		||||
                String _name_3 = instance.getName();
 | 
			
		||||
                _builder.append(_name_3);
 | 
			
		||||
                _builder.append(" = ");
 | 
			
		||||
                String _name_4 = instantiation_1.getComponent().getName();
 | 
			
		||||
                _builder.append(_name_4);
 | 
			
		||||
                _builder.append("<");
 | 
			
		||||
                IntegerWithRadix _addressValue = RdlUtil.addressValue(instance);
 | 
			
		||||
                _builder.append(_addressValue);
 | 
			
		||||
                _builder.append("ULL>;");
 | 
			
		||||
                _builder.newLineIfNotEmpty();
 | 
			
		||||
              }
 | 
			
		||||
            }
 | 
			
		||||
            {
 | 
			
		||||
              ComponentDefinition _componentRef = instantiation_1.getComponentRef();
 | 
			
		||||
              boolean _tripleNotEquals_1 = (_componentRef != null);
 | 
			
		||||
              if (_tripleNotEquals_1) {
 | 
			
		||||
                _builder.append("using ");
 | 
			
		||||
                String _name_5 = instance.getName();
 | 
			
		||||
                _builder.append(_name_5);
 | 
			
		||||
                _builder.append(" = ");
 | 
			
		||||
                String _name_6 = instantiation_1.getComponentRef().getName();
 | 
			
		||||
                _builder.append(_name_6);
 | 
			
		||||
                _builder.append("<");
 | 
			
		||||
                IntegerWithRadix _addressValue_1 = RdlUtil.addressValue(instance);
 | 
			
		||||
                _builder.append(_addressValue_1);
 | 
			
		||||
                _builder.append("ULL>;");
 | 
			
		||||
                _builder.newLineIfNotEmpty();
 | 
			
		||||
              }
 | 
			
		||||
            }
 | 
			
		||||
          }
 | 
			
		||||
        }
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
    _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();
 | 
			
		||||
  }
 | 
			
		||||
  
 | 
			
		||||
  @Override
 | 
			
		||||
  public String generateSource() {
 | 
			
		||||
    return "";
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,493 @@
 | 
			
		||||
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;
 | 
			
		||||
import com.minres.rdl.rdl.ComponentInstance;
 | 
			
		||||
import com.minres.rdl.rdl.Instantiation;
 | 
			
		||||
import com.minres.rdl.rdl.Range;
 | 
			
		||||
import java.util.Date;
 | 
			
		||||
import org.eclipse.emf.common.util.EList;
 | 
			
		||||
import org.eclipse.xtend2.lib.StringConcatenation;
 | 
			
		||||
import org.eclipse.xtext.xbase.lib.Conversions;
 | 
			
		||||
import org.eclipse.xtext.xbase.lib.Functions.Function1;
 | 
			
		||||
import org.eclipse.xtext.xbase.lib.Functions.Function2;
 | 
			
		||||
import org.eclipse.xtext.xbase.lib.IterableExtensions;
 | 
			
		||||
import org.eclipse.xtext.xbase.lib.ListExtensions;
 | 
			
		||||
 | 
			
		||||
@SuppressWarnings("all")
 | 
			
		||||
public class FwRegfileGenerator extends RdlBaseGenerator {
 | 
			
		||||
  private final ComponentDefinition componentDefinition;
 | 
			
		||||
  
 | 
			
		||||
  public FwRegfileGenerator(final ComponentDefinition definition) {
 | 
			
		||||
    this.componentDefinition = definition;
 | 
			
		||||
  }
 | 
			
		||||
  
 | 
			
		||||
  @Override
 | 
			
		||||
  public String generateHeader() {
 | 
			
		||||
    StringConcatenation _builder = new StringConcatenation();
 | 
			
		||||
    _builder.append("////////////////////////////////////////////////////////////////////////////////");
 | 
			
		||||
    _builder.newLine();
 | 
			
		||||
    _builder.append("// Copyright (C) 2020, MINRES Technologies GmbH");
 | 
			
		||||
    _builder.newLine();
 | 
			
		||||
    _builder.append("// All rights reserved.");
 | 
			
		||||
    _builder.newLine();
 | 
			
		||||
    _builder.append("//");
 | 
			
		||||
    _builder.newLine();
 | 
			
		||||
    _builder.append("// Redistribution and use in source and binary forms, with or without");
 | 
			
		||||
    _builder.newLine();
 | 
			
		||||
    _builder.append("// modification, are permitted provided that the following conditions are met:");
 | 
			
		||||
    _builder.newLine();
 | 
			
		||||
    _builder.append("//");
 | 
			
		||||
    _builder.newLine();
 | 
			
		||||
    _builder.append("// 1. Redistributions of source code must retain the above copyright notice,");
 | 
			
		||||
    _builder.newLine();
 | 
			
		||||
    _builder.append("//    this list of conditions and the following disclaimer.");
 | 
			
		||||
    _builder.newLine();
 | 
			
		||||
    _builder.append("//");
 | 
			
		||||
    _builder.newLine();
 | 
			
		||||
    _builder.append("// 2. Redistributions in binary form must reproduce the above copyright notice,");
 | 
			
		||||
    _builder.newLine();
 | 
			
		||||
    _builder.append("//    this list of conditions and the following disclaimer in the documentation");
 | 
			
		||||
    _builder.newLine();
 | 
			
		||||
    _builder.append("//    and/or other materials provided with the distribution.");
 | 
			
		||||
    _builder.newLine();
 | 
			
		||||
    _builder.append("//");
 | 
			
		||||
    _builder.newLine();
 | 
			
		||||
    _builder.append("// 3. Neither the name of the copyright holder nor the names of its contributors");
 | 
			
		||||
    _builder.newLine();
 | 
			
		||||
    _builder.append("//    may be used to endorse or promote products derived from this software");
 | 
			
		||||
    _builder.newLine();
 | 
			
		||||
    _builder.append("//    without specific prior written permission.");
 | 
			
		||||
    _builder.newLine();
 | 
			
		||||
    _builder.append("//");
 | 
			
		||||
    _builder.newLine();
 | 
			
		||||
    _builder.append("// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"");
 | 
			
		||||
    _builder.newLine();
 | 
			
		||||
    _builder.append("// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE");
 | 
			
		||||
    _builder.newLine();
 | 
			
		||||
    _builder.append("// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE");
 | 
			
		||||
    _builder.newLine();
 | 
			
		||||
    _builder.append("// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE");
 | 
			
		||||
    _builder.newLine();
 | 
			
		||||
    _builder.append("// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR");
 | 
			
		||||
    _builder.newLine();
 | 
			
		||||
    _builder.append("// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF");
 | 
			
		||||
    _builder.newLine();
 | 
			
		||||
    _builder.append("// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS");
 | 
			
		||||
    _builder.newLine();
 | 
			
		||||
    _builder.append("// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN");
 | 
			
		||||
    _builder.newLine();
 | 
			
		||||
    _builder.append("// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)");
 | 
			
		||||
    _builder.newLine();
 | 
			
		||||
    _builder.append("// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE");
 | 
			
		||||
    _builder.newLine();
 | 
			
		||||
    _builder.append("// POSSIBILITY OF SUCH DAMAGE.");
 | 
			
		||||
    _builder.newLine();
 | 
			
		||||
    _builder.append("//");
 | 
			
		||||
    _builder.newLine();
 | 
			
		||||
    _builder.append("// Created on: ");
 | 
			
		||||
    Date _date = new Date();
 | 
			
		||||
    _builder.append(_date);
 | 
			
		||||
    _builder.newLineIfNotEmpty();
 | 
			
		||||
    _builder.append("//             *      ");
 | 
			
		||||
    String _name = this.componentDefinition.getName();
 | 
			
		||||
    _builder.append(_name);
 | 
			
		||||
    _builder.append(".h Author: <RDL Generator>");
 | 
			
		||||
    _builder.newLineIfNotEmpty();
 | 
			
		||||
    _builder.append("//");
 | 
			
		||||
    _builder.newLine();
 | 
			
		||||
    _builder.append("////////////////////////////////////////////////////////////////////////////////");
 | 
			
		||||
    _builder.newLine();
 | 
			
		||||
    _builder.newLine();
 | 
			
		||||
    _builder.append("#ifndef _");
 | 
			
		||||
    String _upperCase = this.componentDefinition.getName().toUpperCase();
 | 
			
		||||
    _builder.append(_upperCase);
 | 
			
		||||
    _builder.append("_H_");
 | 
			
		||||
    _builder.newLineIfNotEmpty();
 | 
			
		||||
    _builder.append("#define _");
 | 
			
		||||
    String _upperCase_1 = this.componentDefinition.getName().toUpperCase();
 | 
			
		||||
    _builder.append(_upperCase_1);
 | 
			
		||||
    _builder.append("_H_");
 | 
			
		||||
    _builder.newLineIfNotEmpty();
 | 
			
		||||
    _builder.newLine();
 | 
			
		||||
    _builder.append("#include <util/bit_field.h>");
 | 
			
		||||
    _builder.newLine();
 | 
			
		||||
    _builder.append("#include <nonstd/span.hpp>");
 | 
			
		||||
    _builder.newLine();
 | 
			
		||||
    _builder.append("#include <cstdint>");
 | 
			
		||||
    _builder.newLine();
 | 
			
		||||
    _builder.newLine();
 | 
			
		||||
    _builder.append("template<size_t BASE_ADDR>");
 | 
			
		||||
    _builder.newLine();
 | 
			
		||||
    _builder.append("struct ");
 | 
			
		||||
    String _name_1 = this.componentDefinition.getName();
 | 
			
		||||
    _builder.append(_name_1);
 | 
			
		||||
    _builder.append(" {");
 | 
			
		||||
    _builder.newLineIfNotEmpty();
 | 
			
		||||
    _builder.newLine();
 | 
			
		||||
    {
 | 
			
		||||
      EList<ComponentDefinition> _componentDefinitions = this.componentDefinition.getComponentDefinitions();
 | 
			
		||||
      for(final ComponentDefinition cdef : _componentDefinitions) {
 | 
			
		||||
        {
 | 
			
		||||
          ComponentDefinitionType _type = cdef.getType();
 | 
			
		||||
          boolean _equals = Objects.equal(_type, ComponentDefinitionType.REG);
 | 
			
		||||
          if (_equals) {
 | 
			
		||||
            _builder.append("    ");
 | 
			
		||||
            _builder.append("BEGIN_BF_DECL(");
 | 
			
		||||
            String _effectiveName = RdlUtil.effectiveName(cdef);
 | 
			
		||||
            _builder.append(_effectiveName, "    ");
 | 
			
		||||
            _builder.append("+\'_t\'», uint");
 | 
			
		||||
            _builder.append(cdef, "    ");
 | 
			
		||||
            _builder.append("_t);");
 | 
			
		||||
            _builder.newLineIfNotEmpty();
 | 
			
		||||
            _builder.append("    ");
 | 
			
		||||
            String _genFieldDeclarations = this.genFieldDeclarations(cdef);
 | 
			
		||||
            _builder.append(_genFieldDeclarations, "    ");
 | 
			
		||||
            _builder.newLineIfNotEmpty();
 | 
			
		||||
            _builder.append("    ");
 | 
			
		||||
            _builder.append("END_BF_DECL();");
 | 
			
		||||
            _builder.newLine();
 | 
			
		||||
          }
 | 
			
		||||
        }
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
    {
 | 
			
		||||
      EList<Instantiation> _instantiations = this.componentDefinition.getInstantiations();
 | 
			
		||||
      for(final Instantiation instantiation : _instantiations) {
 | 
			
		||||
        {
 | 
			
		||||
          if (((instantiation.getComponentRef() != null) && Objects.equal(instantiation.getComponentRef().getType(), ComponentDefinitionType.REG))) {
 | 
			
		||||
            _builder.append("    ");
 | 
			
		||||
            String _effectiveName_1 = RdlUtil.effectiveName(instantiation.getComponentRef());
 | 
			
		||||
            _builder.append(_effectiveName_1, "    ");
 | 
			
		||||
            _builder.append("+\'_t\' ");
 | 
			
		||||
            final Function1<ComponentInstance, String> _function = (ComponentInstance it) -> {
 | 
			
		||||
              return it.getName();
 | 
			
		||||
            };
 | 
			
		||||
            String _join = IterableExtensions.join(ListExtensions.<ComponentInstance, String>map(instantiation.getComponentInstances(), _function), ", ");
 | 
			
		||||
            _builder.append(_join, "    ");
 | 
			
		||||
            _builder.append(";");
 | 
			
		||||
            _builder.newLineIfNotEmpty();
 | 
			
		||||
          }
 | 
			
		||||
        }
 | 
			
		||||
        {
 | 
			
		||||
          if (((instantiation.getComponent() != null) && Objects.equal(instantiation.getComponent().getType(), ComponentDefinitionType.REG))) {
 | 
			
		||||
            {
 | 
			
		||||
              boolean _isFilledByField = this.isFilledByField(instantiation);
 | 
			
		||||
              boolean _not = (!_isFilledByField);
 | 
			
		||||
              if (_not) {
 | 
			
		||||
                _builder.append("    ");
 | 
			
		||||
                _builder.append("BEGIN_BF_DECL(");
 | 
			
		||||
                String _effectiveName_2 = RdlUtil.effectiveName(instantiation.getComponent());
 | 
			
		||||
                _builder.append(_effectiveName_2, "    ");
 | 
			
		||||
                _builder.append("_t, uint");
 | 
			
		||||
                long _size = RdlUtil.getSize(instantiation);
 | 
			
		||||
                _builder.append(_size, "    ");
 | 
			
		||||
                _builder.append("_t);");
 | 
			
		||||
                _builder.newLineIfNotEmpty();
 | 
			
		||||
                _builder.append("    ");
 | 
			
		||||
                _builder.append("    ");
 | 
			
		||||
                String _genFieldDeclarations_1 = this.genFieldDeclarations(RdlUtil.definingComponent(instantiation));
 | 
			
		||||
                _builder.append(_genFieldDeclarations_1, "        ");
 | 
			
		||||
                _builder.newLineIfNotEmpty();
 | 
			
		||||
                _builder.append("    ");
 | 
			
		||||
                _builder.append("END_BF_DECL() ");
 | 
			
		||||
                final Function1<ComponentInstance, Boolean> _function_1 = (ComponentInstance it) -> {
 | 
			
		||||
                  Range _range = it.getRange();
 | 
			
		||||
                  return Boolean.valueOf((_range == null));
 | 
			
		||||
                };
 | 
			
		||||
                final Function1<ComponentInstance, String> _function_2 = (ComponentInstance it) -> {
 | 
			
		||||
                  String _name_2 = it.getName();
 | 
			
		||||
                  return ("r_" + _name_2);
 | 
			
		||||
                };
 | 
			
		||||
                String _join_1 = IterableExtensions.join(IterableExtensions.<ComponentInstance, String>map(IterableExtensions.<ComponentInstance>filter(instantiation.getComponentInstances(), _function_1), _function_2), ", ");
 | 
			
		||||
                _builder.append(_join_1, "    ");
 | 
			
		||||
                _builder.append(";");
 | 
			
		||||
                _builder.newLineIfNotEmpty();
 | 
			
		||||
                _builder.newLine();
 | 
			
		||||
              }
 | 
			
		||||
            }
 | 
			
		||||
          }
 | 
			
		||||
        }
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
    _builder.append("    ");
 | 
			
		||||
    _builder.append("// register access");
 | 
			
		||||
    _builder.newLine();
 | 
			
		||||
    {
 | 
			
		||||
      EList<Instantiation> _instantiations_1 = this.componentDefinition.getInstantiations();
 | 
			
		||||
      for(final Instantiation instantiation_1 : _instantiations_1) {
 | 
			
		||||
        {
 | 
			
		||||
          EList<ComponentInstance> _componentInstances = instantiation_1.getComponentInstances();
 | 
			
		||||
          for(final ComponentInstance instance : _componentInstances) {
 | 
			
		||||
            {
 | 
			
		||||
              Range _range = instance.getRange();
 | 
			
		||||
              boolean _tripleEquals = (_range == null);
 | 
			
		||||
              if (_tripleEquals) {
 | 
			
		||||
                {
 | 
			
		||||
                  boolean _isFilledByField_1 = this.isFilledByField(instantiation_1);
 | 
			
		||||
                  if (_isFilledByField_1) {
 | 
			
		||||
                    _builder.append("    ");
 | 
			
		||||
                    _builder.append("static inline uint");
 | 
			
		||||
                    long _size_1 = RdlUtil.getSize(instantiation_1);
 | 
			
		||||
                    _builder.append(_size_1, "    ");
 | 
			
		||||
                    _builder.append("_t& ");
 | 
			
		||||
                    String _name_2 = instance.getName();
 | 
			
		||||
                    _builder.append(_name_2, "    ");
 | 
			
		||||
                    _builder.append("(){");
 | 
			
		||||
                    _builder.newLineIfNotEmpty();
 | 
			
		||||
                    _builder.append("    ");
 | 
			
		||||
                    _builder.append("    ");
 | 
			
		||||
                    _builder.append("return *reinterpret_cast<");
 | 
			
		||||
                    String _name_3 = instance.getName();
 | 
			
		||||
                    _builder.append(_name_3, "        ");
 | 
			
		||||
                    _builder.append("_t*>(BASE_ADDR+");
 | 
			
		||||
                    IntegerWithRadix _addressValue = RdlUtil.addressValue(instance);
 | 
			
		||||
                    _builder.append(_addressValue, "        ");
 | 
			
		||||
                    _builder.append("UL);");
 | 
			
		||||
                    _builder.newLineIfNotEmpty();
 | 
			
		||||
                    _builder.append("    ");
 | 
			
		||||
                    _builder.append("}");
 | 
			
		||||
                    _builder.newLine();
 | 
			
		||||
                  }
 | 
			
		||||
                }
 | 
			
		||||
                {
 | 
			
		||||
                  boolean _isFilledByField_2 = this.isFilledByField(instantiation_1);
 | 
			
		||||
                  boolean _not_1 = (!_isFilledByField_2);
 | 
			
		||||
                  if (_not_1) {
 | 
			
		||||
                    _builder.append("    ");
 | 
			
		||||
                    _builder.append("static inline ");
 | 
			
		||||
                    String _name_4 = instance.getName();
 | 
			
		||||
                    _builder.append(_name_4, "    ");
 | 
			
		||||
                    _builder.append("_t& ");
 | 
			
		||||
                    String _name_5 = instance.getName();
 | 
			
		||||
                    _builder.append(_name_5, "    ");
 | 
			
		||||
                    _builder.append("(){");
 | 
			
		||||
                    _builder.newLineIfNotEmpty();
 | 
			
		||||
                    _builder.append("    ");
 | 
			
		||||
                    _builder.append("    ");
 | 
			
		||||
                    _builder.append("return *reinterpret_cast<");
 | 
			
		||||
                    String _name_6 = instance.getName();
 | 
			
		||||
                    _builder.append(_name_6, "        ");
 | 
			
		||||
                    _builder.append("_t*>(BASE_ADDR+");
 | 
			
		||||
                    IntegerWithRadix _addressValue_1 = RdlUtil.addressValue(instance);
 | 
			
		||||
                    _builder.append(_addressValue_1, "        ");
 | 
			
		||||
                    _builder.append("UL);");
 | 
			
		||||
                    _builder.newLineIfNotEmpty();
 | 
			
		||||
                    _builder.append("    ");
 | 
			
		||||
                    _builder.append("}");
 | 
			
		||||
                    _builder.newLine();
 | 
			
		||||
                  }
 | 
			
		||||
                }
 | 
			
		||||
              }
 | 
			
		||||
            }
 | 
			
		||||
            {
 | 
			
		||||
              Range _range_1 = instance.getRange();
 | 
			
		||||
              boolean _tripleNotEquals = (_range_1 != null);
 | 
			
		||||
              if (_tripleNotEquals) {
 | 
			
		||||
                {
 | 
			
		||||
                  boolean _isFilledByField_3 = this.isFilledByField(instantiation_1);
 | 
			
		||||
                  if (_isFilledByField_3) {
 | 
			
		||||
                    _builder.append("    ");
 | 
			
		||||
                    _builder.append("static inline nonstd::span<uint");
 | 
			
		||||
                    long _size_2 = RdlUtil.getSize(instantiation_1);
 | 
			
		||||
                    _builder.append(_size_2, "    ");
 | 
			
		||||
                    _builder.append("_t, ");
 | 
			
		||||
                    long _absSize = this.absSize(instance.getRange());
 | 
			
		||||
                    _builder.append(_absSize, "    ");
 | 
			
		||||
                    _builder.append(">& ");
 | 
			
		||||
                    String _name_7 = instance.getName();
 | 
			
		||||
                    _builder.append(_name_7, "    ");
 | 
			
		||||
                    _builder.append("(){");
 | 
			
		||||
                    _builder.newLineIfNotEmpty();
 | 
			
		||||
                    _builder.append("    ");
 | 
			
		||||
                    _builder.append("    ");
 | 
			
		||||
                    _builder.append("return *reinterpret_cast<nonstd::span<uint");
 | 
			
		||||
                    long _size_3 = RdlUtil.getSize(instantiation_1);
 | 
			
		||||
                    _builder.append(_size_3, "        ");
 | 
			
		||||
                    _builder.append("_t, ");
 | 
			
		||||
                    long _absSize_1 = this.absSize(instance.getRange());
 | 
			
		||||
                    _builder.append(_absSize_1, "        ");
 | 
			
		||||
                    _builder.append(">*>(BASE_ADDR+");
 | 
			
		||||
                    IntegerWithRadix _addressValue_2 = RdlUtil.addressValue(instance);
 | 
			
		||||
                    _builder.append(_addressValue_2, "        ");
 | 
			
		||||
                    _builder.append("UL);");
 | 
			
		||||
                    _builder.newLineIfNotEmpty();
 | 
			
		||||
                    _builder.append("    ");
 | 
			
		||||
                    _builder.append("}");
 | 
			
		||||
                    _builder.newLine();
 | 
			
		||||
                  }
 | 
			
		||||
                }
 | 
			
		||||
                {
 | 
			
		||||
                  boolean _isFilledByField_4 = this.isFilledByField(instantiation_1);
 | 
			
		||||
                  boolean _not_2 = (!_isFilledByField_4);
 | 
			
		||||
                  if (_not_2) {
 | 
			
		||||
                    _builder.append("    ");
 | 
			
		||||
                    _builder.append("static inline nonstd::span<");
 | 
			
		||||
                    String _name_8 = instance.getName();
 | 
			
		||||
                    _builder.append(_name_8, "    ");
 | 
			
		||||
                    _builder.append("_t, ");
 | 
			
		||||
                    long _absSize_2 = this.absSize(instance.getRange());
 | 
			
		||||
                    _builder.append(_absSize_2, "    ");
 | 
			
		||||
                    _builder.append(">& ");
 | 
			
		||||
                    String _name_9 = instance.getName();
 | 
			
		||||
                    _builder.append(_name_9, "    ");
 | 
			
		||||
                    _builder.append("(){");
 | 
			
		||||
                    _builder.newLineIfNotEmpty();
 | 
			
		||||
                    _builder.append("    ");
 | 
			
		||||
                    _builder.append("    ");
 | 
			
		||||
                    _builder.append("return *reinterpret_cast<nonstd::span<");
 | 
			
		||||
                    String _name_10 = instance.getName();
 | 
			
		||||
                    _builder.append(_name_10, "        ");
 | 
			
		||||
                    _builder.append("_t, ");
 | 
			
		||||
                    long _absSize_3 = this.absSize(instance.getRange());
 | 
			
		||||
                    _builder.append(_absSize_3, "        ");
 | 
			
		||||
                    _builder.append(">*>(BASE_ADDR+");
 | 
			
		||||
                    IntegerWithRadix _addressValue_3 = RdlUtil.addressValue(instance);
 | 
			
		||||
                    _builder.append(_addressValue_3, "        ");
 | 
			
		||||
                    _builder.append("UL);");
 | 
			
		||||
                    _builder.newLineIfNotEmpty();
 | 
			
		||||
                    _builder.append("    ");
 | 
			
		||||
                    _builder.append("}");
 | 
			
		||||
                    _builder.newLine();
 | 
			
		||||
                  }
 | 
			
		||||
                }
 | 
			
		||||
              }
 | 
			
		||||
            }
 | 
			
		||||
          }
 | 
			
		||||
        }
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
    _builder.append("};");
 | 
			
		||||
    _builder.newLine();
 | 
			
		||||
    _builder.newLine();
 | 
			
		||||
    _builder.append("#endif // _");
 | 
			
		||||
    String _upperCase_2 = this.componentDefinition.getName().toUpperCase();
 | 
			
		||||
    _builder.append(_upperCase_2);
 | 
			
		||||
    _builder.append("_H_");
 | 
			
		||||
    _builder.newLineIfNotEmpty();
 | 
			
		||||
    return _builder.toString();
 | 
			
		||||
  }
 | 
			
		||||
  
 | 
			
		||||
  public long absSize(final Range range) {
 | 
			
		||||
    Object _size = range.getSize();
 | 
			
		||||
    boolean _tripleNotEquals = (_size != null);
 | 
			
		||||
    if (_tripleNotEquals) {
 | 
			
		||||
      Object _size_1 = range.getSize();
 | 
			
		||||
      return ((IntegerWithRadix) _size_1).value;
 | 
			
		||||
    } else {
 | 
			
		||||
      Object _left = range.getLeft();
 | 
			
		||||
      Object _right = range.getRight();
 | 
			
		||||
      long _abs = Math.abs((((IntegerWithRadix) _left).value - ((IntegerWithRadix) _right).value));
 | 
			
		||||
      return (_abs + 1);
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
  
 | 
			
		||||
  public boolean isFilledByField(final Instantiation instantiation) {
 | 
			
		||||
    final int fieldCount = this.instanceCountOfType(instantiation.getComponent(), ComponentDefinitionType.FIELD);
 | 
			
		||||
    if ((fieldCount == 1)) {
 | 
			
		||||
      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 = RdlUtil.getSize(field);
 | 
			
		||||
        return (instSize == _size);
 | 
			
		||||
      }
 | 
			
		||||
      Object _size_1 = range.getSize();
 | 
			
		||||
      boolean _tripleNotEquals = (_size_1 != null);
 | 
			
		||||
      if (_tripleNotEquals) {
 | 
			
		||||
        Object _size_2 = range.getSize();
 | 
			
		||||
        return (instSize == ((IntegerWithRadix) _size_2).value);
 | 
			
		||||
      } else {
 | 
			
		||||
        Object _left = range.getLeft();
 | 
			
		||||
        final long left = ((IntegerWithRadix) _left).value;
 | 
			
		||||
        Object _right = range.getRight();
 | 
			
		||||
        final long right = ((IntegerWithRadix) _right).value;
 | 
			
		||||
        long _xifexpression = (long) 0;
 | 
			
		||||
        if ((left > right)) {
 | 
			
		||||
          _xifexpression = ((left - right) + 1);
 | 
			
		||||
        } else {
 | 
			
		||||
          _xifexpression = ((right - left) + 1);
 | 
			
		||||
        }
 | 
			
		||||
        final long size = _xifexpression;
 | 
			
		||||
        return (instSize == size);
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
    return false;
 | 
			
		||||
  }
 | 
			
		||||
  
 | 
			
		||||
  public int instanceCountOfType(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() + (p1).intValue()));
 | 
			
		||||
    };
 | 
			
		||||
    return (int) IterableExtensions.<Integer>reduce(IterableExtensions.<Instantiation, Integer>map(RdlUtil.instantiationsOfType(definition, type), _function), _function_1);
 | 
			
		||||
  }
 | 
			
		||||
  
 | 
			
		||||
  @Override
 | 
			
		||||
  public String generateSource() {
 | 
			
		||||
    return "";
 | 
			
		||||
  }
 | 
			
		||||
  
 | 
			
		||||
  public String genFieldDeclarations(final ComponentDefinition componentDef) {
 | 
			
		||||
    String _xblockexpression = null;
 | 
			
		||||
    {
 | 
			
		||||
      long i = 0L;
 | 
			
		||||
      String res = "";
 | 
			
		||||
      EList<Instantiation> _instantiations = componentDef.getInstantiations();
 | 
			
		||||
      for (final Instantiation inst : _instantiations) {
 | 
			
		||||
        EList<ComponentInstance> _componentInstances = inst.getComponentInstances();
 | 
			
		||||
        for (final ComponentInstance compInst : _componentInstances) {
 | 
			
		||||
          Object _size = compInst.getRange().getSize();
 | 
			
		||||
          boolean _tripleNotEquals = (_size != null);
 | 
			
		||||
          if (_tripleNotEquals) {
 | 
			
		||||
            String _res = res;
 | 
			
		||||
            StringConcatenation _builder = new StringConcatenation();
 | 
			
		||||
            _builder.append("BF_FIELD(");
 | 
			
		||||
            String _name = compInst.getName();
 | 
			
		||||
            _builder.append(_name);
 | 
			
		||||
            _builder.append(", ");
 | 
			
		||||
            _builder.append(i);
 | 
			
		||||
            _builder.append(", ");
 | 
			
		||||
            Object _size_1 = compInst.getRange().getSize();
 | 
			
		||||
            _builder.append(((IntegerWithRadix) _size_1).value);
 | 
			
		||||
            _builder.append(");");
 | 
			
		||||
            _builder.newLineIfNotEmpty();
 | 
			
		||||
            res = (_res + _builder);
 | 
			
		||||
            long _i = i;
 | 
			
		||||
            Object _size_2 = compInst.getRange().getSize();
 | 
			
		||||
            i = (_i + ((IntegerWithRadix) _size_2).value);
 | 
			
		||||
          } else {
 | 
			
		||||
            Object _left = compInst.getRange().getLeft();
 | 
			
		||||
            final long start = ((IntegerWithRadix) _left).value;
 | 
			
		||||
            Object _right = compInst.getRange().getRight();
 | 
			
		||||
            final long end = ((IntegerWithRadix) _right).value;
 | 
			
		||||
            String _res_1 = res;
 | 
			
		||||
            StringConcatenation _builder_1 = new StringConcatenation();
 | 
			
		||||
            _builder_1.append("BF_FIELD(");
 | 
			
		||||
            String _name_1 = compInst.getName();
 | 
			
		||||
            _builder_1.append(_name_1);
 | 
			
		||||
            _builder_1.append(", ");
 | 
			
		||||
            _builder_1.append(end);
 | 
			
		||||
            _builder_1.append(", ");
 | 
			
		||||
            _builder_1.append(((start - end) + 1));
 | 
			
		||||
            _builder_1.append(");");
 | 
			
		||||
            _builder_1.newLineIfNotEmpty();
 | 
			
		||||
            res = (_res_1 + _builder_1);
 | 
			
		||||
            long _max = Math.max(start, end);
 | 
			
		||||
            long _plus = (_max + 1);
 | 
			
		||||
            i = _plus;
 | 
			
		||||
          }
 | 
			
		||||
        }
 | 
			
		||||
      }
 | 
			
		||||
      _xblockexpression = res;
 | 
			
		||||
    }
 | 
			
		||||
    return _xblockexpression;
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
@@ -5,18 +5,25 @@ package com.minres.rdl.generator;
 | 
			
		||||
 | 
			
		||||
import com.minres.rdl.RdlUtil;
 | 
			
		||||
import com.minres.rdl.generator.AddrmapGenerator;
 | 
			
		||||
import com.minres.rdl.generator.FwAddrmapGenerator;
 | 
			
		||||
import com.minres.rdl.generator.FwRegfileGenerator;
 | 
			
		||||
import com.minres.rdl.generator.RdlBaseGenerator;
 | 
			
		||||
import com.minres.rdl.generator.RegfileGenerator;
 | 
			
		||||
import com.minres.rdl.rdl.ComponentDefinition;
 | 
			
		||||
import com.minres.rdl.rdl.ComponentDefinitionType;
 | 
			
		||||
import java.util.Collections;
 | 
			
		||||
import java.util.Map;
 | 
			
		||||
import java.util.function.BiConsumer;
 | 
			
		||||
import org.eclipse.emf.common.notify.Notifier;
 | 
			
		||||
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.eclipse.xtext.xbase.lib.CollectionLiterals;
 | 
			
		||||
import org.eclipse.xtext.xbase.lib.Exceptions;
 | 
			
		||||
import org.eclipse.xtext.xbase.lib.Functions.Function1;
 | 
			
		||||
import org.eclipse.xtext.xbase.lib.IteratorExtensions;
 | 
			
		||||
import org.eclipse.xtext.xbase.lib.Pair;
 | 
			
		||||
import org.eclipse.xtext.xbase.lib.Procedures.Procedure1;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
@@ -35,35 +42,48 @@ public class RDLGenerator extends AbstractGenerator {
 | 
			
		||||
      return ((ComponentDefinition) it);
 | 
			
		||||
    };
 | 
			
		||||
    final Procedure1<ComponentDefinition> _function_2 = (ComponentDefinition it) -> {
 | 
			
		||||
      final RdlBaseGenerator gen = this.fileGenerator(it);
 | 
			
		||||
      if ((gen != null)) {
 | 
			
		||||
        final String header = gen.generateHeader();
 | 
			
		||||
        if (((header != null) && (header.length() > 0))) {
 | 
			
		||||
          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 _effectiveName_1 = RdlUtil.effectiveName(it);
 | 
			
		||||
          String _plus_1 = (_effectiveName_1 + ".cpp");
 | 
			
		||||
          fsa.generateFile(_plus_1, this.outputConfig(fsa, "src-out"), source);
 | 
			
		||||
        }
 | 
			
		||||
      final Map<String, RdlBaseGenerator> genMap = this.fileGenerator(it);
 | 
			
		||||
      if ((genMap != null)) {
 | 
			
		||||
        final BiConsumer<String, RdlBaseGenerator> _function_3 = (String p1, RdlBaseGenerator gen) -> {
 | 
			
		||||
          final String header = gen.generateHeader();
 | 
			
		||||
          if (((header != null) && (header.length() > 0))) {
 | 
			
		||||
            String _effectiveName = RdlUtil.effectiveName(it);
 | 
			
		||||
            String _plus = ((p1 + "/") + _effectiveName);
 | 
			
		||||
            String _plus_1 = (_plus + ".h");
 | 
			
		||||
            fsa.generateFile(_plus_1, this.outputConfig(fsa, "incl-out"), header);
 | 
			
		||||
          }
 | 
			
		||||
          final String source = gen.generateSource();
 | 
			
		||||
          if (((source != null) && (source.length() > 0))) {
 | 
			
		||||
            String _effectiveName_1 = RdlUtil.effectiveName(it);
 | 
			
		||||
            String _plus_2 = ((p1 + "/") + _effectiveName_1);
 | 
			
		||||
            String _plus_3 = (_plus_2 + ".cpp");
 | 
			
		||||
            fsa.generateFile(_plus_3, this.outputConfig(fsa, "src-out"), source);
 | 
			
		||||
          }
 | 
			
		||||
        };
 | 
			
		||||
        genMap.forEach(_function_3);
 | 
			
		||||
      }
 | 
			
		||||
    };
 | 
			
		||||
    IteratorExtensions.<ComponentDefinition>forEach(IteratorExtensions.<Notifier, ComponentDefinition>map(IteratorExtensions.<Notifier>filter(resource.getResourceSet().getAllContents(), _function), _function_1), _function_2);
 | 
			
		||||
  }
 | 
			
		||||
  
 | 
			
		||||
  public RdlBaseGenerator fileGenerator(final ComponentDefinition definition) {
 | 
			
		||||
    RdlBaseGenerator _switchResult = null;
 | 
			
		||||
  public Map<String, RdlBaseGenerator> fileGenerator(final ComponentDefinition definition) {
 | 
			
		||||
    Map<String, RdlBaseGenerator> _switchResult = null;
 | 
			
		||||
    ComponentDefinitionType _type = definition.getType();
 | 
			
		||||
    if (_type != null) {
 | 
			
		||||
      switch (_type) {
 | 
			
		||||
        case REGFILE:
 | 
			
		||||
          _switchResult = new RegfileGenerator(definition);
 | 
			
		||||
          RegfileGenerator _regfileGenerator = new RegfileGenerator(definition);
 | 
			
		||||
          Pair<String, RegfileGenerator> _mappedTo = Pair.<String, RegfileGenerator>of("vp", _regfileGenerator);
 | 
			
		||||
          FwRegfileGenerator _fwRegfileGenerator = new FwRegfileGenerator(definition);
 | 
			
		||||
          Pair<String, FwRegfileGenerator> _mappedTo_1 = Pair.<String, FwRegfileGenerator>of("fw", _fwRegfileGenerator);
 | 
			
		||||
          _switchResult = Collections.<String, RdlBaseGenerator>unmodifiableMap(CollectionLiterals.<String, RdlBaseGenerator>newHashMap(_mappedTo, _mappedTo_1));
 | 
			
		||||
          break;
 | 
			
		||||
        case ADDRMAP:
 | 
			
		||||
          _switchResult = new AddrmapGenerator(definition);
 | 
			
		||||
          AddrmapGenerator _addrmapGenerator = new AddrmapGenerator(definition);
 | 
			
		||||
          Pair<String, AddrmapGenerator> _mappedTo_2 = Pair.<String, AddrmapGenerator>of("vp", _addrmapGenerator);
 | 
			
		||||
          FwAddrmapGenerator _fwAddrmapGenerator = new FwAddrmapGenerator(definition);
 | 
			
		||||
          Pair<String, FwAddrmapGenerator> _mappedTo_3 = Pair.<String, FwAddrmapGenerator>of("fw", _fwAddrmapGenerator);
 | 
			
		||||
          _switchResult = Collections.<String, RdlBaseGenerator>unmodifiableMap(CollectionLiterals.<String, RdlBaseGenerator>newHashMap(_mappedTo_2, _mappedTo_3));
 | 
			
		||||
          break;
 | 
			
		||||
        default:
 | 
			
		||||
          _switchResult = null;
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user