An Overview of Stack Architecture and the PSC 1000 Microprocessor



Similar documents
MICROPROCESSOR. Exclusive for IACE Students iacehyd.blogspot.in Ph: /422 Page 1

Advanced Computer Architecture-CS501. Computer Systems Design and Architecture 2.1, 2.2, 3.2

MACHINE ARCHITECTURE & LANGUAGE

MICROPROCESSOR AND MICROCOMPUTER BASICS

İSTANBUL AYDIN UNIVERSITY

CPU Organization and Assembly Language

Central Processing Unit (CPU)

PART B QUESTIONS AND ANSWERS UNIT I

Microprocessor & Assembly Language

Overview. CISC Developments. RISC Designs. CISC Designs. VAX: Addressing Modes. Digital VAX

Chapter 2 Logic Gates and Introduction to Computer Architecture

picojava TM : A Hardware Implementation of the Java Virtual Machine

CPU Organisation and Operation

Instruction Set Architecture

CHAPTER 7: The CPU and Memory

ARM Microprocessor and ARM-Based Microcontrollers

LSN 2 Computer Processors

ADVANCED PROCESSOR ARCHITECTURES AND MEMORY ORGANISATION Lesson-12: ARM

(Refer Slide Time: 00:01:16 min)

Instruction Set Design

1 The Java Virtual Machine

Instruction Set Architecture (ISA)

Instruction Set Architecture. or How to talk to computers if you aren t in Star Trek

An Introduction to the ARM 7 Architecture

PROBLEMS (Cap. 4 - Istruzioni macchina)

Z80 Microprocessors Z80 CPU. User Manual UM Copyright 2014 Zilog, Inc. All rights reserved.

How It All Works. Other M68000 Updates. Basic Control Signals. Basic Control Signals

Levels of Programming Languages. Gerald Penn CSC 324

8-Bit Flash Microcontroller for Smart Cards. AT89SCXXXXA Summary. Features. Description. Complete datasheet available under NDA

The Java Virtual Machine and Mobile Devices. John Buford, Ph.D. Oct 2003 Presented to Gordon College CS 311

a storage location directly on the CPU, used for temporary storage of small amounts of data during processing.

Computer Architectures

Computer Architecture Lecture 2: Instruction Set Principles (Appendix A) Chih Wei Liu 劉 志 尉 National Chiao Tung University

Chapter 11: Input/Output Organisation. Lesson 06: Programmed IO

CHAPTER 4 MARIE: An Introduction to a Simple Computer

ASSEMBLY PROGRAMMING ON A VIRTUAL COMPUTER

CS101 Lecture 26: Low Level Programming. John Magee 30 July 2013 Some material copyright Jones and Bartlett. Overview/Questions

Administrative Issues

GUJARAT TECHNOLOGICAL UNIVERSITY, AHMEDABAD, GUJARAT. COURSE CURRICULUM COURSE TITLE: COMPUTER ORGANIZATION AND ARCHITECTURE (Code: )

Chapter 5 Instructor's Manual

BASIC COMPUTER ORGANIZATION AND DESIGN

Chapter 5, The Instruction Set Architecture Level

Computer System: User s View. Computer System Components: High Level View. Input. Output. Computer. Computer System: Motherboard Level

Let s put together a Manual Processor

Intel 8086 architecture

Chapter 7D The Java Virtual Machine

Microcontroller Basics A microcontroller is a small, low-cost computer-on-a-chip which usually includes:

(Refer Slide Time: 02:39)

Computer Organization and Architecture

Module 2. Embedded Processors and Memory. Version 2 EE IIT, Kharagpur 1

MACHINE INSTRUCTIONS AND PROGRAMS

Processor Architectures

what operations can it perform? how does it perform them? on what kind of data? where are instructions and data stored?

MICROPROCESSOR BCA IV Sem MULTIPLE CHOICE QUESTIONS

1 Classical Universal Computer 3

Chapter 4 Lecture 5 The Microarchitecture Level Integer JAVA Virtual Machine

Chapter 11 I/O Management and Disk Scheduling

DATA ITEM DESCRIPTION

A3 Computer Architecture

Chapter 01: Introduction. Lesson 02 Evolution of Computers Part 2 First generation Computers

UNIVERSITY OF CALIFORNIA, DAVIS Department of Electrical and Computer Engineering. EEC180B Lab 7: MISP Processor Design Spring 1995

Chapter 2 Basic Structure of Computers. Jin-Fu Li Department of Electrical Engineering National Central University Jungli, Taiwan

l C-Programming l A real computer language l Data Representation l Everything goes down to bits and bytes l Machine representation Language

A s we saw in Chapter 4, a CPU contains three main sections: the register section,

PROGRAMMING CONCEPTS AND EMBEDDED PROGRAMMING IN C, C++ and JAVA: Lesson-4: Data Structures: Stacks

Week 1 out-of-class notes, discussions and sample problems

Computer Architecture Lecture 3: ISA Tradeoffs. Prof. Onur Mutlu Carnegie Mellon University Spring 2013, 1/18/2013

CHAPTER 6: Computer System Organisation 1. The Computer System's Primary Functions

Hardware/Software Co-Design of a Java Virtual Machine

ARM Architecture. ARM history. Why ARM? ARM Ltd developed by Acorn computers. Computer Organization and Assembly Languages Yung-Yu Chuang

The AVR Microcontroller and C Compiler Co-Design Dr. Gaute Myklebust ATMEL Corporation ATMEL Development Center, Trondheim, Norway

Addressing The problem. When & Where do we encounter Data? The concept of addressing data' in computations. The implications for our machine design(s)

Modbus RTU Communications RX/WX and MRX/MWX

Introduction to RISC Processor. ni logic Pvt. Ltd., Pune

Instruction Set Architecture. Datapath & Control. Instruction. LC-3 Overview: Memory and Registers. CIT 595 Spring 2010

Stack machines The MIPS assembly language A simple source language Stack-machine implementation of the simple language Readings:

612 CHAPTER 11 PROCESSOR FAMILIES (Corrisponde al cap Famiglie di processori) PROBLEMS

Z80 Family. CPU User Manual

CS:APP Chapter 4 Computer Architecture. Wrap-Up. William J. Taffe Plymouth State University. using the slides of

Instruction Set Architecture

Microtronics technologies Mobile:

VLIW Processors. VLIW Processors

Chapter 2 Topics. 2.1 Classification of Computers & Instructions 2.2 Classes of Instruction Sets 2.3 Informal Description of Simple RISC Computer, SRC

Management Challenge. Managing Hardware Assets. Central Processing Unit. What is a Computer System?

Lecture N -1- PHYS Microcontrollers

Topics. Introduction. Java History CS 146. Introduction to Programming and Algorithms Module 1. Module Objectives

================================================================

Computer Architecture

UNIT 2 CLASSIFICATION OF PARALLEL COMPUTERS

Introduction to Microcontrollers

COMPUTER ORGANIZATION AND ARCHITECTURE. Slides Courtesy of Carl Hamacher, Computer Organization, Fifth edition,mcgrawhill

Microprocessor and Microcontroller Architecture

Chapter 4 Register Transfer and Microoperations. Section 4.1 Register Transfer Language

Summary of the MARIE Assembly Language

Systems I: Computer Organization and Architecture

1 Computer hardware. Peripheral Bus device "B" Peripheral device. controller. Memory. Central Processing Unit (CPU)

Computer organization

OVERVIEW OF MICROPROCESSORS

Updating the Forth Virtual Machine EuroForth 2008

Learning Outcomes. Simple CPU Operation and Buses. Composition of a CPU. A simple CPU design

Transcription:

An Overview of Stack Architecture and the PSC 1000 Microprocessor

Introduction A stack is an important data handling structure used in computing. Specifically, a stack is a dynamic set of elements in which access to the stack elements is pre-specified. This pre-specified manner of access is a last-in, first-out, or LIFO policy. Conceptually, LIFO stacks are the easiest way to meet the temporary storage requirements for important computer tasks (Koopman 1989). To illustrate, some computer architectures may implement an expression evaluation stack that is used to save the intermediate values of arithmetic and logic expressions and to keep track of the levels precedence. Another implementation is a return address stack that is used to save the address of a calling program whenever a subroutine is called. A local variable stack allows each instance of a subroutine to store its local variables on the stack in order to avoid corruption by another instance of the same subroutine in cases of recursion or reentrancy. Finally, a parameter stack is a used to pass parameters when a subroutine is called. Each of these stack implementations does not usually individually exist in real computers, but are combined using both hardware and software in a manner specific to each architecture. To conclude, any application that incorporates many stack features, like the Java Virtual Machine, will benefit in efficiency and speed from computer with hardware support for stacks (Shaw 1997). Dimensions of a Stack Computer Most computer architectures implement some level of hardware support for stack(s). There are many different methods to implement hardware stack support, thus creating several different classes of stack computer architectures. These classes can be categorized using a three-dimensional design space (Koopman 1989). See Figure 1. Figure 1: Stack Computer Design Space (Koopman 1989)

The three dimensions include the number of stacks supported by the hardware (single or multiple), the size of any dedicated buffer for stack elements (small or large), and the number of operands permitted by the instruction format (0, 1, or 2). The number of stacks supported in a computer s architecture is one of the dimensions in the design of a stack computer. A single-stack computer supports only one stack, which is simpler, with concern for the hardware, and easier for an operating system to manage. On the contrary, multiple-stack computers support two or more stacks. Unlike the single-stack architecture, the multiple stack architecture allows for the separation of control flow information and data. Consequently, multiple stacks afford the computer speed because subroutine calls and data operations can occur simultaneously, if the return address stack and data stack are separate (Koopman 1989). The amount of memory used to buffer stack elements is another important dimension in designing a stack computer. In general, computers that use program memory for the stack buffer are considered to have the small stack buffer architecture. Large stack buffer computers possess a stack buffer that does not use the main memory. A large stack buffer has many different implementations, such as a memory unit separate from main memory. A large stack buffer is usually advantageous because program memory cycles are not consumed to access the stack (Koopman 1989). Figure 2: Categories of Stack Computers (Koopman 1989) The number of operands in the instruction format is the last dimension in the design of a stack computer. 0-operand instructions do not allow any operands. All operations use the top stack elements. Computers that use this type of instruction format are also known as pure stack machines. 1-operand instructions use one specified operand and use the top

stack elements for the second operand. 2-operand instructions allow two or three operands, for example a source and a destination, to be specified. Figure 2 categorizes several computers with respect to three dimensions of the stack computer design space. The first letter in the category abbreviation stands for the number of stacks (Single or Multiple), the second letter stands for the size of the stack buffer (Small or Large), and the final digit represents the number of operands in an instruction (0, 1, or 2). As the figure shows most computers, including the mainstream Intel 80x86, can be classified in the stack computer design space. The PSC 1000 Microprocessor The Patriot Scientific Corp. PSC 1000 microprocessor is a highly integrated 32-bit processor designed specifically for embedded applications where power consumption and cost are the important factors (Shaw 1999). Furthermore, the PSC 1000 is one of the first Java like CPUs. The Java Virtual Machine maps very closely onto its architecture, because both are stack architectures (Shaw 1997). Also, many other languages, like C and C++, can also be run efficiently using the PSC 1000, because their compilers implement a stack model. Figure 3: PSC 1000 Block Diagram (Shaw 1999)

The PSC 100 Central Processing Unit (CPU) has dual-processor architecture: the multiprocessing unit (MPU) and the virtual processing unit (VPU). The MPU is a 0- operand dual-stack processor that performs conventional processing tasks, while the VPU is an input-output processor that performs time-synchronous data transfers and may emulate dedicated peripheral functions (Shaw 1996). The CPU also contains global registers, a direct memory access controller (DMAC), an interrupt controller (INTC), on chip resources, bit inputs, bit outputs, a programmable memory interface (MIF), and a clock as seen in Figure 3. Since the MPU is the stack based processor it will be the emphasis of discussion. Micro-processing Unit The MPU is a ML0 stack processor. It was designed under the architectural philosophy of simplification and efficiency. By implementing a 0-operand architecture the MPU is able to achieve a high instruction bandwidth due to its 8-bit instructions. Since the MPU is a 32-bit processor, four instructions, referred to as instruction groups, may be fetched per memory cycle. The instructions are also hardwired into the MPU, adding more efficiency. As a result most instructions can execute in a single clock cycle. Consequently the PSC 1000 MPU is able to achieve twice the instruction bandwidth of most common RISC processors from the advantages gained from its hardware stacks and small sized instruction set (Shaw 1999). I. Registers/Stacks The register set of the MPU has 52 general-purpose registers, including 16 global registers (g0-g15), a 16-deep local-register/return stack (r0-r15), an 18-deep operand stack (s0-s15), an index register (x), and a count register (ct). There is also a mode/status register (mode), two stack pointers (sa and la), and 41 on-chip resource registers used for I/O, configuration, and status. See Figure 4. Figure 4: MPU Registers (Shaw 1999)

The local-register/return stack is used to hold subroutine return addresses and well-nested local variables. The operand stack is used to for expression evaluation and for parameter passing. The registers on both stacks are referenced relative to the top of the stack. For example, when a value is pushed onto the operand stack the former data element in s0 is pushed down to s1 and the new element is now in s0. An unlimited number of values can be stored on either stack because as the available register space fills registers are spilled into memory. Similarly, as the stack registers begin to empty they are refilled from memory. II. ALU and Instruction Set (Appendix A) All ALU opcodes are 8-bit encoded instructions. Since the MPU is a 0-operand stack processor no bits are needed to specify the source and destination operands. Instead the operands are assumed to be the top elements in the operand stack. For example the add instruction would add the elements in s0 and s1 and place the result into s0. See Figure 5. Not all ALU instruction behave like the add instruction, which used two source operands from the operand stack and returned one result to the operand stack. Some instructions only use one source operand and return only one result operand, like the increment and decrement instruction. Figure 5: Example of the add instruction (Shaw 1999) The one problem with 8-bit opcodes is that there are no bits to encode branch offsets and literal values for immediate arithmetic instructions. First, in order to maintain the consistency and simplicity of 8-bit opcodes branch offsets are taken as the last three bits of a branch, loop, or skip opcode plus all the bits to the right of the opcode in the current instruction group (4 opcodes). Figure 6: Memory Addressing (Shaw 1999)

Thus, depending upon the location of a branch within an instruction group the offset can be a 3, 11, 19, or 27 bit two s complement value. The offset value is then added to the program counter (pc) and execution transfers to the resulting cell-aligned addresses. Cells are four byte blocks of memory. Most instruction address memory by cells. Furthermore, the cells of memory have a big-endian byte order, meaning that the high order byte is at the byte address within the cell. See Figure 6. As for literals there are three sizes, nibble, byte, and long. A nibble is taken as the two s complement value of the four least significant bits of the push.n opcode. The data for byte literals is encoded in the right-most bit of an instruction group containing the push.b instruction. Finally, a long or cell sized literal is taken as the two s complement value of the entire instruction group following an instruction group that contains the push.l instruction. See Figure 7. Figure 7: Instruction Formats (Shaw 1999) For load and store instructions the r0, x, or s0 registers are used as index registers. The adda, or add address instruction can also be used to implement an address index. Figure 8 shows a code example that will add a value from memory and a nibble sized literal, and then stores it in memory. The address index will be derived from the values in two global registers (g0 and g2) and a byte sized literal using the add address instruction. The result from the add address operation is in the top of the operand stack,

s0, and will be used an index to load a value from memory into s0. After the value from memory is added to the nibble it is then stored at another address in memory again derived using the add address instruction. Figure 8: Load and Store Code Example (Shaw 1999) Conclusion It is unlikely that stack processors will ever find a home in personal computer and workstations. Their 0-operand addressing makes them less flexible than more common processors used in personal computers. The simplicity and low cost of most stack chips and their efficiency with handling stack-modeled applications, such as the Java Virtual Machine, will make embedded systems, like Web TV control boxes, the primary domain of the stack computer.

Appendix A: PSC 1000 Instruction Set (Shaw 1999)

References 1. Koopman, Philip J. Jr (1989). Stack Computers: the new wave. Computers and their Applications. West Sussex: Ellis Horwood Limited, 1989. 2. Shaw, George William (1999). PSC 1000 Microprocessor Reference Manual. Patriot Scientific Corp., 1999. http://www.ptsc.com/psc1000/documentation.html (29 Oct. 1999). 3. Shaw, George William (1996). Second Processor Takes Care of I/O. EETimes Techweb News. February 5, 1996. http://www.ptsc.com/psc1000/articles.html (29 Oct. 1999). 4. Shaw, George William (1997). Architecture is key to execution in java.. EETimes Techweb News. June 16, 1997. http://www.ptsc.com/psc1000/articles.html (29 Oct. 1999).