Skip to content

Latest commit

 

History

History
21 lines (16 loc) · 1.34 KB

File metadata and controls

21 lines (16 loc) · 1.34 KB

To Index

Using Multiple Files

Your register definitions, command implementations, system properties, and even user program can be split up across several files as you wish.

You have the following options:

  • The ASB command accepts more than one file, which it will be executed in order.
  • Additionally, you can use the --include cli flag to specify extra files which will be parsed first. See asb --help.
  • Use the .include directive within your ASB program to include another file.
    • This will execute the file as if it contents where present instead of the .include directive.
    • .include is followed by a string (enclosed in ") which is a file reference either absolute or relative to the current file.
    • You may use / as directory separator on both Windows and Linux.
    • Example:
// From ../asb/example/virtual-register.asb:
.include "../lib/risc-v/risc-v.asb" // Loads the RISC-V implementation
  • Alternatively you can use .include_once which behaves the same as .include except that a file that has already been parsed will not be included again. This usually makes sense when loading a file that contains instruction set definitions (which cannot be executed more than once).