Giter Club home page Giter Club logo

Comments (3)

MineRobber9000 avatar MineRobber9000 commented on May 24, 2024
#d "hello", 0

Not sure what .global symbol does but .asciz can be done with this. You could even use a function:

#fn asciz(s) => ascii(s) @ 0`8
#d asciz("hello")

from customasm.

ggutierrez avatar ggutierrez commented on May 24, 2024

Here is an example of what I'm trying to achieve. When .data is parsed then I know that whatever is declared after it goes in the memory as static values. That is why I want to make a rule for it.

#subruledef registerName {
  x0 => 0`5
  x1 => 1`5
  x2 => 2`5
  x3 => 3`5
  x4 => 4`5
}

#ruledef {
  add {rdest: registerName},{rs1: registerName},{rs2: registerName} =>  0x00`7 @ rs2`5 @ rs1`5 @ 0`3 @ rdest`5 @ 0b0110011
}

#ruledef {
  .data => 0`4
}

.data
argument: .word   7
str1:     .string "something1"
str2:     .string " something2 "

.text
main:
add x3, x3, x3

from customasm.

MineRobber9000 avatar MineRobber9000 commented on May 24, 2024

I'm not sure what "static values" means in this context-- all values outputted to the ROM are static, it's just a matter of how those values are encoded. Your .data section here can be written as:

argument:
#d32 7 ; or d16 for that size
str1:
#d "something1" ; assuming string vs asciz means it's not null terminated, add ", 0" if I'm wrong
str2:
#d " something2 " ; again, add ", 0" for null termination

Of course, if you wanted to codify these as instructions you could easily add them (though you'd need to get rid of the leading dot, since customasm assumes something with a leading dot is a local label):

#ruledef {
    word {n: u32} => n
    string {s} => s
}

from customasm.

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.