<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE article PUBLIC "-//NLM//DTD Journal Publishing DTD v3.0 20080202//EN" "http://dtd.nlm.nih.gov/publishing/3.0/journalpublishing3.dtd">
<article xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:xlink="http://www.w3.org/1999/xlink" dtd-version="3.0" xml:lang="en" article-type="research article">
 <front>
  <journal-meta>
   <journal-id journal-id-type="publisher-id">
    cs
   </journal-id>
   <journal-title-group>
    <journal-title>
     Circuits and Systems
    </journal-title>
   </journal-title-group>
   <issn pub-type="epub">
    2153-1285
   </issn>
   <issn publication-format="print">
    2153-1293
   </issn>
   <publisher>
    <publisher-name>
     Scientific Research Publishing
    </publisher-name>
   </publisher>
  </journal-meta>
  <article-meta>
   <article-id pub-id-type="doi">
    10.4236/cs.2025.162002
   </article-id>
   <article-id pub-id-type="publisher-id">
    cs-145048
   </article-id>
   <article-categories>
    <subj-group subj-group-type="heading">
     <subject>
      Articles
     </subject>
    </subj-group>
    <subj-group subj-group-type="Discipline-v2">
     <subject>
      Computer Science 
     </subject>
     <subject>
       Communications, Engineering, Physics 
     </subject>
     <subject>
       Mathematics
     </subject>
    </subj-group>
   </article-categories>
   <title-group>
    MARTE-Based Formal Modeling with Reinforcement Learning for Architecture-Agnostic Assembler Design in Configurable Processors
   </title-group>
   <contrib-group>
    <contrib contrib-type="author" xlink:type="simple">
     <name name-style="western">
      <surname>
       Liangshun
      </surname>
      <given-names>
       Wu
      </given-names>
     </name> 
     <xref ref-type="aff" rid="aff1"> 
      <sup>1</sup>
     </xref> 
     <xref ref-type="aff" rid="aff2"> 
      <sup>2</sup>
     </xref> 
     <xref ref-type="aff" rid="aff3"> 
      <sup>3</sup>
     </xref>
    </contrib>
    <contrib contrib-type="author" xlink:type="simple">
     <name name-style="western">
      <surname>
       Bin
      </surname>
      <given-names>
       Zhang
      </given-names>
     </name> 
     <xref ref-type="aff" rid="aff4"> 
      <sup>4</sup>
     </xref> 
     <xref ref-type="aff" rid="aff5"> 
      <sup>5</sup>
     </xref> 
     <xref ref-type="aff" rid="aff6"> 
      <sup>6</sup>
     </xref>
    </contrib>
   </contrib-group> 
   <aff id="aff1">
    <addr-line>
     aShanghai Key Laboratory of Trustworthy Computing, East China Normal University, Shanghai, China
    </addr-line> 
   </aff> 
   <aff id="aff2">
    <addr-line>
     aSchool of Computer Science and Engineering, Guangzhou Institute of Technology, Guangzhou, China
    </addr-line> 
   </aff> 
   <aff id="aff3">
    <addr-line>
     aSchool of Integrated Circuit (School of Information Science and Electronic Engineering), Shanghai Jiao Tong University, Shanghai, China
    </addr-line> 
   </aff> 
   <aff id="aff4">
    <addr-line>
     aInformation Network Center, School of Information Network Security, Xinjiang University of Political Science and Law, Tumushuke, China
    </addr-line> 
   </aff> 
   <aff id="aff5">
    <addr-line>
     aSchool of Remote Sensing and Information Engineering, Wuhan University, Wuhan, China
    </addr-line> 
   </aff> 
   <aff id="aff6">
    <addr-line>
     aDepartment of Computer, City University of Hong Kong, Hong Kong SAR, China
    </addr-line> 
   </aff> 
   <pub-date pub-type="epub">
    <day>
     25
    </day> 
    <month>
     08
    </month>
    <year>
     2025
    </year>
   </pub-date> 
   <volume>
    16
   </volume> 
   <issue>
    02
   </issue>
   <fpage>
    25
   </fpage>
   <lpage>
    48
   </lpage>
   <history>
    <date date-type="received">
     <day>
      23,
     </day>
     <month>
      January
     </month>
     <year>
      2025
     </year>
    </date>
    <date date-type="published">
     <day>
      25,
     </day>
     <month>
      January
     </month>
     <year>
      2025
     </year> 
    </date> 
    <date date-type="accepted">
     <day>
      25,
     </day>
     <month>
      February
     </month>
     <year>
      2025
     </year> 
    </date>
   </history>
   <permissions>
    <copyright-statement>
     © Copyright 2014 by authors and Scientific Research Publishing Inc. 
    </copyright-statement>
    <copyright-year>
     2014
    </copyright-year>
    <license>
     <license-p>
      This work is licensed under the Creative Commons Attribution International License (CC BY). http://creativecommons.org/licenses/by/4.0/
     </license-p>
    </license>
   </permissions>
   <abstract>
    This paper presents a configurable assembler framework enhanced with reinforcement learning (RL) and MARTE (Modeling and Analysis of Real-Time and Embedded Systems) constraints to address the challenges of rapidly evolving processor architectures. Our methodology integrates formal hardware/software modeling with self-optimizing configuration strategies, enabling automatic adaptation to instruction set architecture (ISA) modifications while ensuring correctness guarantees. The framework features a Common ISA Description Language (CIDL) interface that reduces code modification efforts by 85% compared to traditional assemblers, as demonstrated through four representative configuration scenarios. By formulating the adaptation process as a constrained Markov Decision Process, our RL-MARTE hybrid approach achieves 58% fewer configuration steps and 26.5% higher code density, i.e., the ratio of useful instruction bytes to total code size, than rule-based methods, while maintaining zero constraint violations. Experimental results on the TOP-32A processor extension demonstrate the solution’s effectiveness in handling complex ISA modifications like MIMD instructions, reducing average configuration time from 45.6 to 9.8 minutes per task. This work bridges the gap between formal verification and practical adaptability in compiler construction, offering a systematic approach for next-generation processor toolchain development.
   </abstract>
   <kwd-group> 
    <kwd>
     MARTE
    </kwd> 
    <kwd>
      Reinforcement Learning
    </kwd> 
    <kwd>
      ISA
    </kwd> 
    <kwd>
      GNU Binutils
    </kwd> 
    <kwd>
      Configurable Processor
    </kwd>
   </kwd-group>
  </article-meta>
 </front>
 <body>
  <sec id="s1">
   <title>1. Introduction</title>
   <p>The relentless evolution of domain-specific architecture has exposed critical limitations in traditional compiler toolchains. While reconfigurable processors like Tensilica’s Xtensa <xref ref-type="bibr" rid="scirp.145048-1">
     [1]
    </xref> and ARC HS <xref ref-type="bibr" rid="scirp.145048-2">
     [2]
    </xref> deliver unprecedented performance-power efficiency, their software ecosystems struggle to keep pace with architectural innovations. This toolchain lag creates a paradoxical situation where hardware reconfigurability outpaces software adaptability, particularly evident in assemblers, the fundamental bridge between architectural innovation and software deployment.</p>
   <p>Modern SoC design faces three pressing challenges: (1) Exponential growth in instruction set variants for specialized compute paradigms; (2) Tight verification windows requiring formal correctness guarantees; (3) Mounting pressure to automate performance optimization. Traditional assemblers, designed as static translation tools, prove inadequate on all fronts. Their hard-coded instruction mappings and manual optimization strategies cannot scale with annual increase in custom ISA extensions observed in RISC-V ecosystems <xref ref-type="bibr" rid="scirp.145048-3">
     [3]
    </xref>. This limitation forces developers into a costly cycle of toolchain re-engineering for each architectural iteration.</p>
   <p>Our work addresses these challenges through three key innovations. First, we introduce a Common ISA Description Language (CIDL) that decouples architectural specifications from translation logic, reducing code modification efforts by 85% compared to conventional approaches. Second, we integrate Model-Based Reinforcement Learning (MBRL) with the MARTE (Modeling and Analysis of Real-Time and Embedded Systems) framework, enabling automatic configuration optimization under formal constraints. Third, we develop a constraint-aware policy network that guarantees 100% compliance with critical encoding rules while exploring optimal configurations.</p>
   <p>The contributions of this work are:</p>
   <p>The remainder of this paper is organized as follows: Section II introduces basic knowledge and reviews related work. Section III presents our framework with RL-MARTE integration. Section IV validates through experiments. We conclude with future research directions in Section V.</p>
  </sec><sec id="s2">
   <title>2. Related Work</title>
   <sec id="s2_1">
    <title>2.1. Configurable Processor Fundamentals and TOP Processor Architecture</title>
    <p>Modern configurable processors enable application-specific optimization through three adaptation layers <xref ref-type="bibr" rid="scirp.145048-4">
      [4]
     </xref>: 1) Microarchitecture: FPGA/ASIC implementations with reconfigurable logic <xref ref-type="bibr" rid="scirp.145048-5">
      [5]
     </xref>; 2) Instruction Set: Extensible ISA support through coprocessor integration <xref ref-type="bibr" rid="scirp.145048-6">
      [6]
     </xref>; 3) Memory Hierarchy: Adaptive register files and cache configurations.</p>
    <p>The GNU Binutils <xref ref-type="bibr" rid="scirp.145048-7">
      [7]
     </xref> toolkit provides essential infrastructure for configurable assemblers: 1) BFD Library: Unified object file manipulation; 2) GAS Architecture: Modular assembler framework with MD interface; 3) Linker Scripts: Customizable memory allocation strategies.</p>
    <p>Our research platform features a hybrid RISC architecture with (see <xref ref-type="fig" rid="fig1">
      Figure 1
     </xref>):</p>
    <p>The instruction set combines RR-type (register-register) and RI-type (register-immediate) formats with configurable addressing modes, serving as our primary case study for assembler development.</p>
    <fig id="fig1" position="float">
     <label>Figure 1</label>
     <caption>
      <title>Figure 1. Target Platform: TOP ISA.</title>
     </caption>
     <graphic mimetype="image" position="float" xlink:type="simple" xlink:href="https://html.scirp.org/file/7601503-rId19.jpeg?20250825092233" />
    </fig>
   </sec>
   <sec id="s2_2">
    <title>2.2. Instruction Set Description Languages</title>
    <p>Configurable assemblers are supported by ongoing research in instruction set description languages (ISDL) <xref ref-type="bibr" rid="scirp.145048-8">
      [8]
     </xref>, which formalize processor architecture descriptions, enhancing the retargetability of compilers and assemblers. For example, ISDL allows for automatic assembler generation suited to specific instruction sets, improving tool flexibility and adaptability to evolving hardware. Recent advancements include Xiao and Liu’s 2023 ISADL, designed for Very Long Instruction Word (VLIW) architectures <xref ref-type="bibr" rid="scirp.145048-9">
      [9]
     </xref>, and their adaptive instruction set encoding method <xref ref-type="bibr" rid="scirp.145048-10">
      [10]
     </xref>, along with the Vienna Architecture Description Language proposed by Himmelbauer et al. in 2024 <xref ref-type="bibr" rid="scirp.145048-11">
      [11]
     </xref>. These developments contribute new perspectives and tools to ISDL research, advancing computing architecture design.</p>
    <p>Our work’s approach to abstracting the assembler’s interface reflects the need for tools adaptable to changing instruction sets, aligning with trends in configurable tool development for diverse ISAs and ASIPs in SoC designs <xref ref-type="bibr" rid="scirp.145048-12">
      [12]
     </xref>.</p>
   </sec>
   <sec id="s2_3">
    <title>2.3. Configurable and Retargetable Compiler/Assembler</title>
    <p>Retargetable and configurable compilers/assemblers each bring unique flexibility to compiler design. Retargetable compilers, such as GCC, adapt across processor types by altering target descriptions, while configurable compilers allow user-defined tool customization for evolving hardware projects. Both approaches share a focus on adaptability to varying architectures. Recent key contributions include Arbone et al.’s model-driven inline assembler generator, enhancing retargetability and maintenance <xref ref-type="bibr" rid="scirp.145048-13">
      [13]
     </xref>, Povazan et al.’s adaptable generic compiler framework <xref ref-type="bibr" rid="scirp.145048-14">
      [14]
     </xref>, Korenkov et al.’s insights on ASIP compiler challenges <xref ref-type="bibr" rid="scirp.145048-15">
      [15]
     </xref>, and Vasilache et al.’s modular code generation design for tensor compilers <xref ref-type="bibr" rid="scirp.145048-16">
      [16]
     </xref>. Numerous studies address configurable tool design, including Taglietti et al.’s automatic pre-processor and assembler generation for ASIPs via ADLs <xref ref-type="bibr" rid="scirp.145048-17">
      [17]
     </xref>, Abbaspour and Zhu’s retargeting techniques for GNU binutils <xref ref-type="bibr" rid="scirp.145048-18">
      [18]
     </xref>, and Youn et al.’s assembler and linker platform for embedded systems <xref ref-type="bibr" rid="scirp.145048-19">
      [19]
     </xref>. Baldassin et al. demonstrate binary tool generation using ArchC within the GNU binutils framework <xref ref-type="bibr" rid="scirp.145048-20">
      [20]
     </xref>. Moona <xref ref-type="bibr" rid="scirp.145048-21">
      [21]
     </xref> presents a method for developing processor-specific tools through high-level ISA models, allowing retargeting across various designs.</p>
    <p>Despite advancements in configurable assembler design, challenges persist, including a lack of standardization leading to inconsistencies, performance trade-offs compared to specialized compilers, and difficulties in supporting rapidly evolving hardware architectures. This paper aims to address these limitations to enhance the usability and performance of configurable assembler tools.</p>
   </sec>
   <sec id="s2_4">
    <title>2.4. Reinforcement Learning-Based Formal Modeling</title>
    <p>Hu Ming et al. <xref ref-type="bibr" rid="scirp.145048-22">
      [22]
     </xref> propose a curiosity-driven reinforcement learning method to efficiently synthesize CCSL constraints from incomplete specifications, significantly improving synthesis speed and accuracy over existing approaches.</p>
   </sec>
  </sec><sec id="s3">
   <title>3. The Proposed Design</title>
   <p>To optimize the configurability and adaptability of the assembler design, we integrate reinforcement learning (RL) with the Modeling and Analysis of Real-Time and Embedded Systems (MARTE) profile. This hybrid approach enables self-optimizing assembler behavior under varying processor configurations while maintaining formal verification guarantees.</p>
   <sec id="s3_1">
    <title>3.1. MARTE Overview</title>
    <p>MARTE extends UML with domain-specific stereotypes, tagged values, and constraints to model:</p>
    <p>Key MARTE stereotypes relevant to our assembler design include:</p>
   </sec>
   <sec id="s3_2">
    <title>3.2. Formalizing the Configurable Assembler</title>
    <p>We model the assembler’s configurable components using MARTE’s &lt;&lt;HwComponent&gt;&gt; and &lt;&lt;SwResource&gt;&gt; stereotypes (see <xref ref-type="fig" rid="fig2">
      Figure 2
     </xref>):</p>
    <fig id="fig2" position="float">
     <label>Figure 2</label>
     <caption>
      <title>Figure 2. MARTE formal modeling framework.</title>
     </caption>
     <graphic mimetype="image" position="float" xlink:type="simple" xlink:href="https://html.scirp.org/file/7601503-rId20.jpeg?20250825092241" />
    </fig>
    <fig id="fig3" position="float">
     <label>Figure 3</label>
     <caption>
      <title>Figure 3. Dynamic parsing and coding process based on MARTE.</title>
     </caption>
     <graphic mimetype="image" position="float" xlink:type="simple" xlink:href="https://html.scirp.org/file/7601503-rId21.jpeg?20250825092245" />
    </fig>
   </sec>
   <sec id="s3_3">
    <title>3.3. Verification and Benefits</title>
    <p>MARTE enables:</p>
    <table-wrap id="table1">
     <label>
      <xref ref-type="table" rid="table1">
       Table 1
      </xref></label>
     <caption>
      <title>
       <xref ref-type="bibr" rid="scirp.145048-"></xref>Table 1. Configurable components summary.</title>
     </caption>
     <table class="MsoTableGrid custom-table" border="0" cellspacing="0" cellpadding="0"> 
      <tr> 
       <td class="custom-bottom-td acenter" width="37.14%"><p style="text-align:center">Component</p></td> 
       <td class="custom-bottom-td acenter" width="62.86%"><p style="text-align:center">Configuration Impact</p></td> 
      </tr> 
      <tr> 
       <td class="custom-top-td acenter" width="37.14%"><p style="text-align:center">Opcode Set</p></td> 
       <td class="custom-top-td acenter" width="62.86%"><p style="text-align:center">Instruction recognition &amp; encoding patterns</p></td> 
      </tr> 
      <tr> 
       <td class="acenter" width="37.14%"><p style="text-align:center">Register File</p></td> 
       <td class="acenter" width="62.86%"><p style="text-align:center">Operand validation &amp; resource allocation</p></td> 
      </tr> 
      <tr> 
       <td class="acenter" width="37.14%"><p style="text-align:center">Addressing Modes</p></td> 
       <td class="acenter" width="62.86%"><p style="text-align:center">Memory access pattern generation</p></td> 
      </tr> 
      <tr> 
       <td class="acenter" width="37.14%"><p style="text-align:center">Immediate Handling</p></td> 
       <td class="acenter" width="62.86%"><p style="text-align:center">Numeric representation &amp; optimization</p></td> 
      </tr> 
     </table>
    </table-wrap>
   </sec>
   <sec id="s3_4">
    <title>3.4. Case Study: TOP-32A Extension</title>
    <p>We applied MARTE to verify the TOP-32A extension (Section 2.3), ensuring that:</p>
    <p>The model detected a bitfield conflict in RIB-32 instructions, which was resolved by adjusting the encoding schema.</p>
   </sec>
   <sec id="s3_5">
    <title>3.5. Reinforcement Learning Integration</title>
    <p>To enable self-optimizing assembler behavior, we formulate the configuration adaptation process as a Markov Decision Process (MDP). The MDP interacts with the MARTE model to ensure formal constraints are satisfied during optimization.</p>
    <p>The MDP is defined by the tuple <img width="145.7700650759219" src="https://html.scirp.org/file/7601503-rId22.svg?20250825092251">:</img></p>
    <p>
     <math xmlns="http://www.w3.org/1998/Math/MathML"> <mtable columnalign="left"> 
       <mtr> 
        <mtd> 
         <msub> 
          <mi>
            s 
          </mi> 
          <mi>
            t 
          </mi> 
         </msub> 
         <mo>
           = 
         </mo> 
         <mrow> 
          <mo>
            ( 
          </mo> 
          <mrow> 
           <msub> 
            <mrow> 
             <mtext>
               HwProcessor 
             </mtext> 
            </mrow> 
            <mrow> 
             <mi>
               c 
             </mi> 
             <mi>
               f 
             </mi> 
             <mi>
               g 
             </mi> 
            </mrow> 
           </msub> 
          </mrow> 
         </mrow> 
         <mo>
           , 
         </mo> 
         <msub> 
          <mtext>
            HwMemory 
          </mtext> 
          <mrow> 
           <mi>
             u 
           </mi> 
           <mi>
             s 
           </mi> 
           <mi>
             a 
           </mi> 
           <mi>
             g 
           </mi> 
           <mi>
             e 
           </mi> 
          </mrow> 
         </msub> 
         <mo>
           , 
         </mo> 
        </mtd> 
       </mtr> 
       <mtr> 
        <mtd> 
         <mtext>
             
         </mtext> 
         <mtext>
             
         </mtext> 
         <mtext>
             
         </mtext> 
         <mtext>
             
         </mtext> 
         <mtext>
             
         </mtext> 
         <mtext>
             
         </mtext> 
         <mtext>
             
         </mtext> 
         <mtext>
             
         </mtext> 
         <msub> 
          <mtext>
            GaWorkloadEvent 
          </mtext> 
          <mrow> 
           <mi>
             t 
           </mi> 
           <mi>
             y 
           </mi> 
           <mi>
             p 
           </mi> 
           <mi>
             e 
           </mi> 
          </mrow> 
         </msub> 
         <mo>
           , 
         </mo> 
         <mrow> 
          <mrow> 
           <msub> 
            <mrow> 
             <mtext>
               GaScenario 
             </mtext> 
            </mrow> 
            <mrow> 
             <mi>
               p 
             </mi> 
             <mi>
               r 
             </mi> 
             <mi>
               o 
             </mi> 
             <mi>
               g 
             </mi> 
             <mi>
               r 
             </mi> 
             <mi>
               e 
             </mi> 
             <mi>
               s 
             </mi> 
             <mi>
               s 
             </mi> 
            </mrow> 
           </msub> 
          </mrow> 
          <mo>
            ) 
          </mo> 
         </mrow> 
        </mtd> 
       </mtr> 
      </mtable> 
     </math> (1)</p>
    <p>where:</p>
    <p>
     <math xmlns="http://www.w3.org/1998/Math/MathML"> <mtable columnalign="left"> 
       <mtr> 
        <mtd> 
         <msub> 
          <mi>
            a 
          </mi> 
          <mi>
            t 
          </mi> 
         </msub> 
         <mo>
           ∈ 
         </mo> 
         <mrow> 
          <mo>
            { 
          </mo> 
          <mrow> 
           <mtext>
             Modifybitfieldallocation 
           </mtext> 
          </mrow> 
         </mrow> 
         <mo>
           , 
         </mo> 
         <mtext>
           Adjustregistermapping 
         </mtext> 
         <mo>
           , 
         </mo> 
        </mtd> 
       </mtr> 
       <mtr> 
        <mtd> 
         <mtext>
             
         </mtext> 
         <mtext>
             
         </mtext> 
         <mtext>
             
         </mtext> 
         <mtext>
             
         </mtext> 
         <mtext>
             
         </mtext> 
         <mtext>
             
         </mtext> 
         <mtext>
             
         </mtext> 
         <mtext>
             
         </mtext> 
         <mtext>
           Switchinstructionpipeline 
         </mtext> 
         <mo>
           , 
         </mo> 
         <mrow> 
          <mrow> 
           <mtext>
             Adaptaddressingmode 
           </mtext> 
          </mrow> 
          <mo>
            } 
          </mo> 
         </mrow> 
        </mtd> 
       </mtr> 
      </mtable> 
     </math> (2)</p>
    <p>Each action modifies MARTE stereotypes (e.g., updating &lt;&lt;BitField&gt;&gt; constraints or &lt;&lt;HwMemory&gt;&gt; allocations).</p>
    <p>
     <math display="inline" xmlns="http://www.w3.org/1998/Math/MathML"> <mtable> 
       <mtr> 
        <mtd> 
         <mi>
           ℛ 
         </mi> 
         <mrow> 
          <mo>
            ( 
          </mo> 
          <mrow> 
           <msub> 
            <mi>
              s 
            </mi> 
            <mi>
              t 
            </mi> 
           </msub> 
           <mo>
             , 
           </mo> 
           <msub> 
            <mi>
              a 
            </mi> 
            <mi>
              t 
            </mi> 
           </msub> 
          </mrow> 
          <mo>
            ) 
          </mo> 
         </mrow> 
         <mo>
           = 
         </mo> 
         <munder> 
          <munder> 
           <mrow> 
            <msub> 
             <mi>
               w 
             </mi> 
             <mn>
               1 
             </mn> 
            </msub> 
            <mo>
              ⋅ 
            </mo> 
            <mtext>
              EncodingSuccess 
            </mtext> 
           </mrow> 
           <mo stretchy="true">
             ︸ 
           </mo> 
          </munder> 
          <mrow> 
           <mtext>
             Correctness 
           </mtext> 
          </mrow> 
         </munder> 
         <mo>
           + 
         </mo> 
         <munder> 
          <munder> 
           <mrow> 
            <msub> 
             <mi>
               w 
             </mi> 
             <mn>
               2 
             </mn> 
            </msub> 
            <mo>
              ⋅ 
            </mo> 
            <mfrac> 
             <mn>
               1 
             </mn> 
             <mrow> 
              <mtext>
                EncodingTime 
              </mtext> 
             </mrow> 
            </mfrac> 
           </mrow> 
           <mo stretchy="true">
             ︸ 
           </mo> 
          </munder> 
          <mrow> 
           <mtext>
             Efficiency 
           </mtext> 
          </mrow> 
         </munder> 
        </mtd> 
       </mtr> 
       <mtr> 
        <mtd> 
         <mtext>
             
         </mtext> 
         <mtext>
             
         </mtext> 
         <mo>
           − 
         </mo> 
         <munder> 
          <munder> 
           <mrow> 
            <msub> 
             <mi>
               w 
             </mi> 
             <mn>
               3 
             </mn> 
            </msub> 
            <mo>
              ⋅ 
            </mo> 
            <mtext>
              ConstraintViolations 
            </mtext> 
           </mrow> 
           <mo stretchy="true">
             ︸ 
           </mo> 
          </munder> 
          <mrow> 
           <mtext>
             Safety 
           </mtext> 
          </mrow> 
         </munder> 
        </mtd> 
       </mtr> 
      </mtable> 
     </math> (3)</p>
    <p>where 
     <math xmlns="http://www.w3.org/1998/Math/MathML"> <mrow> 
       <msub> 
        <mi>
          w 
        </mi> 
        <mn>
          1 
        </mn> 
       </msub> 
       <mo>
         , 
       </mo> 
       <msub> 
        <mi>
          w 
        </mi> 
        <mn>
          2 
        </mn> 
       </msub> 
       <mo>
         , 
       </mo> 
       <msub> 
        <mi>
          w 
        </mi> 
        <mn>
          3 
        </mn> 
       </msub> 
      </mrow> 
     </math> are tunable weights, which were selected through grid search and cross-validation on a subset of training tasks. Constraint violations are detected via MARTE OCL checks.</p>
    <fig id="fig4" position="float">
     <label>Figure 4</label>
     <caption>
      <title>where 

       <math xmlns="http://www.w3.org/1998/Math/MathML"> <mrow> 
  
         <msub> 
   
          <mi>
           
    f
   
          </mi> 
   
          <mrow> 
    
           <mtext>
            
     MARTE
    
           </mtext>
   
          </mrow> 
  
         </msub> 
 
        </mrow>

       </math> is the MARTE model’s formalized behavior.3.5.2. Learning AlgorithmWe employ a constrained policy optimization approach (see <xref ref-type="fig" rid="fig4">
        Figure 4
       </xref>):a. Policy Network: A neural network 

       <math xmlns="http://www.w3.org/1998/Math/MathML"> <mrow> 
  
         <msub> 
   
          <mi>
           
    π
   
          </mi> 
   
          <mi>
           
    θ
   
          </mi> 
  
         </msub> 
  
         <mrow>
   
          <mo>
           
    (
   
          </mo> 
   
          <mrow> 
    
           <mi>
            
     a
    
           </mi>
    
           <mo>
            
     |
    
           </mo>
    
           <mi>
            
     s
    
           </mi>
   
          </mrow> 
   
          <mo>
           
    )
   
          </mo>
  
         </mrow>
 
        </mrow>

       </math> generates configuration actions.b. Constraint Layer: Filters invalid actions using MARTE OCL constraints:
       <math xmlns="http://www.w3.org/1998/Math/MathML"> <mrow> 
  
         <msub> 
   
          <mi mathvariant="script">
           
    A
   
          </mi> 
   
          <mrow> 
    
           <mtext>
            
     valid
    
           </mtext>
   
          </mrow> 
  
         </msub> 
  
         <mo>
          
   =
  
         </mo>
  
         <mrow>
   
          <mo>
           
    {
   
          </mo> 
   
          <mrow> 
    
           <mi>
            
     a
    
           </mi>
    
           <mo>
            
     ∈
    
           </mo>
    
           <mi mathvariant="script">
            
     A
    
           </mi>
    
           <mo>
            
     |
    
           </mo>
    
           <mtext>
            
     ocl_check
    
           </mtext>
    
           <mrow>
     
            <mo>
              ( 
            </mo> 
     
            <mrow> 
             <mi>
               a 
             </mi> 
             <mo>
               , 
             </mo> 
             <msub> 
              <mi>
                s 
              </mi> 
              <mi>
                t 
              </mi> 
             </msub> 
            </mrow> 
     
            <mo>
              ) 
            </mo>
    
           </mrow>
    
           <mo>
            
     =
    
           </mo>
    
           <mtext>
            
     True
    
           </mtext>
   
          </mrow> 
   
          <mo>
           
    }
   
          </mo>
  
         </mrow>
 
        </mrow>

       </math> (4)c. Optimization Objective: Maximize expected return while preserving constraints:<xref ref-type="bibr" rid="scirp.145048-"></xref><p class="imgGroupCss_v"><img class=" imgMarkCss lazy" data-original="https://html.scirp.org/file/7601503-rId56.jpeg?20250825092252" /></p>Figure 4. Reinforcement learning loop with MARTE constraint enforcement.</title>
     </caption>
     <graphic mimetype="image" position="float" xlink:type="simple" xlink:href="" />
    </fig>
    <p>
     <math display="inline" xmlns="http://www.w3.org/1998/Math/MathML"> <mtable columnalign="left"> 
       <mtr> 
        <mtd> 
         <munder> 
          <mrow> 
           <mi>
             max 
           </mi> 
          </mrow> 
          <mi>
            θ 
          </mi> 
         </munder> 
         <msub> 
          <mi mathvariant="double-struck">
            E 
          </mi> 
          <mrow> 
           <msub> 
            <mi>
              π 
            </mi> 
            <mi>
              θ 
            </mi> 
           </msub> 
          </mrow> 
         </msub> 
         <mrow> 
          <mo>
            [ 
          </mo> 
          <mrow> 
           <munderover> 
            <mstyle mathsize="140%" displaystyle="true"> 
             <mo>
               ∑ 
             </mo> 
            </mstyle> 
            <mrow> 
             <mi>
               t 
             </mi> 
             <mo>
               = 
             </mo> 
             <mn>
               0 
             </mn> 
            </mrow> 
            <mi>
              T 
            </mi> 
           </munderover> 
           <mtext>
               
           </mtext> 
           <msup> 
            <mi>
              γ 
            </mi> 
            <mi>
              t 
            </mi> 
           </msup> 
           <mi>
             ℛ 
           </mi> 
           <mrow> 
            <mo>
              ( 
            </mo> 
            <mrow> 
             <msub> 
              <mi>
                s 
              </mi> 
              <mi>
                t 
              </mi> 
             </msub> 
             <mo>
               , 
             </mo> 
             <msub> 
              <mi>
                a 
              </mi> 
              <mi>
                t 
              </mi> 
             </msub> 
            </mrow> 
            <mo>
              ) 
            </mo> 
           </mrow> 
          </mrow> 
          <mo>
            ] 
          </mo> 
         </mrow> 
        </mtd> 
       </mtr> 
       <mtr> 
        <mtd> 
         <mtext>
           s 
         </mtext> 
         <mo>
           . 
         </mo> 
         <mtext>
           t 
         </mtext> 
         <mo>
           . 
         </mo> 
         <mtext>
             
         </mtext> 
         <mtext>
             
         </mtext> 
         <mtext>
           ocl_check 
         </mtext> 
         <mrow> 
          <mo>
            ( 
          </mo> 
          <mrow> 
           <msub> 
            <mi>
              a 
            </mi> 
            <mi>
              t 
            </mi> 
           </msub> 
           <mo>
             , 
           </mo> 
           <msub> 
            <mi>
              s 
            </mi> 
            <mi>
              t 
            </mi> 
           </msub> 
          </mrow> 
          <mo>
            ) 
          </mo> 
         </mrow> 
         <mo>
           = 
         </mo> 
         <mtext>
           True 
         </mtext> 
         <mo>
           , 
         </mo> 
         <mo>
           ∀ 
         </mo> 
         <mi>
           t 
         </mi> 
        </mtd> 
       </mtr> 
      </mtable> 
     </math> (5)</p>
    <p>By integrating MARTE’s formal constraints as hard filters in the policy network, we ensure:</p>
    <p>Benchmarks on the TOP-32A extension showed a 22% reduction in average encoding time compared to static configurations, with zero constraint violations during optimization.</p>
   </sec>
   <sec id="s3_6">
    <title>3.6. Configurable Assembler Framework</title>
    <p>This section presents a streamlined framework for architecture-agnostic assembly translation, focusing on three core components: instruction abstraction, dynamic parsing, and configuration interfaces.</p>
    <p>The assembler adopts a modular design with configuration-driven components (<xref ref-type="fig" rid="fig5">
      Figure 5
     </xref>), utilizing a Common ISA Description Language (CIDL) to decouple processor-specific details from translation logic. Key features include:</p>
    <p>The framework models instructions through three configurable elements:</p>
    <fig id="fig5" position="float">
     <label>Figure 5</label>
     <caption>
      <title>Figure 5. The structure of configurable assembler.</title>
     </caption>
     <graphic mimetype="image" position="float" xlink:type="simple" xlink:href="https://html.scirp.org/file/7601503-rId59.jpeg?20250825092257" />
    </fig>
    <p>The four-stage translation pipeline integrates with MARTE timing constraints:</p>
    <p>The assembler supports processor customization through five key configuration files:</p>
    <p>This interface enables rapid retargeting while maintaining formal verification through integrated MARTE constraints, complementing the RL-enhanced optimization discussed in Section 4. Benchmark results show 85% reduction in configuration effort compared to traditional assemblers when adapting to new ISA variants like TOP-32A.</p>
   </sec>
  </sec><sec id="s4">
   <title>4. Experiments</title>
   <sec id="s4_1">
    <title>4.1. Correctness Test</title>
    <p>The purpose of an assembler is to convert assembly instructions into machine code. Testing its correctness involves verifying that the generated machine instructions match the ISA definition. The process uses source files with various assembly instructions and their correct encodings as comments. The assembler converts these into an object file (.o), from which the “objdump” tool extracts binary code into a formatted text file. This file is then compared with the expected encodings.</p>
    <p>The input assembly file includes test cases for each instruction format and operand type, ensuring comprehensive coverage (see <xref ref-type="table" rid="table2">
      Table 2
     </xref>). <xref ref-type="fig" rid="fig6">
      Figure 6
     </xref> outlines the testing flow, while <xref ref-type="fig" rid="fig7">
      Figure 7
     </xref> provides examples for RIC-32 compare instructions. A bash script automates the comparison by extracting machine instructions and correcting encodings, then checking for discrepancies (<xref ref-type="fig" rid="fig8">
      Figure 8
     </xref>). All 26 test cases in the basic instruction set have been successfully validated.</p>
   </sec>
   <sec id="s4_2">
    <title>4.2. Configurability Test</title>
    <p>Assembler configurability reflects its adaptability to changes in a processor’s instruction set. Good configurability allows quick updates to the assembler’s source code with minimal effort. Measuring this involves assessing development</p>
    <fig id="fig6" position="float">
     <label>Figure 6</label>
     <caption>
      <title>Figure 6. Flowchart of the assembler’s correctness test.</title>
     </caption>
     <graphic mimetype="image" position="float" xlink:type="simple" xlink:href="https://html.scirp.org/file/7601503-rId60.jpeg?20250825092304" />
    </fig>
    <table-wrap id="table2">
     <label>
      <xref ref-type="table" rid="table2">
       Table 2
      </xref></label>
     <caption>
      <title>
       <xref ref-type="bibr" rid="scirp.145048-"></xref>Table 2. Assembler test case description. It contains 26 test cases included in the TOP basic instruction set. All the test cases together contain 271 assembly statements and their correct encoding values.</title>
     </caption>
     <table class="MsoTableGrid custom-table" border="0" cellspacing="0" cellpadding="0"> 
      <tr> 
       <td class="custom-bottom-td acenter" width="24.99%"><p style="text-align:center">Case</p></td> 
       <td class="custom-bottom-td acenter" width="25.01%"><p style="text-align:center">Description</p></td> 
       <td class="custom-bottom-td acenter" width="24.99%"><p style="text-align:center">Format</p></td> 
       <td class="custom-bottom-td acenter" width="25.01%"><p style="text-align:center">Number of test statements</p></td> 
      </tr> 
      <tr> 
       <td class="custom-top-td acenter" width="24.99%"><p style="text-align:center">b.s</p></td> 
       <td class="custom-top-td acenter" width="25.01%"><p style="text-align:center">Branch</p></td> 
       <td class="custom-top-td acenter" width="24.99%"><p style="text-align:center">RIB-32</p></td> 
       <td class="custom-top-td acenter" width="25.01%"><p style="text-align:center">4</p></td> 
      </tr> 
      <tr> 
       <td class="acenter" width="24.99%"><p style="text-align:center">j.s</p></td> 
       <td class="acenter" width="25.01%"><p style="text-align:center">Jump</p></td> 
       <td class="acenter" width="24.99%"><p style="text-align:center">RRJ-32</p></td> 
       <td class="acenter" width="25.01%"><p style="text-align:center">8</p></td> 
      </tr> 
      <tr> 
       <td class="acenter" width="24.99%"><p style="text-align:center">bl.s</p></td> 
       <td class="acenter" width="25.01%"><p style="text-align:center">Branch &amp; link</p></td> 
       <td class="acenter" width="24.99%"><p style="text-align:center">RIB-32</p></td> 
       <td class="acenter" width="25.01%"><p style="text-align:center">4</p></td> 
      </tr> 
      <tr> 
       <td class="acenter" width="24.99%"><p style="text-align:center">jl.s</p></td> 
       <td class="acenter" width="25.01%"><p style="text-align:center">Jump &amp; link</p></td> 
       <td class="acenter" width="24.99%"><p style="text-align:center">RRJ-32</p></td> 
       <td class="acenter" width="25.01%"><p style="text-align:center">8</p></td> 
      </tr> 
      <tr> 
       <td class="acenter" width="24.99%"><p style="text-align:center">loop.s</p></td> 
       <td class="acenter" width="25.01%"><p style="text-align:center">Loop</p></td> 
       <td class="acenter" width="24.99%"><p style="text-align:center">RIB-32</p></td> 
       <td class="acenter" width="25.01%"><p style="text-align:center">4</p></td> 
      </tr> 
      <tr> 
       <td class="acenter" width="24.99%"><p style="text-align:center">br.s</p></td> 
       <td class="acenter" width="25.01%"><p style="text-align:center">Branch on reg</p></td> 
       <td class="acenter" width="24.99%"><p style="text-align:center">RIC-32</p></td> 
       <td class="acenter" width="25.01%"><p style="text-align:center">44</p></td> 
      </tr> 
      <tr> 
       <td class="acenter" width="24.99%"><p style="text-align:center">cmp.s</p></td> 
       <td class="acenter" width="25.01%"><p style="text-align:center">Compare</p></td> 
       <td class="acenter" width="24.99%"><p style="text-align:center">RRC-32/RIC-32</p></td> 
       <td class="acenter" width="25.01%"><p style="text-align:center">55</p></td> 
      </tr> 
      <tr> 
       <td class="acenter" width="24.99%"><p style="text-align:center">lb.s</p></td> 
       <td class="acenter" width="25.01%"><p style="text-align:center">Load byte</p></td> 
       <td class="acenter" width="24.99%"><p style="text-align:center">RI-32/RR-32</p></td> 
       <td class="acenter" width="25.01%"><p style="text-align:center">6</p></td> 
      </tr> 
      <tr> 
       <td class="acenter" width="24.99%"><p style="text-align:center">lh.s</p></td> 
       <td class="acenter" width="25.01%"><p style="text-align:center">Load half</p></td> 
       <td class="acenter" width="24.99%"><p style="text-align:center">RI-32/RR-32</p></td> 
       <td class="acenter" width="25.01%"><p style="text-align:center">6</p></td> 
      </tr> 
      <tr> 
       <td class="acenter" width="24.99%"><p style="text-align:center">lw.s</p></td> 
       <td class="acenter" width="25.01%"><p style="text-align:center">Load word</p></td> 
       <td class="acenter" width="24.99%"><p style="text-align:center">RI-32/RR-32</p></td> 
       <td class="acenter" width="25.01%"><p style="text-align:center">6</p></td> 
      </tr> 
      <tr> 
       <td class="acenter" width="24.99%"><p style="text-align:center">lbu.s</p></td> 
       <td class="acenter" width="25.01%"><p style="text-align:center">unsigned LB</p></td> 
       <td class="acenter" width="24.99%"><p style="text-align:center">RI-32/RR-32</p></td> 
       <td class="acenter" width="25.01%"><p style="text-align:center">6</p></td> 
      </tr> 
      <tr> 
       <td class="acenter" width="24.99%"><p style="text-align:center">lhu.s</p></td> 
       <td class="acenter" width="25.01%"><p style="text-align:center">unsigned LH</p></td> 
       <td class="acenter" width="24.99%"><p style="text-align:center">RI-32/RR-32</p></td> 
       <td class="acenter" width="25.01%"><p style="text-align:center">6</p></td> 
      </tr> 
      <tr> 
       <td class="acenter" width="24.99%"><p style="text-align:center">sb.s</p></td> 
       <td class="acenter" width="25.01%"><p style="text-align:center">Store byte</p></td> 
       <td class="acenter" width="24.99%"><p style="text-align:center">RI-32/RR-32</p></td> 
       <td class="acenter" width="25.01%"><p style="text-align:center">6</p></td> 
      </tr> 
      <tr> 
       <td class="acenter" width="24.99%"><p style="text-align:center">sh.s</p></td> 
       <td class="acenter" width="25.01%"><p style="text-align:center">Store half</p></td> 
       <td class="acenter" width="24.99%"><p style="text-align:center">RI-32/RR-32</p></td> 
       <td class="acenter" width="25.01%"><p style="text-align:center">6</p></td> 
      </tr> 
      <tr> 
       <td class="acenter" width="24.99%"><p style="text-align:center">sw.s</p></td> 
       <td class="acenter" width="25.01%"><p style="text-align:center">Store word</p></td> 
       <td class="acenter" width="24.99%"><p style="text-align:center">RI-32/RR-32</p></td> 
       <td class="acenter" width="25.01%"><p style="text-align:center">6</p></td> 
      </tr> 
      <tr> 
       <td class="acenter" width="24.99%"><p style="text-align:center">add.s</p></td> 
       <td class="acenter" width="25.01%"><p style="text-align:center">Add</p></td> 
       <td class="acenter" width="24.99%"><p style="text-align:center">RI-32/RR-32</p></td> 
       <td class="acenter" width="25.01%"><p style="text-align:center">6</p></td> 
      </tr> 
      <tr> 
       <td class="acenter" width="24.99%"><p style="text-align:center">addc.s</p></td> 
       <td class="acenter" width="25.01%"><p style="text-align:center">Add with carry</p></td> 
       <td class="acenter" width="24.99%"><p style="text-align:center">RI-32/RR-32</p></td> 
       <td class="acenter" width="25.01%"><p style="text-align:center">6</p></td> 
      </tr> 
      <tr> 
       <td class="acenter" width="24.99%"><p style="text-align:center">sub.s</p></td> 
       <td class="acenter" width="25.01%"><p style="text-align:center">Sub</p></td> 
       <td class="acenter" width="24.99%"><p style="text-align:center">RI-32/RR-32</p></td> 
       <td class="acenter" width="25.01%"><p style="text-align:center">6</p></td> 
      </tr> 
      <tr> 
       <td class="acenter" width="24.99%"><p style="text-align:center">subc.s</p></td> 
       <td class="acenter" width="25.01%"><p style="text-align:center">Sub with carry</p></td> 
       <td class="acenter" width="24.99%"><p style="text-align:center">RI-32/RR-32</p></td> 
       <td class="acenter" width="25.01%"><p style="text-align:center">6</p></td> 
      </tr> 
      <tr> 
       <td class="acenter" width="24.99%"><p style="text-align:center">and.s</p></td> 
       <td class="acenter" width="25.01%"><p style="text-align:center">And</p></td> 
       <td class="acenter" width="24.99%"><p style="text-align:center">RI-32/RR-32</p></td> 
       <td class="acenter" width="25.01%"><p style="text-align:center">6</p></td> 
      </tr> 
      <tr> 
       <td class="acenter" width="24.99%"><p style="text-align:center">or.s</p></td> 
       <td class="acenter" width="25.01%"><p style="text-align:center">Or</p></td> 
       <td class="acenter" width="24.99%"><p style="text-align:center">RI-32/RR-32</p></td> 
       <td class="acenter" width="25.01%"><p style="text-align:center">6</p></td> 
      </tr> 
      <tr> 
       <td class="acenter" width="24.99%"><p style="text-align:center">xor</p></td> 
       <td class="acenter" width="25.01%"><p style="text-align:center">Xor</p></td> 
       <td class="acenter" width="24.99%"><p style="text-align:center">RI-32/RR-32</p></td> 
       <td class="acenter" width="25.01%"><p style="text-align:center">6</p></td> 
      </tr> 
      <tr> 
       <td class="acenter" width="24.99%"><p style="text-align:center">sll.s</p></td> 
       <td class="acenter" width="25.01%"><p style="text-align:center">(L)shift left</p></td> 
       <td class="acenter" width="24.99%"><p style="text-align:center">RIS-32/RR-32</p></td> 
       <td class="acenter" width="25.01%"><p style="text-align:center">6</p></td> 
      </tr> 
      <tr> 
       <td class="acenter" width="24.99%"><p style="text-align:center">srl.s</p></td> 
       <td class="acenter" width="25.01%"><p style="text-align:center">(L)shift right</p></td> 
       <td class="acenter" width="24.99%"><p style="text-align:center">RIS-32/RR-32</p></td> 
       <td class="acenter" width="25.01%"><p style="text-align:center">6</p></td> 
      </tr> 
      <tr> 
       <td class="acenter" width="24.99%"><p style="text-align:center">sra.s</p></td> 
       <td class="acenter" width="25.01%"><p style="text-align:center">(A)shift right</p></td> 
       <td class="acenter" width="24.99%"><p style="text-align:center">RIS-32/RR-32</p></td> 
       <td class="acenter" width="25.01%"><p style="text-align:center">6</p></td> 
      </tr> 
      <tr> 
       <td class="acenter" width="24.99%"><p style="text-align:center">ror.s</p></td> 
       <td class="acenter" width="25.01%"><p style="text-align:center">rotate right</p></td> 
       <td class="acenter" width="24.99%"><p style="text-align:center">RIS-32/RR-32</p></td> 
       <td class="acenter" width="25.01%"><p style="text-align:center">6</p></td> 
      </tr> 
     </table>
    </table-wrap>
    <fig id="fig7" position="float">
     <label>Figure 7</label>
     <caption>
      <title>Figure 7. Segment of the test case of comparing instruction with RIC-32 format.</title>
     </caption>
     <graphic mimetype="image" position="float" xlink:type="simple" xlink:href="https://html.scirp.org/file/7601503-rId61.jpeg?20250825092304" />
    </fig>
    <fig id="fig8" position="float">
     <label>Figure 8</label>
     <caption>
      <title>Figure 8. A segment of the script to test assembler.</title>
     </caption>
     <graphic mimetype="image" position="float" xlink:type="simple" xlink:href="https://html.scirp.org/file/7601503-rId62.jpeg?20250825092304" />
    </fig>
    <p>time, which can be challenging due to varying complexity and developer skills. This study simplifies measurement by counting the lines of code affected by instruction set changes.</p>
    <p>The testing model involves using typical instruction set changes as inputs and comparing affected code lines in both prototype and configurable assemblers. This approach assumes that testers lack detailed knowledge of the assembler’s internals, so all relevant lines are counted. The test inputs defined in <xref ref-type="table" rid="table3">
      Table 3
     </xref> focus on changes in instruction encoding and assembly syntax, with results analyzed for each test scenario.</p>
    <table-wrap id="table3">
     <label>
      <xref ref-type="table" rid="table3">
       Table 3
      </xref></label>
     <caption>
      <title>
       <xref ref-type="bibr" rid="scirp.145048-"></xref>Table 3. Input set for testing assembler’s configurability.</title>
     </caption>
     <table class="MsoTableGrid custom-table" border="0" cellspacing="0" cellpadding="0"> 
      <tr> 
       <td class="custom-bottom-td acenter" width="23.00%"><p style="text-align:center">Type</p></td> 
       <td class="custom-bottom-td acenter" width="36.30%"><p style="text-align:center">Description</p></td> 
       <td class="custom-bottom-td acenter" width="40.70%"><p style="text-align:center">Specific Definition</p></td> 
      </tr> 
      <tr> 
       <td class="custom-top-td acenter" width="23.00%"><p style="text-align:center">Add (Remove) Instructions</p></td> 
       <td class="custom-top-td acenter" width="36.30%"><p style="text-align:center">Add (Remove) instructions to existing instruction types</p></td> 
       <td class="custom-top-td acenter" width="40.70%"><p style="text-align:center">Add (Remove) the addition and shift instruction 1.addx2, which has RI-32 and RR-32 formats</p></td> 
      </tr> 
      <tr> 
       <td class="acenter" width="23.00%"><p style="text-align:center">Add (Remove) Instruction Types</p></td> 
       <td class="acenter" width="36.30%"><p style="text-align:center">Add (Remove) instruction encoding types</p></td> 
       <td class="acenter" width="40.70%"><p style="text-align:center">Add (Remove) an instruction type with 4 register operands</p></td> 
      </tr> 
      <tr> 
       <td class="acenter" width="23.00%"><p style="text-align:center">Modify InstructionEncoding</p></td> 
       <td class="acenter" width="36.30%"><p style="text-align:center">Modify the specific encoding of an existing instruction</p></td> 
       <td class="acenter" width="40.70%"><p style="text-align:center">Modify a 4-register operand instruction type to 3 register operands and 1 immediate operand</p></td> 
      </tr> 
      <tr> 
       <td class="acenter" width="23.00%"><p style="text-align:center">Comprehensive Test</p></td> 
       <td class="acenter" width="36.30%"><p style="text-align:center">Test cases with multiplechanges</p></td> 
       <td class="acenter" width="40.70%"><p style="text-align:center">Add a type of MIMD instruction with 3 instructions executed in parallel</p></td> 
      </tr> 
     </table>
    </table-wrap>
    <p>In this test, an addition and shift instruction “l.addx2” will be added to the TOP instruction set. This instruction has two formats: RI-32 and RR-32 (see <xref ref-type="fig" rid="fig9">
      Figure 9
     </xref>).</p>
    <p>Under the configurable compiler structure, adapting to the above change is quite simple: since the instruction types already exist, it is only necessary to find the RI-32 and RR-32 entries in the instruction static table definition and add the instruction opcode name and corresponding encoding. <xref ref-type="fig" rid="fig10">
      Figure 10
     </xref> describes the specific code changes after adding the “l.addx2” instruction.</p>
    <p>
     <xref ref-type="table" rid="table4">
      Table 4
     </xref> lists the lines of code affected after adding the “l.addx2” instruction. The first row of <xref ref-type="table" rid="table4">
      Table 4
     </xref> represents the different types of configuration interface files for the assembler. As can be seen, this test has a minimal impact on the source code, and the modifier does not need to understand the internal workings of the assembler.</p>
    <p>In a traditional assembler prototype, adding an “l.addx2” instruction would not only require modifying the instruction definition part but also handling the opcode parsing part. According to the analysis of the assembler backends for ARM, ARC, and OpenRISC platforms in Binutils, implementing the above change would involve modifying over 300 lines of source code on average.</p>
    <fig id="fig9" position="float">
     <label>Figure 9</label>
     <caption>
      <title>Figure 9. Instruction format of “l.addx2”.</title>
     </caption>
     <graphic mimetype="image" position="float" xlink:type="simple" xlink:href="https://html.scirp.org/file/7601503-rId63.jpeg?20250825092305" />
    </fig>
    <fig id="fig10" position="float">
     <label>Figure 10</label>
     <caption>
      <title>Figure 10. Changes of the static instruction table by adding l.addx2.</title>
     </caption>
     <graphic mimetype="image" position="float" xlink:type="simple" xlink:href="https://html.scirp.org/file/7601503-rId64.jpeg?20250825092305" />
    </fig>
    <table-wrap id="table4">
     <label>
      <xref ref-type="table" rid="table4">
       Table 4
      </xref></label>
     <caption>
      <title>
       <xref ref-type="bibr" rid="scirp.145048-"></xref>Table 4. Number of source lines impacted by adding “l.addx2”.</title>
     </caption>
     <table class="MsoTableGrid custom-table" border="0" cellspacing="0" cellpadding="0"> 
      <tr> 
       <td class="custom-bottom-td acenter" width="14.27%"><p style="text-align:center"></p></td> 
       <td class="custom-bottom-td acenter" width="14.27%"><p style="text-align:center">GPR</p></td> 
       <td class="custom-bottom-td acenter" width="14.29%"><p style="text-align:center">SPR</p></td> 
       <td class="custom-bottom-td acenter" width="14.29%"><p style="text-align:center">Relocation</p></td> 
       <td class="custom-bottom-td acenter" width="14.29%"><p style="text-align:center">INSN</p></td> 
       <td class="custom-bottom-td acenter" width="14.29%"><p style="text-align:center">Lexical/ grammatical</p></td> 
       <td class="custom-bottom-td acenter" width="14.29%"><p style="text-align:center">Total</p></td> 
      </tr> 
      <tr> 
       <td class="custom-top-td acenter" width="14.27%"><p style="text-align:center">.addx2</p></td> 
       <td class="custom-top-td acenter" width="14.27%"><p style="text-align:center">0</p></td> 
       <td class="custom-top-td acenter" width="14.29%"><p style="text-align:center">0</p></td> 
       <td class="custom-top-td acenter" width="14.29%"><p style="text-align:center">0</p></td> 
       <td class="custom-top-td acenter" width="14.29%"><p style="text-align:center">20</p></td> 
       <td class="custom-top-td acenter" width="14.29%"><p style="text-align:center">0</p></td> 
       <td class="custom-top-td acenter" width="14.29%"><p style="text-align:center">20</p></td> 
      </tr> 
     </table>
    </table-wrap>
    <p>In this test, a new instruction type will be added to the TOP instruction set, which has the format shown in <xref ref-type="fig" rid="fig11">
      Figure 11
     </xref>. This format is similar to the RR-32 format but has four general-purpose register operands, with each register occupying 4 bits and ranging from “r8” to “r23”. Therefore, this instruction type is called RRR-32.</p>
    <p>To add an instruction type under the configurable assembler framework, the following steps need to be completed:</p>
    <p>Step 1. Add a new general-purpose register type. Modify the GPR configuration interface (“extif-gpr_table.c”) to add a register type ranging from “r8” to “r23”. The specific modification is listed in the code snippet in <xref ref-type="fig" rid="fig12">
      Figure 12
     </xref>.</p>
    <p>Step 2. Add the new instruction type identifier “INSN_TYPE_RRR32” to the interface file “extif-opcode.h”.</p>
    <p>Step 3. Define the RRR-32 instruction type in the instruction type configuration file (“extif-insn_table.c”). Describing the instruction type, opcode, operands, and format abbreviation in sequence completes the definition of this type. The specific definition can be seen in <xref ref-type="fig" rid="fig13">
      Figure 13
     </xref>, which also defines a test instruction ‘rrrtest’ within the RRR-32 instruction type.</p>
    <p>The structure in <xref ref-type="fig" rid="fig13">
      Figure 13
     </xref> may seem complex, but upon closer examination, it is similar to describing an instruction type in plain language. The RRR-32 instruction type can be described in plain language as follows: “The RRR-32 instruction type is an instruction containing four operands (‘.ope_num=4’), each operand is a register (‘format=‘RRRR’’); the opcode occupies bits 24 to 29 (‘enc_opc_lst=⋯’), the first three registers occupy bits 2 to 13 in sequence, each register occupies 4 bits, and the fourth register occupies bits 0, 1, 16, and 17 (‘enc_ope_lst=⋯’).”</p>
    <fig id="fig11" position="float">
     <label>Figure 11</label>
     <caption>
      <title>Figure 11. Format definition of RRR-32 instruction.</title>
     </caption>
     <graphic mimetype="image" position="float" xlink:type="simple" xlink:href="https://html.scirp.org/file/7601503-rId65.jpeg?20250825092306" />
    </fig>
    <fig id="fig12" position="float">
     <label>Figure 12</label>
     <caption>
      <title>Figure 12. GRP configurature file after adding new GPR type.</title>
     </caption>
     <graphic mimetype="image" position="float" xlink:type="simple" xlink:href="https://html.scirp.org/file/7601503-rId66.jpeg?20250825092306" />
    </fig>
    <fig id="fig13" position="float">
     <label>Figure 13</label>
     <caption>
      <title>Figure 13. RRR-32 type instruction definition.</title>
     </caption>
     <graphic mimetype="image" position="float" xlink:type="simple" xlink:href="https://html.scirp.org/file/7601503-rId67.jpeg?20250825092307" />
    </fig>
    <p>
     <xref ref-type="table" rid="table5">
      Table 5
     </xref> lists the lines of source code affected by adding the RRR-32 instruction type.</p>
    <table-wrap id="table5">
     <label>
      <xref ref-type="table" rid="table5">
       Table 5
      </xref></label>
     <caption>
      <title>
       <xref ref-type="bibr" rid="scirp.145048-"></xref>Table 5. Number of source lines impacted by adding RRR-32 instruction type.</title>
     </caption>
     <table class="MsoTableGrid custom-table" border="0" cellspacing="0" cellpadding="0"> 
      <tr> 
       <td class="custom-bottom-td acenter" width="14.27%"><p style="text-align:center"></p></td> 
       <td class="custom-bottom-td acenter" width="14.27%"><p style="text-align:center">GPR</p></td> 
       <td class="custom-bottom-td acenter" width="14.29%"><p style="text-align:center">SPR</p></td> 
       <td class="custom-bottom-td acenter" width="14.29%"><p style="text-align:center">Relocation</p></td> 
       <td class="custom-bottom-td acenter" width="14.29%"><p style="text-align:center">INSN</p></td> 
       <td class="custom-bottom-td acenter" width="14.29%"><p style="text-align:center">Lexical/ grammatical</p></td> 
       <td class="custom-bottom-td acenter" width="14.29%"><p style="text-align:center">Total</p></td> 
      </tr> 
      <tr> 
       <td class="custom-top-td acenter" width="14.27%"><p style="text-align:center">RRR-32</p></td> 
       <td class="custom-top-td acenter" width="14.27%"><p style="text-align:center">10</p></td> 
       <td class="custom-top-td acenter" width="14.29%"><p style="text-align:center">0</p></td> 
       <td class="custom-top-td acenter" width="14.29%"><p style="text-align:center">0</p></td> 
       <td class="custom-top-td acenter" width="14.29%"><p style="text-align:center">50</p></td> 
       <td class="custom-top-td acenter" width="14.29%"><p style="text-align:center">0</p></td> 
       <td class="custom-top-td acenter" width="14.29%"><p style="text-align:center">60</p></td> 
      </tr> 
     </table>
    </table-wrap>
    <p>If using an unabstracted assembler prototype, adding a new instruction type would be highly complex. It would require extensive rewriting of dynamic parsing operations and deep knowledge of the assembler’s internals. Analysis of ARM, ARC, and OpenRISC backends in Binutils suggests such a change would involve modifying over 1,000 lines of source code on average.</p>
    <p>In this test, the RRR-32 instruction type from Test 2 will be modified to an RRI-32 instruction type. It includes three register operands and one immediate operand, with each operand occupying 4 bits of encoding. The specific format definition is shown in <xref ref-type="fig" rid="fig14">
      Figure 14
     </xref>.</p>
    <p>To complete the modification of the instruction type under the configurable assembler framework, you only need to change the fourth operand in the RRR-32 instruction type definition to an immediate operand in the instruction configuration file (“extif-insn table.c”) and add the corresponding relocation information “r”. The specific modification steps are as follows:</p>
    <fig id="fig14" position="float">
     <label>Figure 14</label>
     <caption>
      <title>Figure 14. Format definition of RRRI-32 type instruction.</title>
     </caption>
     <graphic mimetype="image" position="float" xlink:type="simple" xlink:href="https://html.scirp.org/file/7601503-rId68.jpeg?20250825092308" />
    </fig>
    <p>Step 1. Add a relocation definition for the immediate operand in the relocation configuration file. This involves modifications to three configuration files:</p>
    <fig id="fig15" position="float">
     <label>Figure 15</label>
     <caption>
      <title>Step 2. Add a new relocation name definition in “extif-bfdmacro.h”. The modified configuration file is as follows:Step 3. Add a new BFD identifier “BFD_RELOC_TOP_RRI32” to “extif-reloc_define.h”.Step 4. Add relocation handling methods and immediate operand encoding information to “extif-reloc_table.c”. The following code snippet lists the parts that need to be added.<p class="imgGroupCss_v"><img class=" imgMarkCss lazy" data-original="https://html.scirp.org/file/7601503-rId70.jpeg?20250825092309" /></p>Step 5. Modify the instruction type identifier “INST_TYPE_RRR32” to “INSN_TYPE_RRI32” in “extif-opcode.h”.Step 6. In the instruction type configuration file (“extif-insn_table.c”), change the fourth operand of the RRR-32 type to an immediate operand type and add the mapping of the “BFD_RELOC_TOP_RRI32” type relocation. The modified part of the code is as follows:<p class="imgGroupCss_v"><img class=" imgMarkCss lazy" data-original="https://html.scirp.org/file/7601503-rId71.jpeg?20250825092308" /></p><p class="imgGroupCss_v"><img class=" imgMarkCss lazy" data-original="https://html.scirp.org/file/7601503-rId72.jpeg?20250825092308" /></p><xref ref-type="table" rid="table6">
        Table 6
       </xref> lists the lines of code affected by modifying the RRR-32 instruction type. It involves only about 40 lines of code, and the affected code is all within structures or enumerations, without any control-type instructions.As with Test 2, modifying an instruction type on an assembler prototype would require effort comparable to adding a new instruction type, affecting an estimated 1,000+ lines of code.</title>
     </caption>
     <graphic mimetype="image" position="float" xlink:type="simple" xlink:href="https://html.scirp.org/file/7601503-rId69.jpeg?20250825092308" />
    </fig>
    <table-wrap id="table6">
     <label>
      <xref ref-type="table" rid="table6">
       Table 6
      </xref></label>
     <caption>
      <title>
       <xref ref-type="bibr" rid="scirp.145048-"></xref>Table 6. Number of source lines impacted by changing RRR-32 to RRI-32.</title>
     </caption>
     <table class="MsoTableGrid custom-table" border="0" cellspacing="0" cellpadding="0"> 
      <tr> 
       <td class="custom-bottom-td acenter" width="14.27%"><p style="text-align:center"></p></td> 
       <td class="custom-bottom-td acenter" width="14.27%"><p style="text-align:center">GPR</p></td> 
       <td class="custom-bottom-td acenter" width="14.29%"><p style="text-align:center">SPR</p></td> 
       <td class="custom-bottom-td acenter" width="14.29%"><p style="text-align:center">Relocation</p></td> 
       <td class="custom-bottom-td acenter" width="14.29%"><p style="text-align:center">INSN</p></td> 
       <td class="custom-bottom-td acenter" width="14.29%"><p style="text-align:center">Lexical/ grammatical</p></td> 
       <td class="custom-bottom-td acenter" width="14.29%"><p style="text-align:center">Total</p></td> 
      </tr> 
      <tr> 
       <td class="custom-top-td acenter" width="14.27%"><p style="text-align:center">RRI-32</p></td> 
       <td class="custom-top-td acenter" width="14.27%"><p style="text-align:center">0</p></td> 
       <td class="custom-top-td acenter" width="14.29%"><p style="text-align:center">0</p></td> 
       <td class="custom-top-td acenter" width="14.29%"><p style="text-align:center">30</p></td> 
       <td class="custom-top-td acenter" width="14.29%"><p style="text-align:center">10</p></td> 
       <td class="custom-top-td acenter" width="14.29%"><p style="text-align:center">0</p></td> 
       <td class="custom-top-td acenter" width="14.29%"><p style="text-align:center">40</p></td> 
      </tr> 
     </table>
    </table-wrap>
    <p>This test will add a MIMD (Multiple Instructions Multiple Data) type instruction to the TOP instruction set. It will comprehensively test the configurability of the assembler. The format of this MIMD-type instruction is defined in <xref ref-type="fig" rid="fig15">
      Figure 15
     </xref>. The instruction comprises three sub-instructions: AC (10 bits), MC (7 bits), and XMC (7 bits). AC includes six instruction types, while MC and XMC have four types each. To add this MIMD-type instruction to the configurable assembler framework, follow these steps:</p>
    <p>Step 1. Define special registers used in MIMD in the special register configuration file (extif-spr_table.c). For example, the accumulators CH and CL. The specific modifications to the special register configuration file are shown below, where the fields in the special register table entries are, in order, the special register name, instruction type, and special register encoding.</p>
    <fig id="fig16" position="float">
     <label>Figure 16</label>
     <caption>
      <title>Step 2. Define data registers used in MIMD (

       <math xmlns="http://www.w3.org/1998/Math/MathML" display="inline"> <mrow> 
  
         <mtext>
          
   d
  
         </mtext>
  
         <mn>
          
   0
  
         </mn>
  
         <mtext></mtext>
  
         <mover accent="true">
   
          <mtext>
           
     d 
   
          </mtext>
   
          <mo>
           
    ˜
   
          </mo> 
  
         </mover> 
  
         <mn>
          
   3
  
         </mn>
 
        </mrow> 

       </math>) in the general register configuration file (extif-gpr_table.c): This part is similar to the method of adding registers in Test 2.Step 3. Define the AC sub-instruction structure list in the instruction type configuration file: There are six types in total, and the definition of each type is similar to the instruction type addition in Test 2.Step 4. Define the MC and XMC sub-instruction structure lists in the instruction type configuration file: There are four types in total, and the definition of each type is similar to the instruction type addition in Test 2.Step 5. Define the MIMD instruction type INSN_TYPE_MIMD3 in the instruction type configuration file: This represents a type with three parallel instructions. This part is very similar to the instruction type addition in Test 2, with the difference being that its three operands are all sub-instructions. The specific modifications are shown below.<p class="imgGroupCss_v"><img class=" imgMarkCss lazy" data-original="https://html.scirp.org/file/7601503-rId76.jpeg?20250825092309" /></p>Step 6. Add the syntax parsing expression for parallel instructions: This will allow the assembler to recognize the MIMD instruction in the form of “insn1|insn2|insn3”. The main modifications are shown below.<p class="imgGroupCss_v"><img class=" imgMarkCss lazy" data-original="https://html.scirp.org/file/7601503-rId77.jpeg?20250825092309" /></p><xref ref-type="bibr" rid="scirp.145048-"></xref><p class="imgGroupCss_v"><img class=" imgMarkCss lazy" data-original="https://html.scirp.org/file/7601503-rId78.jpeg?20250825092310" /></p>Figure 15. Format definition of MIMD type instruction.</title>
     </caption>
     <graphic mimetype="image" position="float" xlink:type="simple" xlink:href="https://html.scirp.org/file/7601503-rId73.jpeg?20250825092310" />
    </fig>
    <p>After these steps, the assembler is complete. When encountering a MIMD instruction, the assembler’s lexical parser will parse out three instructions, then sequentially traverse these three instructions, query the newly established instruction type table, and generate the correct machine code.</p>
    <p>
     <xref ref-type="table" rid="table7">
      Table 7
     </xref> lists the lines of source code affected by adding the MIMD instruction type. Defining the MIMD instruction type affects approximately 235 lines of instruction and only involves the definition of structures and enumerations.</p>
    <table-wrap id="table7">
     <label>
      <xref ref-type="table" rid="table7">
       Table 7
      </xref></label>
     <caption>
      <title>
       <xref ref-type="bibr" rid="scirp.145048-"></xref>Table 7. Number of source lines impacted by adding MIMD type instruction.</title>
     </caption>
     <table class="MsoTableGrid custom-table" border="0" cellspacing="0" cellpadding="0"> 
      <tr> 
       <td class="custom-bottom-td acenter" width="14.27%"><p style="text-align:center"></p></td> 
       <td class="custom-bottom-td acenter" width="14.27%"><p style="text-align:center">GPR</p></td> 
       <td class="custom-bottom-td acenter" width="14.29%"><p style="text-align:center">SPR</p></td> 
       <td class="custom-bottom-td acenter" width="14.29%"><p style="text-align:center">Relocation</p></td> 
       <td class="custom-bottom-td acenter" width="14.29%"><p style="text-align:center">INSN</p></td> 
       <td class="custom-bottom-td acenter" width="14.29%"><p style="text-align:center">Lexical/ grammatical</p></td> 
       <td class="custom-bottom-td acenter" width="14.29%"><p style="text-align:center">Total</p></td> 
      </tr> 
      <tr> 
       <td class="custom-top-td acenter" width="14.27%"><p style="text-align:center">MIMD</p></td> 
       <td class="custom-top-td acenter" width="14.27%"><p style="text-align:center">10</p></td> 
       <td class="custom-top-td acenter" width="14.29%"><p style="text-align:center">5</p></td> 
       <td class="custom-top-td acenter" width="14.29%"><p style="text-align:center">0</p></td> 
       <td class="custom-top-td acenter" width="14.29%"><p style="text-align:center">200</p></td> 
       <td class="custom-top-td acenter" width="14.29%"><p style="text-align:center">20</p></td> 
       <td class="custom-top-td acenter" width="14.29%"><p style="text-align:center">235</p></td> 
      </tr> 
     </table>
    </table-wrap>
    <p>Adding this MIMD instruction type to the assembler prototype platform would require extensive modifications, including new instruction definition tables and parsing functions. Based on analysis of ARM, ARC, and OpenRISC platforms, it’s estimated that over 2000 lines of code would be affected.</p>
    <p>
     <xref ref-type="table" rid="table8">
      Table 8
     </xref> lists the test results for the above four test sets. The configurable assembler adapts well to changes in the instruction set: the modification amount for handling general instruction set changes is within 100 lines, and the modification amount for adding complex instructions like MIMD is also significantly lower than that of general assemblers.</p>
    <table-wrap id="table8">
     <label>
      <xref ref-type="table" rid="table8">
       Table 8
      </xref></label>
     <caption>
      <title>
       <xref ref-type="bibr" rid="scirp.145048-"></xref>Table 8. Testing results of assembler configurability (Unit: lines).</title>
     </caption>
     <table class="MsoTableGrid custom-table" border="0" cellspacing="0" cellpadding="0"> 
      <tr> 
       <td class="custom-bottom-td acenter" width="30.81%"><p style="text-align:center"></p></td> 
       <td class="custom-bottom-td acenter" width="17.29%"><p style="text-align:center">Test 1</p></td> 
       <td class="custom-bottom-td acenter" width="17.30%"><p style="text-align:center">Test 2</p></td> 
       <td class="custom-bottom-td acenter" width="17.29%"><p style="text-align:center">Test 3</p></td> 
       <td class="custom-bottom-td acenter" width="17.30%"><p style="text-align:center">Test 4</p></td> 
      </tr> 
      <tr> 
       <td class="custom-top-td acenter" width="30.81%"><p style="text-align:center">Configurable Assembler</p></td> 
       <td class="custom-top-td acenter" width="17.29%"><p style="text-align:center">20</p></td> 
       <td class="custom-top-td acenter" width="17.30%"><p style="text-align:center">60</p></td> 
       <td class="custom-top-td acenter" width="17.29%"><p style="text-align:center">40</p></td> 
       <td class="custom-top-td acenter" width="17.30%"><p style="text-align:center">235</p></td> 
      </tr> 
      <tr> 
       <td class="acenter" width="30.81%"><p style="text-align:center">General Assembler</p></td> 
       <td class="acenter" width="17.29%"><p style="text-align:center">&gt;300</p></td> 
       <td class="acenter" width="17.30%"><p style="text-align:center">&gt;1000</p></td> 
       <td class="acenter" width="17.29%"><p style="text-align:center">&gt;1000</p></td> 
       <td class="acenter" width="17.30%"><p style="text-align:center">&gt;2000</p></td> 
      </tr> 
     </table>
    </table-wrap>
   </sec>
   <sec id="s4_3">
    <title>4.3. RL-MARTE Optimization Evaluation</title>
    <p>To evaluate the effectiveness of our RL-enhanced MARTE constraint solver in assembler configuration optimization, we conducted comparative experiments across four typical ISA adaptation scenarios. The RL agent was trained using 200 historical configuration tasks with curriculum learning, achieving 92% convergence accuracy after 150 training epochs.</p>
    <p>We compared three configuration strategies:</p>
    <p>The evaluation metrics included:</p>
    <p>
     <xref ref-type="table" rid="table9">
      Table 9
     </xref> and <xref ref-type="fig" rid="fig16">
      Figure 16
     </xref> demonstrate RL-MARTE’s superior performance in complex configuration tasks:</p>
    <fig id="fig17" position="float">
     <label>Figure 17</label>
     <caption>
      <title>Figure 16. Performance comparison of different configuration strategies across test cases.</title>
     </caption>
     <graphic mimetype="image" position="float" xlink:type="simple" xlink:href="https://html.scirp.org/file/7601503-rId79.jpeg?20250825092314" />
    </fig>
    <table-wrap id="table9">
     <label>
      <xref ref-type="table" rid="table9">
       Table 9
      </xref></label>
     <caption>
      <title>
       <xref ref-type="bibr" rid="scirp.145048-"></xref>Table 9. RL-MARTE optimization results (averaged across 50 trials).</title>
     </caption>
     <table class="MsoTableGrid custom-table" border="0" cellspacing="0" cellpadding="0"> 
      <tr> 
       <td class="acenter" width="34.82%"><p style="text-align:center">Metric</p></td> 
       <td class="acenter" width="21.72%"><p style="text-align:center">Manual</p></td> 
       <td class="acenter" width="21.72%"><p style="text-align:center">Static MARTE</p></td> 
       <td class="acenter" width="21.74%"><p style="text-align:center">RL-MARTE</p></td> 
      </tr> 
      <tr> 
       <td class="custom-top-td acenter" width="34.82%"><p style="text-align:center">Configuration Steps</p></td> 
       <td class="custom-top-td acenter" width="21.72%"><p style="text-align:center">38.2</p></td> 
       <td class="custom-top-td acenter" width="21.72%"><p style="text-align:center">12.7</p></td> 
       <td class="custom-top-td acenter" width="21.74%"><p style="text-align:center">5.3</p></td> 
      </tr> 
      <tr> 
       <td class="acenter" width="34.82%"><p style="text-align:center">Constraint Violations (%)</p></td> 
       <td class="acenter" width="21.72%"><p style="text-align:center">22.4</p></td> 
       <td class="acenter" width="21.72%"><p style="text-align:center">8.5</p></td> 
       <td class="acenter" width="21.74%"><p style="text-align:center">1.2</p></td> 
      </tr> 
      <tr> 
       <td class="acenter" width="34.82%"><p style="text-align:center">Code Size Reduction (%)</p></td> 
       <td class="acenter" width="21.72%"><p style="text-align:center">14.7</p></td> 
       <td class="acenter" width="21.72%"><p style="text-align:center">18.3</p></td> 
       <td class="acenter" width="21.74%"><p style="text-align:center">26.5</p></td> 
      </tr> 
      <tr> 
       <td class="acenter" width="34.82%"><p style="text-align:center">Time per Task (min)</p></td> 
       <td class="acenter" width="21.72%"><p style="text-align:center">45.6</p></td> 
       <td class="acenter" width="21.72%"><p style="text-align:center">28.3</p></td> 
       <td class="acenter" width="21.74%"><p style="text-align:center">9.8</p></td> 
      </tr> 
     </table>
    </table-wrap>
    <p>Key findings include:</p>
    <p>These results validate that RL-MARTE effectively balances architectural constraints with optimization objectives, particularly excelling in:</p>
    <p>The experiment demonstrates significant advantages in handling non-trivial ISA extensions like the MIMD case study, where RL-MARTE achieved 40% faster configuration than manual approaches while maintaining full constraint compliance.</p>
   </sec>
  </sec><sec id="s5">
   <title>5. Conclusions</title>
   <p>This study establishes a novel paradigm for configurable assembler design through the integration of MARTE-based formal modeling and reinforcement learning optimization. The proposed framework demonstrates three key advantages: 1) Through its CIDL interface and modular architecture, configuration efforts for typical ISA modifications are reduced; 2) The RL-MARTE hybrid optimization achieves first-pass valid configurations by dynamically balancing encoding efficiency with formal constraints.</p>
   <p>Our experimental results reveal several critical insights: First, a total of 26 test cases covering all instruction formats and operand types were constructed, comprising 271 assembly statements. The assembler’s output object files were compared against the expected encodings defined in the ISA. All tests passed, verifying the assembler’s correctness. Second, using the addition of the “l.addx2” instruction as an example, only 20 lines in the definition files needed modification under the configurable assembler architecture. This demonstrates significant simplification compared to traditional assemblers, which typically require over 300 lines of code changes for similar updates. Third, to support a new instruction type ‘RRR-32’ with four register operands, only three configuration interfaces were updated: the register table, instruction type enumeration, and instruction definition table. This demonstrates the assembler’s modular design and low coupling, facilitating efficient extensibility. Finally, the experimental results demonstrate that RL-MARTE significantly outperforms manual configuration and static rule-based methods in assembler optimization tasks. It reduced configuration steps by 58%, achieved a 93% first-pass validity rate with only 1.2% constraint violations, and improved code size reduction to 26.5%. The approach also shortened task time by over 75% and autonomously discovered operand packing strategies in 32% of MIMD cases, validating its effectiveness in handling complex ISA customization with high efficiency and constraint compliance.</p>
   <p>Future work will extend this methodology to compiler backends and explore distributed RL for multi-core architecture optimization. The framework’s current limitations in handling ultra-long instruction word (VLIW) architectures suggest directions for enhanced parallelism modeling. These advancements promise to significantly accelerate the toolchain development cycle for emerging processor architectures while maintaining formal correctness guarantees.</p>
  </sec><sec id="s6">
   <title>Acknowledgement</title>
   <p>
    <xref ref-type="bibr" rid="scirp.145048-"></xref>This work was supported by the President’s Fund of Xinjiang University of Political Science and Law—“Research on Small Target Detection in Large-Scale Scenes of Nanjiang” (Grant No. XZZK2022002), Shanghai Key Laboratory of Trustworthy Computing (East China Normal University) (Grant No. 24Z670103399), Key Laboratory of Embedded System and Service Computing (Tongji University), Ministry of Education (Grant No. ESSCKF2024-10), and Key Laboratory of Computational Neuroscience and Brain-Inspired Intelligence (Fudan University), Ministry of Education (Grant No. 25Z670102051), 2025 Shandong Province Youth Natural Science Research Project—“Research on Key Technologies for Small Target Detection in Complex Scenarios” (Grant No.WLZR25001), 2025 Shandong Province Basic and Applied Basic Research Project—“Research on Small Target Detection in Large-scale Scenarios” Grant No.WL-JC25008), 2025 Shandong Province Project on Artificial Intelligence in Teaching and Education Applications-Exploration and Practice of Industry—“Education Integration Mechanism Under the Background of AI + Education” (Project No. WL-AIJ2504003).</p>
  </sec><sec id="s7">
   <title>NOTES</title>
   <p>*Co-first authors.</p>
   <p><sup>#</sup>Corresponding author.</p>
  </sec>
 </body><back>
  <ref-list>
   <title>References</title>
   <ref id="scirp.145048-ref1">
    <label>1</label>
    <mixed-citation publication-type="other" xlink:type="simple">
     Tensilica. Tensilica Products Overview. &gt;https://www.cadence.com/zh_CN/home/tools/silicon-solutions/ai-ip-platform/tensilica-ai-base.html 
    </mixed-citation>
   </ref>
   <ref id="scirp.145048-ref2">
    <label>2</label>
    <mixed-citation publication-type="other" xlink:type="simple">
     ARC. Arc Website. &gt;http://www.arc.com/ 
    </mixed-citation>
   </ref>
   <ref id="scirp.145048-ref3">
    <label>3</label>
    <mixed-citation publication-type="other" xlink:type="simple">
     Hu, W., Zhang, F. and Li, Z. (2005) Microarchitecture of the Godson-2 Processor. Journal of Computer Science and Technology, 20, 243-249. &gt;https://doi.org/10.1007/s11390-005-0243-6
    </mixed-citation>
   </ref>
   <ref id="scirp.145048-ref4">
    <label>4</label>
    <mixed-citation publication-type="other" xlink:type="simple">
     Leibson, S. and Kim, J. (2005) Configurable Processors: A New Era in Chip Design. Computer, 38, 51-59. &gt;https://doi.org/10.1109/mc.2005.226
    </mixed-citation>
   </ref>
   <ref id="scirp.145048-ref5">
    <label>5</label>
    <mixed-citation publication-type="other" xlink:type="simple">
     Xilinx. Xilinx virtex4. &gt;http://www.xilinx.com/products/siliconsolu-tions/fpgas/virtex/virtex4/overview/index.htm 
    </mixed-citation>
   </ref>
   <ref id="scirp.145048-ref6">
    <label>6</label>
    <mixed-citation publication-type="other" xlink:type="simple">
     ARM. Arm. &gt;http://www.arm.com/products/dataengines/index.html 
    </mixed-citation>
   </ref>
   <ref id="scirp.145048-ref7">
    <label>7</label>
    <mixed-citation publication-type="other" xlink:type="simple">
     Binutils. Binutils Homepage. &gt;http://www.gnu.org/software/binutils/ 
    </mixed-citation>
   </ref>
   <ref id="scirp.145048-ref8">
    <label>8</label>
    <mixed-citation publication-type="other" xlink:type="simple">
     Hadjiyiannis, G., Hanono, S. and Devadas, S. (1997) ISDL: An Instruction Set Description Language for Retargetability. Proceedings of the 34th Annual Conference on Design Automation Conference-DAC ‘97, Anaheim, 9-13 June 1997, 299-302. &gt;https://doi.org/10.1145/266021.266108
    </mixed-citation>
   </ref>
   <ref id="scirp.145048-ref9">
    <label>9</label>
    <mixed-citation publication-type="other" xlink:type="simple">
     Xiao, X. and Liu, Z. (2023) ISADL: An Instruction Set Architecture Description Language for VLIW. 2023 IEEE 29th International Conference on Parallel and Distributed Systems (ICPADS), Ocean Flower Island, 17-21 December 2023, 92-99. &gt;https://doi.org/10.1109/icpads60453.2023.00022
    </mixed-citation>
   </ref>
   <ref id="scirp.145048-ref10">
    <label>10</label>
    <mixed-citation publication-type="other" xlink:type="simple">
     Xiao, X. and Liu, Z. (2024) An Adaptive Instruction Set Encoding Automatic Generation Method for VLIW. In: Tari, Z., Li, K.Q. and Wu, H.Y., Eds., Algorithms and Architectures for Parallel Processing, Springer, 283-300. &gt;https://doi.org/10.1007/978-981-97-0834-5_17
    </mixed-citation>
   </ref>
   <ref id="scirp.145048-ref11">
    <label>11</label>
    <mixed-citation publication-type="other" xlink:type="simple">
     Himmelbauer, S., Hochrainer, C., Huber, B., Mischkulnig, N., et al. (2024) The Vienna Architecture Description Language.
    </mixed-citation>
   </ref>
   <ref id="scirp.145048-ref12">
    <label>12</label>
    <mixed-citation publication-type="other" xlink:type="simple">
     Chen, W., Ray, S., Bhadra, J., Abadir, M. and Wang, L. (2017) Challenges and Trends in Modern Soc Design Verification. IEEE Design &amp; Test, 34, 7-22. &gt;https://doi.org/10.1109/mdat.2017.2735383
    </mixed-citation>
   </ref>
   <ref id="scirp.145048-ref13">
    <label>13</label>
    <mixed-citation publication-type="other" xlink:type="simple">
     Arbone, C., Ditu, B., Craciun, S. and Badea, D. (2013) Model-Driven Inline Assembler Generator for Retargetable Compilers. 2013 19th International Conference on Control Systems and Computer Science, Bucharest, 29-31 May 2013, 71-76. &gt;https://doi.org/10.1109/cscs.2013.37
    </mixed-citation>
   </ref>
   <ref id="scirp.145048-ref14">
    <label>14</label>
    <mixed-citation publication-type="other" xlink:type="simple">
     Povazan, I., Popovic, M., Djukic, M. and Cetic, N. (2013) A Retargetable C Compiler for Embedded Systems. 2013 3rd Eastern European Regional Conference on the Engineering of Computer Based Systems, Budapest, 29-30 August 2013, 48-54. &gt;https://doi.org/10.1109/ecbs-eerc.2013.15
    </mixed-citation>
   </ref>
   <ref id="scirp.145048-ref15">
    <label>15</label>
    <mixed-citation publication-type="other" xlink:type="simple">
     Korenkov, I., Loginov, I., Doronin, O., Sadyrin, D. and Derga-chev, A. (2019) Retargetable Compiler Design Issues. International Multidisciplinary Scientific GeoConference: SGEM, 19, 561-568.
    </mixed-citation>
   </ref>
   <ref id="scirp.145048-ref16">
    <label>16</label>
    <mixed-citation publication-type="other" xlink:type="simple">
     Vasilache, N., Zinenko, O., Bik, A.J.C., et al. (2022) Composable and Modular Code Generation in MLIR: A Structured and Retargetable Approach to Tensor Compiler Construction.
    </mixed-citation>
   </ref>
   <ref id="scirp.145048-ref17">
    <label>17</label>
    <mixed-citation publication-type="other" xlink:type="simple">
     Taglietti, L., Filho, J.O.C., Casarotto, D.C., Furtado, O.J.V. and dos Santos, L.C.V. (2005) Automatically Retargetable Pre-Processor and Assembler Generation for ASIPS. The 3rd International IEEE-NEWCAS Conference, Quebec, 19-22 June 2005, 215-218.
    </mixed-citation>
   </ref>
   <ref id="scirp.145048-ref18">
    <label>18</label>
    <mixed-citation publication-type="other" xlink:type="simple">
     Abbaspour, M. and Zhu, J. (2002) Retargetable Binary Utilities. Proceedings of the 39th Conference on Design Automation DAC ‘02, New Orleans, 10-14 June 2002, 331-336. &gt;https://doi.org/10.1145/513918.514004
    </mixed-citation>
   </ref>
   <ref id="scirp.145048-ref19">
    <label>19</label>
    <mixed-citation publication-type="other" xlink:type="simple">
     Youn, J., Kim, H., Ahn, M., et al. (2008) Binutils Retargetable Assembler Linker. Proceedings of the 30th Korean Information Processing Society Autumn Conference, Vol. 15, 843-845.
    </mixed-citation>
   </ref>
   <ref id="scirp.145048-ref20">
    <label>20</label>
    <mixed-citation publication-type="other" xlink:type="simple">
     Baldassin, A., Centoducatte, P. and Santos, L. (2011) Retargetable Binary Tools. In: Rigo, S., Azevedo, R. and Santos, L., Eds., Electronic System Level Design, Springer, 99-114. &gt;https://doi.org/10.1007/978-1-4020-9940-3_6
    </mixed-citation>
   </ref>
   <ref id="scirp.145048-ref21">
    <label>21</label>
    <mixed-citation publication-type="other" xlink:type="simple">
     Moona, R. (2000) Processor Models for Retargetable Tools. Proceedings 11th International Workshop on Rapid System Prototyping. RSP 2000. Shortening the Path from Specification to Prototype (Cat. No.PR00668), Paris, 21-23 June 2000, 34-39. &gt;https://doi.org/10.1109/iwrsp.2000.855183
    </mixed-citation>
   </ref>
   <ref id="scirp.145048-ref22">
    <label>22</label>
    <mixed-citation publication-type="other" xlink:type="simple">
     Hu, M., Zhang, M., Mallet, F., Fu, X. and Chen, M. (2023) Accelerating Reinforcement Learning-Based CCSL Specification Synthesis Using Curiosity-Driven Exploration. IEEE Transactions on Computers, 72, 1431-1446. &gt;https://doi.org/10.1109/tc.2022.3197956
    </mixed-citation>
   </ref>
  </ref-list>
 </back>
</article>