Giter Site home page Giter Site logo

Comments (5)

erikeidt avatar erikeidt commented on May 16, 2024
	.text 0x00400000
	jal x0, label2

	.text 0x00408080

label1:
	lw	x1, 0(x1)

	.text 0x004085e8
label2:
	jal	x1, label1
	lw	x2, 0(x2)

from rars.

erikeidt avatar erikeidt commented on May 16, 2024

This first branch, from 0x40 0000 to 0x40 85e8, is well within the 20-bit immediate range of the JAL U-Type instruction.

from rars.

TheThirdOne avatar TheThirdOne commented on May 16, 2024

Thanks for the report. This is a problem in the assembler; the instruction encoding for jal is J-type as it should be.

The relevant lines in the assembler are

if (address >= (1 << 11) || address < -(1 << 11)) {
errors.add(new ErrorMessage(this.sourceProgram, this.sourceLine, 0,
"Jump target word address beyond 12-bit range"));
return;

It should be possible to fix this simply by changing those lines to reflect the 20 bit range, but finding that raised some questions about by jalr isn't handled nearby so I am going to do some more investigation.

from rars.

TheThirdOne avatar TheThirdOne commented on May 16, 2024

bd77755, fixes the size checks for jal and branches as it turns out >12bit offsets are allowed.

I would appreciate it if you confirmed that it now works as expected.

from rars.

erikeidt avatar erikeidt commented on May 16, 2024

from rars.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.