\ Do not use this file except in compliance with the License. You may \ obtain a copy of the License at http://www.microcore.org/License/ \ Software distributed under the License is distributed on an "AS IS" basis, \ WITHOUT WARRANTY OF ANY KIND, either express or implied. \ See the License for the specific language governing rights and limitations \ under the License. \ \ The Original Code is: MICROCORE.FS \ \ Last change: KS 10.07.2015 16:48:31 \ \ The Initial Developer of the Original Code is Klaus.Schleisiek AT microcore.org. \ Port to the gforth system, extensions and adding the debugger by Ulrich.E.Hoffmann AT xlerb.de \ \ uCore Forth Cross-compiler part 1: Loads configuration from VHDL file \ This code loads on the public domain gforth http://www.gnu.org/software/gforth/gforth.html Forth definitions \ --------------------------------------------------------------------------- \ instruction fields as defined by the hardware architecture \ --------------------------------------------------------------------------- $80 Constant #literal $7F Constant #litmask $60 Constant #type $18 Constant #stack $07 Constant #group $F8 Constant #groupmask $1F Constant #usrmask \ type field $00 Constant #bra $20 Constant #alu $40 Constant #mem $60 Constant #usr \ stack field $00 Constant #none $08 Constant #pop $10 Constant #push $18 Constant #both \ --------------------------------------------------------------------------- \ words to interpret VHDL code in CONSTANTS.VHD \ \ CONSTANT with_mult : STD_LOGIC := '0'; \ CONSTANT data_width : NATURAL := 16; \ CONSTANT flag_reg : INTEGER := -2; \ CONSTANT mark_start : byte := "00110011"; \ --------------------------------------------------------------------------- Vocabulary --VHDL --VHDL definitions 1 Constant byte 1 Constant STD_LOGIC_VECTOR 2 Constant STD_LOGIC 3 Constant NATURAL 3 Constant INTEGER 4 Constant REAL 5 Constant BOOLEAN : CONSTANT ( -- ) 0 Constant ; : bin_parameter ( c -- n ) dup scan-input parse binary s>number drop ; : dec_parameter ( -- n ) BL skip-input [char] ; parse decimal s>number drop ; : vhdl_types ( type -- n ) 1 case? IF [char] " bin_parameter EXIT THEN 2 case? IF [char] ' bin_parameter negate immediate EXIT THEN 3 case? IF dec_parameter EXIT THEN 4 case? IF dec_parameter &10 / EXIT THEN 5 case? IF [char] ; word count evaluate EXIT THEN abort" unknown type" ; : STD_LOGIC_VECTOR ( -- type ) postpone ( byte ; \ ) : := ( type -- ) Base save vhdl_types here cell- ! ; \ patch constant created before : --~ ( ccc~ -- ) [char] ~ scan-input ; \ ~ : --Forth ( ccc~ -- ) Forth --~ ; ' \ Alias -- ' noop Alias ; ' noop Alias : Forth definitions