This file is first processed by cpp. This allows us to use #define directives.
(target "SPARC") ; -- Definition of tokens -- (line_comment_chars "!#") (comment_chars "!") (def_exact ",aS()_[]+-") #define INT_TOKEN(CHAR)\ (def_token CHAR [(regex "%[1-2][0-9]\\|\\(%30\\)\\|\\(%31\\)\\| %o[0-7]\\|%g[0-7]\\|%l[0-7]\\|%i[0-7]")]) INT_TOKEN("1") ; rs1 register INT_TOKEN("2") ; rs2 register INT_TOKEN("d") ; rd register #define FLP_TOKEN(CHAR)\ (def_token CHAR [(regex "%f[1-2][0-9]\\|\\(%f30\\)\\|\\(%f31\\) \\|%f[0-9]")]) FLP_TOKEN("e") ; frs1 floating point register FLP_TOKEN("f") ; frs2 floating point register FLP_TOKEN("g") ; frd floating point register (def_token "i" [(read_exp)])
; floating point registers and floating point status register (def_ress (base_name "%f" 0 31) [(type "reg") (width 32)]) (def_ress (name "fcc") [(type "reg") (width 2)] ; global, "out", local and "in" registers (def_ress (base_name "%g" 0 7) [(type "reg") (width 32)]) (def_ress (base_name "%o" 0 7) [(type "reg") (width 32)]) (def_ress (base_name "%l" 0 7) [(type "reg") (width 32)]) (def_ress (base_name "%i" 0 7) [(type "reg") (width 32)]) ;Functional units (def_ress (name "mem") [(type "memory")]) (def_ress (name "issue") [(type "functional_unit")]) (def_ress (name "alu") [(type "functional_unit")])
(def_asm "add" [ (input "1,2,d") R_CPU_ALU_3 ]) (def_asm "add" [ (input "1,i,d") R_CPU_ALU_1 ])Description of the "branch if not equal":
(def_asm "bne" [(input ",al") (sem [S_BRANCH(0) DELAY_SLOT]) R_CPU_B ])
#define ISSUE (ress (name "issue") [(use) (at_cycle 1)]) #define R_CPU_ALU_1 \ (reser_table [ \ ISSUE \ (ress (match_arg 0) [(read) (at_cycle 1) INT_REG]) \ (ress (name "alu") [(use) (at_cycle 2)]) \ (ress (match_arg 2) [(write) (from_cycle 2) (to_cycle 2) INT_REG]) ]) #define R_CPU_ALU_3 \ (reser_table [ \ ISSUE \ (ress (match_arg 0) [(read) (at_cycle 1) INT_REG]) \ (ress (match_arg 1) [(read) (at_cycle 1) INT_REG]) \ (ress (name "alu") [(use) (at_cycle 2)]) \ (ress (match_arg 2) [(write) (from_cycle 2) (to_cycle 2) INT_REG]) ]) #define R_CPU_B \ (reser_table [ \ ISSUE_BRANCH \ (ress (name "icc") [(read) (at_cycle 1)]) \ (ress (name "alu") [(use) (at_cycle 2)]) ])
#define S_BRANCH(index) (branch index) #define DELAY_SLOT (delay_slot 1)