The description of the instruction set is made by providing individual descriptions of assembler-supported instruction/operation mnemonics and macros. Each instruction/operation description contains the name of the mnemonic, the meta-variable pattern identifying its operands, the reservation table information, and possibly, semantical information (presence of delays introduced by the instruction, etc.).
The number of operations in a VLIW instruction (the maximum number of operations that can be issued in a single clock cycle) is defined using the expression
< inst_width>::=
( inst_width <size>)
where <size> is an integer. If this definition is omitted, the
default value of 1 is assumed.
Semantical information supported by SALTO covers the specification of operands of control flow instructions, and the definitions of load, write, and branch delays (and the associated limitations on instruction scheduling).
In its most general form, the semantical information follows syntax
< semantical_info>::=
( sem
[<semantical_property>+])
< semantical_property>::=
<control_target> |
(return) |
<delay_slot> |
(noreorder)
Basic semantical information on branch, jump and call instructions uses a common format
< control_target>::=
( <control_flow_insn>
<num_arg>)
where
The expression (return) indicates the return to an implicit address.
Delay slot information is provided using the delay_slot expression:
< delay_slot>::=
<slot>)
( delay_slot
where
The restrictions on instruction reordering introduced by the presence of delay slots are expressed using the (noreorder) property. If present, (noreorder) forbids the instructions preceding the current instruction to be rescheduled after it, and the instructions following it to be rescheduled before it. This restriction applies to instructions which terminate or are issued within the branch delay after the issue of the relevant control instruction.
Given the large variety and complexity of write-back by-pass definitions, by-pass facilities are expressed through a user-supplied hook function updateDelay(...) which produces updated instruction-to-instruction delay values on demand. In particular, this function (if available) is automatically called during the computation of minimum scheduling delay between instructions (see methods int INST::getDelay() and int INST::getResDelay() in section 3.3.5.)
The general form of an instruction/operation definition is
< def_asm>::=
( def_asm
"<name>"
[
(input "<format>")
<res_table>
<semantical_info>0|1
(info "<any-text>")0|1
])
where
(def_asm "fadd" ; floating-point addition [(input "g,m,s,t,d") ; d <- s+t, plus guard (g) and modifier (m) R_FLOAT_ALU ; reservation table of FP arithmetic ]) (def_asm "jmpi" ; jump to immediate address [(input "g,m") ; if (LSbit(g) == 1) then PC <- m R_BRANCH ; reservation table of branching insns (sem [ BRANCH(1) ; "m" is the immediate address operand (delay_slot 3) ; branch delay is 3 (noreorder) ; prevent insn reordering ]) ])
Macro-instructions of the assembly language are described in two steps:
< def_macro>::=
( def_macro
"<name>"
[
(input "<format>")
(info "<any-text>")0|1
<macro_expansion>
])
where
; MIPS branch to immediate offset if greater or equal (def_macro "bge" [ (input "s,t,i" ) ; if (s>=t) then PC <- PC + i EXPAND_BGE_1 ; expansion: EXPAND_BGE_1 ])
The expansion of macro-instructions is described using expand expressions which define the expansion of the macro into native instructions. Each native instruction in the expansion is described by its name, its input format, and a vector of operand construction directives.
For each meta-variable (formal parameter) in the input format of each native instruction in the expansion of the macro, there is a matching element in the vector operand construction vector. Each such field describes the way the corresponding actual parameter is built from the actual parameters of the macro and from predefined elements.
The expressions that can appear in the operand construction vector are divided in two groups: three basic forms, and three compound expressions that use the basic forms:
The syntax of the definitions of macro-instruction expansions is
< macro_expansion>::=
( expand
[
(build_asm
"<ins_name>" "<ins_format>"
[
(with_reg "<reg>")*
<positional_param>*
(const_expr "<expr>")*
(multireg
<base_register> <index> <size>
)*
(add_expr
<positional_param>
(const_expr "<expr>")
)*
(imm_part
"<part>" "<sign>" <width>
<positional_param>
)*
]
)+
])
< base_register>::=
<positional_param> | (with_reg "<reg>")
where
"*"
indicates
that the appropriate format should be determined at run-time;"7*4"
;The following example shows the expansion of a branching macro ``bge'' (``branch if greater or equal'') used by MIPS assemblers:
; replaces "bge s,t,i" by the sequence : ; $at <- (s < t) ? 1 : 0 ; if ($at == 0) then PC <- PC + i #define M_BGE_1\ (expand [\ (build_asm "slt" "d,s,t" \ [(with_reg "$at") \ (match_arg 0) \ (match_arg 1)])\ (build_asm "beq" "s,t,i" \ [(with_reg "$at") \ (with_reg "$0") \ (match_arg 2)]) \ ])