PACE figforth Implementation

Similar documents
CSIS1120A. 10. Instruction Set & Addressing Mode. CSIS1120A 10. Instruction Set & Addressing Mode 1

When an instruction is initially read from memory it goes to the Instruction register.

2. ADDRESSING METHODS

Instruction Sets: Characteristics and Functions Addressing Modes

Page 1. Structure of von Nuemann machine. Instruction Set - the type of Instructions

Computer Organization CS 206 T Lec# 2: Instruction Sets

Instruction Set Architecture

COSC 6385 Computer Architecture. Instruction Set Architectures

Chapter 9. Programming Framework

MOS 6502 Architecture

Microcontroller Intel [Instruction Set]

Topics Power tends to corrupt; absolute power corrupts absolutely. Computer Organization CS Data Representation

William Stallings Computer Organization and Architecture 8 th Edition. Chapter 11 Instruction Sets: Addressing Modes and Formats

TYPES OF INTERRUPTS: -

Microprocessors 1. The 8051 Instruction Set. Microprocessors 1 1. Msc. Ivan A. Escobar Broitman

Instruction Set II. COMP 212 Computer Organization & Architecture. COMP 212 Fall Lecture 7. Instruction Set. Quiz. What is an Instruction Set?

Assembly Language Programming of 8085

The CPU and Memory. How does a computer work? How does a computer interact with data? How are instructions performed? Recall schematic diagram:

STRUCTURE OF DESKTOP COMPUTERS

William Stallings Computer Organization and Architecture

Rui Wang, Assistant professor Dept. of Information and Communication Tongji University.

Instruction Set Principles and Examples. Appendix B

CHAPTER 8: Central Processing Unit (CPU)

CS 261 Fall Binary Information (convert to hex) Mike Lam, Professor

CPU: SOFTWARE ARCHITECTURE INSTRUCTION SET (PART

Assembly Language Programming of 8085

UNIT-II. Part-2: CENTRAL PROCESSING UNIT

(2) Explain the addressing mode of OR What do you mean by addressing mode? Explain diff. addressing mode for 8085 with examples.

8051 Overview and Instruction Set

SN8F5000 Family Instruction Set

3.0 Instruction Set. 3.1 Overview


Grundlagen Microcontroller Processor Core. Günther Gridling Bettina Weiss

8/26/2010. Introduction to 8085 BLOCK DIAGRAM OF INTEL Introduction to Introduction to Three Units of 8085

SOME ASSEMBLY REQUIRED

The von Neumann Architecture. IT 3123 Hardware and Software Concepts. The Instruction Cycle. Registers. LMC Executes a Store.

12-Dec-11. Gursharan Singh Maninder Kaur. Introduction to 8085 BLOCK DIAGRAM OF INTEL Introduction to Introduction to 8085

Address Modes effective address

Microcomputer Architecture and Programming

Reverse Engineering II: Basics. Gergely Erdélyi Senior Antivirus Researcher

CS401 - Computer Architecture and Assembly Language Programming Glossary By

COMPUTER ORGANIZATION & ARCHITECTURE

Instruction set of 8085

CHAPTER 5 : Introduction to Intel 8085 Microprocessor Hardware BENG 2223 MICROPROCESSOR TECHNOLOGY

Chapter. Computer Architecture

Operations On Data CHAPTER 4. (Solutions to Odd-Numbered Problems) Review Questions

COSC 6385 Computer Architecture. Defining Computer Architecture

Virtual Machine Tutorial

Math 230 Assembly Programming (AKA Computer Organization) Spring 2008

CS4617 Computer Architecture

CHAPTER 5 A Closer Look at Instruction Set Architectures

SCRAM Introduction. Philipp Koehn. 19 February 2018

We briefly explain an instruction cycle now, before proceeding with the details of addressing modes.

94 CPU (CM8051) Incompatible Instruction ERRATA AND DATASHEET CLARIFICATION V1.0. Leader of Microcontroller Technology A Fabless Semiconductor Company

COSC 6385 Computer Architecture - Instruction Set Principles

Reverse Engineering II: The Basics

The CS5600 micro-computer

SOEN228, Winter Revision 1.2 Date: October 25,

Chapter 3 Machine Instructions & Programs. Jin-Fu Li Department of Electrical Engineering National Central University Jungli, Taiwan

Lesson 2. Instruction set design

OSIAC Read OSIAC 5362 posted on the course website

reply db y prompt db Enter your favourite colour:, 0 colour db 80 dup(?) i db 20 k db? num dw 4000 large dd 50000

William Stallings Computer Organization and Architecture 8 th Edition. Chapter 10 Instruction Sets: Characteristics and Functions

Chapter 2. Instruction Set. RISC vs. CISC Instruction set. The University of Adelaide, School of Computer Science 18 September 2017

PESIT Bangalore South Campus

Memory organization Programming model - Program status word - register banks - Addressing modes - instruction set Programming examples.


Exam I Review February 2017

CPE 323 MSP430 INSTRUCTION SET ARCHITECTURE (ISA)

Accumulator and memory instructions 1. Loads, stores, and transfers 2. Arithmetic operations 3. Multiply and divide 4. Logical operations 5. Data test

CSc 453 Interpreters & Interpretation

8085 INSTRUCTION SET INSTRUCTION DETAILS

Full file at

Chapter 2. Instruction Set Principles and Examples. In-Cheol Park Dept. of EE, KAIST

Wednesday, September 13, Chapter 4

Computer Architecture

8088/8086 Programming Integer Instructions and Computations

Course Schedule. CS 221 Computer Architecture. Week 3: Plan. I. Hexadecimals and Character Representations. Hexadecimal Representation

COS 140: Foundations of Computer Science

CHAPTER 5 A Closer Look at Instruction Set Architectures

10-1 C D Pearson Education, Inc. M. Morris Mano & Charles R. Kime LOGIC AND COMPUTER DESIGN FUNDAMENTALS, 4e

ECE232: Hardware Organization and Design

Delhi Noida Bhopal Hyderabad Jaipur Lucknow Indore Pune Bhubaneswar Kolkata Patna Web: Ph:

Fig: Computer memory with Program, data, and Stack. Blog - NEC (Autonomous) 1

Chapter 7 Central Processor Unit (S08CPUV2)

Problem with Scanning an Infix Expression

Instruction Sets: Characteristics and Functions

Computer Architecture

Introduction to Microprocessor

Problem with Scanning an Infix Expression

Introduction to Computers - Chapter 4

Computer Architecture and Organization. Instruction Sets: Addressing Modes and Formats

Chapter 3. Z80 Instructions & Assembly Language. Von Neumann Architecture. Memory. instructions. program. data

Register-Level Design

Keeping pace with a single-chip I6-bit microprocessor

The Instruction Set. Chapter 5

INSTRUCTION SET OF 8085

Chapter 2 Instruction Set Architecture

Computer Architecture 1 ح 303

Chapter 1. Microprocessor architecture ECE Dr. Mohamed Mahmoud.

Transcription:

PACE figforth Implementation Adapting the figforth Glossary to a word-addressing computer David Kilbridge FORTH Day 2009 November 21, 2009

Review of implementation project Nine reference implementations All written to a common API specification, the figforth glossary which evolved during the project Published and released into the public domain at 1979 WCCF

Design issues How are data to be represented in memory? What is the connection between the Forth virtual machine and the actual hardware?

Data representation: obvious choices One stack cell per 16-bit word Stack pointers are native addresses Change by 1 to push or pop One dictionary field per 16-bit word Compiler stores one address per word Inner interpreter deals with native addresses

How to store text data? Two choices: One character per word Two characters packed into 1 word

One character per word Probably the best choice today Storage is cheap Allows i18n via UTF-16 encoding Each character gets a native address Possible issues with data exchange May have to unpack characters on input, pack on output

Two characters per word My choice at the time Most efficient use of expensive storage Unicode, ISO-8859 didn t exist Allowed (FIND) to compare 2 bytes at a time WORD aligns strings consistently with count in the MSB Used existing I/O subsystem transferring packed characters

Implications of packed characters Need a way to address each byte of a word Forced to add abstract addresses for bytes How does byte addressing work?

New conversion words BYTE addr --- baddr (= addr * 2) Returns address of most-significant byte of word (big-endian) Used ~ 15x in figforth nucleus CELL baddr --- addr (= baddr / 2) Returns address of word containing byte Used ~ 7x in figforth nucleus

Words that use byte addresses C@ C! CMOVE COUNT ENCLOSE EXPECT HLD @ (LINE) (NUMBER) TOGGLE TRAVERSE -TRAILING TYPE #>

Elaborations to Glossary, part 1 C@ baddr --- b C! b baddr --- CMOVE baddr1 baddr2 count --- COUNT addr1 --- baddr2 n ENCLOSE baddr1 c --- baddr1 n1 n2 n3 EXPECT baddr count --- HLD (contains a byte address)

Elaborations to Glossary, part 2 (LINE) n1 n2 --- baddr count (NUMBER) d1 baddr1 --- d2 baddr2 TOGGLE baddr b --- TRAVERSE baddr1 n --- baddr2 -TRAILING baddr n1 --- baddr n2 TYPE baddr count --- #> d --- baddr count

Word addresses used for: SP, RP, IP, W, UP, @,! DP and all dictionary fields TIB, PAD, disk buffers Most words in the figforth glossary

Objections to byte addressing Creates a 32K-word barrier in memory A problem we wished we had! No worse off than with a byte-addressed machine with 64K bytes of memory Schizophrenic API Have two distinct pointer types without strong-typing support from the language Forces programmer to remember which type of address to use where

PACE architecture Unit of addressing = 16-bit word All machine instructions are 1 word long - No inline addresses or extension words - All EAs are short offsets from a base or indirectly from there (LD, ST, JMP, JSR) Memory-mapped (and bit-banging) I/O 6-level priority interrupts

Programmer s model AC0 Program Counter AC1 Ten-Word LIFO Stack AC2 AC3 LINK CRY OVF

Typical memory reference instruction: OPCODE xr displacement Four pages directly addressable xr = 0: 0000 to 00FF (or FF80 to 007F) xr = 1: (PC) - 80 to (PC) + 7F xr = 2: (AC2) - 80 to (AC2) + 7F xr = 3: (AC3) - 80 to (AC3) + 7F

Capabilities of all registers flags, stack, other registers, memory Equality test with memory Add from memory Load immed., Complement, Add immed. Add w/wo carry, And, Xor other registers Shift and rotate

Special register capabilities AC0: Test =0, 0, 0, <0, and bits 0, 1, 2 Additional operations with memory operands: And, Or, Subtract w/borrow, Decimal add, Greater-than test, Mask test, Load byte Load and store Indirect AC2 and AC3: Serve as base or index registers

Forth register assignment AC0 Working accumulator Program Counter AC1 IP Ten-Word LIFO Stack Scratch AC2 W AC3 SP LINK CRY OVF RP, UP in memory page 0

Use internal stack as parameter or return stack? Only 10 words deep Only top word is accessible Not easily extended into memory Would need to enable and service stack full/empty interrupts Just use for register saving, JSRs and interrupts (if required by the installation)

SP, IP, W usage LIT:.WORD.+1 RCPY IP,X ; PICK UP LD 0,(X) ; VALUE AISZ IP,1 ; STEP IP OVER PUSH: AISZ SP,-1 ; EXTEND STACK PUT: ST 0,(SP) ; STORE VALUE NEXT: RCPY IP,X AISZ IP,1 ; INCREMENT IP LD W,(X) ; ADDR OF NEXT WORD JMP @(W) ; JUMP THRU CODE ADDR

RP usage TOR:.WORD.+1 DSZ RP ; EXTEND RETURN STACK LD 0,(SP) ; GET DATA ITEM ST 0,@RP ; PUT ON RETURN STACK JMP POP ; POP FROM DATA STACK FROMR:.WORD.+1 LD 0,@RP ; GET FROM RETURN STK ISZ RP ; POP RETURN STACK JMP PUSH ; PUSH ON DATA STACK R:.WORD.+1 LD 0,@RP ; GET NONDESTRUCTIVE JMP PUSH ; PUSH ON DATA STACK

Summary The PACE implementation split the figforth Glossary s concept of a single type of address into two: Most addresses in the Forth virtual machine are native word addresses, allowing efficient execution Byte addresses are used for packed text handling and compatibility with 8-bit algorithms