PARAMLIB - The Parameter Library

The parameter library is used to create the type definitions of parameters used by the project. HASE supplies the built-in types: bit, bool, char, integer, unsigned integer, long, floating-point, string and range, from which more complex types can be created, for example structures, enumerations and ranges. Once types have been defined in the parameter library, instances of these types can then be created in the GLOBALS section of the project definition file and within entity declarations (in the ENTITYLIB section).
ENUM ( typename, [ enumerate : icon, ... ] )
STRUCT ( typename, [ reference_parameter , ... ] )
INSTR ( typename, [ (tag, reference_parameter ) , ... ] , class_enum )
LINK ( typename, [ ( tag, reference_parameter : icon), ... ] )
ARRAY ( typename, type_of_elements )
ARRAYI ( typename, type_of_elements )

Instr - Instruction Parameter

The Instr parameter is best explained by means of an example. The following example shows the full instruction set of a simple computer, preceded by the necessary operand STRUCT definitions. Each instruction consists of a function and zero, one or more operands.

>>> include insttruction table here.

-- operands for loading a register from memory using address + (index reg)
    STRUCT (t_load, [RSTRING (dest_reg, "-", 5), RSTRING (src_reg, "-", 5),
        RINT (address, 0)]);

-- operands for storing a register to memory using address + (index reg)
    STRUCT (t_store, [RSTRING (src_reg, "-", 5), RSTRING (dest_reg, "-", 5),
        RINT (address, 0)]);
-- operand for loading register with immediate
    STRUCT (t_loadi, [RSTRING (dest_reg, "-", 5), RINT (immediate, 0)]);

-- operands for move instruction
    STRUCT (t_move, [RSTRING (dest_reg, "-", 5), RSTRING (src_reg, "-", 5)]);
-- operands for ALU scalar instruction group
    STRUCT (t_alu, [RSTRING (dest_reg, "-", 5),
        RSTRING (src_reg1, "-", 5),
        RSTRING (src_reg2, "-", 5)]);

-- operands for ALUI scalar instruction group
    STRUCT (t_alui, [RSTRING (dest_reg, "-", 5),
        RSTRING (src_reg1, "-", 5),
        RINT (immediate, 0)]);

-- operands for COMP instruction
    STRUCT (t_comp, [RSTRING (src_reg1, "-", 5), RSTRING (src_reg2, "-", 5)]);

-- Definition of a simple instruction set
    INSTR (t_simple_instrn_set, [(NOP),
        (JUMP, RINT (immediate, 0)),
        (JREG, RSTRING (src_reg, "-")),
        (SETCC(SEQ,SNE,SGT,SLT,SGE,SLE), RSTRUCT (t_comp, comp_field)),
        (BRANCH, RSTRING (label, "-", 50)),
        (LDM, RSTRUCT (t_load, load_field)),
        (LDI, RSTRUCT (t_loadi, loadi_field)),
        (STM, RSTRUCT (t_store, store_field)),
        (ALU(ADD,SUB,MUL,DIV,AND,OR,XOR,SLL,SRL,SRA), RSTRUCT (t_alu, alu_field)),
        (ALUI(ADDI,SUBI,MULI,DIVI,ANDI,ORI,XORI,SLLI,SRLI,SRAI),
        RSTRUCT (t_alui, alui_field)),
        (STOP) ], function);

Notes