summaryrefslogtreecommitdiff
path: root/lib/compiler/compilerconsts.tcl
diff options
context:
space:
mode:
Diffstat (limited to 'lib/compiler/compilerconsts.tcl')
-rw-r--r--[-rwxr-xr-x]lib/compiler/compilerconsts.tcl44
1 files changed, 31 insertions, 13 deletions
diff --git a/lib/compiler/compilerconsts.tcl b/lib/compiler/compilerconsts.tcl
index 175ceb9..e8a71f4 100755..100644
--- a/lib/compiler/compilerconsts.tcl
+++ b/lib/compiler/compilerconsts.tcl
@@ -2,7 +2,7 @@
# Part of MCU 8051 IDE ( http://mcu8051ide.sf.net )
############################################################################
-# Copyright (C) 2007-2009 by Martin Ošmera #
+# Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012 by Martin Ošmera #
# martin.osmera@gmail.com #
# #
# This program is free software; you can redistribute it and#or modify #
@@ -21,6 +21,11 @@
# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #
############################################################################
+# >>> File inclusion guard
+if { ! [ info exists _COMPILERCONSTS_TCL ] } {
+set _COMPILERCONSTS_TCL _
+# <<< File inclusion guard
+
# --------------------------------------------------------------------------
# DESCRIPTION
# Defines compiler constatnts. This code is part of Compiler
@@ -67,11 +72,18 @@ namespace eval CompilerConsts {
}
# All compiler directives
variable AllDirectives {
- bit set equ code data
- xdata idata bseg dseg iseg
- xseg ds dbit cseg db
- dw include list nolist
+ endif endm end else exitm
+ list nolist dseg iseg bseg
+ xseg cseg skip name equ
+ bit set code data idata
+ xdata macro flag ds dw
+ db dbit include org if
+ using byte name rept times
+ elseif ifn elseifn ifdef elseifdef
+ ifndef elseifndef ifb elseifb
+ ifnb elseifnb local
}
+
# Addresses of SFR registers
variable MapOfSFRArea {
{P0 80} {SP 81} {DPL 82} {DPH 83}
@@ -146,7 +158,7 @@ namespace eval CompilerConsts {
# Format:
# {
# {Instruction} {Operands_count
- # {{Operand_type_0 Operand_type_1 ...} Code_length Opcode Opcode_mask Instr_cycles_per_iteration}
+ # {{Operand_type_0 Operand_type_1 ...} Code_length Opcode Opcode_mask Machine_cycles_per_iteration}
# ...
# }
# ...
@@ -705,9 +717,10 @@ namespace eval CompilerConsts {
MapOfSFRArea
MapOfSFRBitArea
progVectors
- } {
+ } \
+ {
variable $var
- set val [subst "\$$var"]
+ set val [subst -nocommands "\$$var"]
regsub -all {\s+} $val { } $var
}
@@ -743,6 +756,7 @@ namespace eval CompilerConsts {
incr def_idx
# Local variables
+ set time [lindex $code_def 4] ;# Time
set mask [lindex $code_def 3] ;# OP code mask
set opcode [lindex $code_def 2] ;# OP code
set len [lindex $code_def 1] ;# Code length
@@ -777,10 +791,10 @@ namespace eval CompilerConsts {
continue
}
lappend defined_OPCODE $opcode
- set Opcode($opcode) "$instruction {$operands} $len {}"
+ set Opcode($opcode) [list $instruction $operands $len {} $time]
}
# Non-zero OP code mask
- } {
+ } else {
# Translate OP code and its mask to list of booleans
set opcode [assembler::hex2binlist $opcode]
set mask [assembler::hex2binlist $mask]
@@ -808,7 +822,7 @@ namespace eval CompilerConsts {
}
# Determinate list of possible high-order values
- # of opreands acording to the mask
+ # of opreands according to the mask
set values {}
set tmp 0
set tmp_len 0
@@ -832,7 +846,7 @@ namespace eval CompilerConsts {
if {$mask_bit} {
append tmp [string index $val $idx]
incr idx
- } {
+ } else {
append tmp $opcode_bit
}
}
@@ -860,7 +874,7 @@ namespace eval CompilerConsts {
continue
}
lappend defined_OPCODE $opcode
- set Opcode($opcode) [list $instruction $operands $len $masked_opr]
+ set Opcode($opcode) [list $instruction $operands $len $masked_opr $time]
}
}
@@ -871,3 +885,7 @@ namespace eval CompilerConsts {
# Initialize NS variables
CompilerConsts::initialize
+
+# >>> File inclusion guard
+}
+# <<< File inclusion guard