Return Stack Lab 8.

Slides:



Advertisements
Similar presentations
1 Lecture 3: MIPS Instruction Set Today’s topic:  More MIPS instructions  Procedure call/return Reminder: Assignment 1 is on the class web-page (due.
Advertisements

1 Chapter 3 Jump, Loop, and Call Instructions. 2 Sections 3.1 Loop and Jump Instructions 3.2 Call Instructions 3.3 Time Delay Generation and Calculation.
CPS3340 COMPUTER ARCHITECTURE Fall Semester, /17/2013 Lecture 12: Procedures Instructor: Ashraf Yaseen DEPARTMENT OF MATH & COMPUTER SCIENCE CENTRAL.
TK 2633 Microprocessor & Interfacing
A Simple Microcontroller VHDL Tutorial R. E. Haskell and D. M. Hanna T6: VHDL State Machines.
LC-3 Computer LC-3 Instructions
Forth Lecture L7.1. A Brief History of Programming Languages
Data Stack Lecture 8.2 A VHDL Forth Core for FPGAs: Sect. 3.
Return Stack Lecture 8.4 A VHDL Forth Core for FPGAs: Sect. 5.
Programming Languages From FORTRAN to WHYP. A Brief History of Programming Languages
Multi-Base Calculator CSE378 Final Project By Matthew Lehn & Yanqing Zhu December 17, 2001 Professor Haskell.
Objective The object of the game is to convert as many hexadecimal numbers to binary coded decimal numbers correctly within thirty (30) seconds. How.
Lab 6 Program Counter and Program ROM Mano & Kime Sections 7-1 – 7-6.
Room: E-3-31 Phone: Dr Masri Ayob TK 2633 Microprocessor & Interfacing Lecture 1: Introduction to 8085 Assembly Language.
Chapter 5 The LC-3 LC-3 Computer Architecture Memory Map
The FC16 Forth Core Lab 7 Module F4.1. Lab 7 Hex OpcodeNameFunction 0000NOP No operation 0001DUP Duplicate T and push data stack. N
Chapter 9 & 10 Subroutines and Interrupts. JSR Instruction: JSR offset (11 bit) xxxxxxxxxxx [PC ]  R7, JMP Offset Jump to Subroutine at offset.
Return Stack Lecture L7.3. A 32 x 16 Stack Same as used in the Data Stack in Lab 7.
A Programming Language for the FC16 Forth Core
Programming Example Lecture 8.6 A VHDL Forth Core for FPGAs: Sect. 7.
8051 ASSEMBLY LANGUAGE PROGRAMMING
COMP3221: Microprocessors and Embedded Systems--Lecture 9 1 COMP3221: Microprocessors and Embedded Systems Lecture 9: Data Transfer Instructions
RS-232 Port Lecture L9.3. Loop feedback RS-232 voltage levels: +5.5 V (logic 0) -5.5 V (logic 1)
Data Stack Instructions Lab 7. Data Stack WHYP Data Stack Instructions DUP( n -- n n ) SWAP( a b -- b a ) DROP( a -- ) OVER( a b -- a b a ) ROT( a.
Design of Embedded Systems Using 68HC12(11) Microcontrollers - R. E. Haskell Subroutine and Stacks Chapter 2.
Other WC16 Instructions Lecture L7.4. OpcodeNameFunctionNumber of Clock Cycles Fetch the byte at address T in RAM and load it into T1 Fetch.
Module 10 Adapted By and Prepared James Tan © 2001.
CS-280 Dr. Mark L. Hornick 1 Calling subroutines in assembly And using the Stack.
Instruction Set Design by Kip R. Irvine (c) Kip Irvine, All rights reserved. You may modify and copy this slide show for your personal use,
Computer Architecture Lecture 13 – part 2 by Engineer A. Lecturer Aymen Hasan AlAwady 7/4/2014 University of Kufa - Information Technology Research and.
Microprocessor Dr. Rabie A. Ramadan Al-Azhar University Lecture 7.
The 8051 Assembly Language Branching & Subroutines
Today’s Lecture Unconditional branch instruction
ELE22MIC Lecture 8 ASll Examples –16 Bit Counters –Buffalo Jump Table Interrupt processing (IRQ/RTI) Stack Frame & Base Pointer Wired OR.
Lecture Set 4 Programming the 8051.
Stacks & Subroutines Content. Stacks A stack is a Last In First Out (LIFO) buffer containing a number of data items usually implemented as a block of.
JUMP, LOOP, AND CALL INSTRUCTIONS
ICS51 Introductory Computer Organization Accessing parameters from the stack and calling functions.
F453 Module 8: Low Level Languages 8.2: Features of Low-Level Languages.
Computer Science 210 Computer Organization Machine Language Instructions: Control.
Unit 1 Instruction set M.Brindha AP/EIE
Computer Science 210 Computer Organization
Classification of Instruction Set of 8051
Microprocessor T. Y. B. Sc..
The Stack.
3.Instruction Set of 8085 Consists of 74 operation codes, e.g. MOV
Subroutines and the Stack
Microprocessor and Assembly Language
TAO1221 COMPUTER ARCHITECTURE AND ORGANIZATION LAB 3 & 4 Part 2
Computer Architecture and Organization Miles Murdocca and Vincent Heuring Chapter 4 – The Instruction Set Architecture.
Microcomputer Programming
CS 301 Fall 2002 Control Structures
Stack and Subroutines Module M17.1 Section 11.2.
Fast, Asynchronous SRAM
Branching Instructions
Computer Science 210 Computer Organization
Computer Science 210 Computer Organization
Machine-Level Programming V: Control: loops Comp 21000: Introduction to Computer Organization & Systems Systems book chapter 3* * Modified slides from.
Subroutines and the Stack
Processor Organization and Architecture
The University of Adelaide, School of Computer Science
Figure 8.1 of course package
Chapter 6 - Procedures and Macros
EE6502/MPMC/UNIT II/STACK AND SUBROUTINE/T.THARANKUMAR
DIO2 Board Projects.
Subroutines and the Stack
COMP3221: Microprocessors and Embedded Systems
Some Assembly (Part 2) set.html.
Machine-Level Programming V: Control: loops Comp 21000: Introduction to Computer Organization & Systems Systems book chapter 3* * Modified slides from.
Computer Organization
Presentation transcript:

Return Stack Lab 8

A 32 x 16 Stack Same as used in the Data Stack in Lab 7

A 32 x 16 Stack Module

The Return Stack

The WC16C WHYP Core

Return Stack and I/O Instructions Code Name Function 0030 >R “To-R” Pop T and push it on return stack. 0031 R> “R-from” Pop return stack R and push it into T. 0032 R@ “R-fetch” Copy R to T and push register stack 0033 R>DROP “R-from-drop” Pop return stack R and throw it away 0039 LD! “LD store” Store 8-bits of T into the 8-bit LD register

>R when tor => tload <= '1'; nload <= '1'; tsel <= "111"; nsel <= "01"; dpop <= '1'; rload <= '1'; rpush <= '1'; rinsel <= '1'; >R “To-R” Pop T and push it on return stack.

R> when rfrom => tload <= '1'; nload <= '1'; tsel <= "011"; dpush <= '1'; rsel <= '1'; rload <= '1'; rpop <= '1'; R> “R-from” Pop return stack R and push it into T.

R@ when rfetch => tload <= '1'; nload <= '1'; tsel <= "011"; dpush <= '1'; “R-fetch” Copy R to T and push register stack

R>DROP when rfromdrop => rsel <= '1'; rload <= '1'; rpop <= '1'; “R-from-drop” Pop return stack R and throw it away

Return Stack and I/O Instructions Code Name Function 0030 >R “To-R” Pop T and push it on return stack. 0031 R> “R-from” Pop return stack R and push it into T. 0032 R@ “R-fetch” Copy R to T and push register stack 0033 R>DROP “R-from-drop” Pop return stack R and throw it away 0039 LD! “LD store” Store 8-bits of T into the 8-bit LD register

LD! “LD store” Store 8-bits of T into the 8-bit LD register and pop data stack when ldstore => ldload <= '1'; tload <= '1'; nload <= '1'; tsel <= "111"; nsel <= "01"; dpop <= '1'; LD!

Transfer Instructions Code Name Function 0103 DRJNE Decrement R and jump if R is not zero 0104 CALL Call subroutine 0105 RET Subroutine return

FOR…NEXT Loop n FOR <WHYP statements> NEXT >R drjne <WHYP statements> Decrement top of return stack and branch back to <WHYP statements> if not equal to zero. Therefore, <WHYP statements> are executed n times.

DRJNE Decrement R and jump if R is not zero -- r1 <= '1' if R-1 is all zeros r1 := '0'; for i in width-1 downto 1 loop r1 := r1 or R(i); end loop; r1 := (not r1) and R(0); when drjne => rdec <= not r1; pload <= not r1; psel <= '0'; pinc <= r1; rsel <= r1; rload <= r1; rpop <= r1;

The Return Stack

CALL Call subroutine Jump to address M and push address of next instruction (P + 1) on return stack when call => pload <= '1'; rload <= '1'; rpush <= '1';

RET Subroutine return Jump to address on top of the return stack, and pop the return stack when ret => psel <= '1'; pload <= '1'; rsel <= '1'; rload <= '1'; rpop <= '1';

\ led8.whp HEX   : 1ms_Delay ( -- ) 30D1 FOR NEXT ; : .5sec_Delay ( -- ) 1F4 FOR 1ms_Delay NEXT ; : MAIN ( -- ) BEGIN 8000 8 FOR DUP LD! DUP DIG! .5sec_Delay 2/ NEXT U2/ DROP AGAIN ;

ROM Listing constant rom: rom_array := ( JMP, --0 X"0010", --1 LIT, --2 X"30D1", --3 tor, --4 drjne, --5 X"0005", --6 RET, --7 LIT, --8 X"03E8", --9 tor, --a CALL, --b X"0002", --c drjne, --d X"000b", --e RET, --f LIT, --10 X"8000", --11 LIT, --12 X"0008", --13 tor, --14 ROM Listing HEX   : 1ms_Delay ( -- ) 30D1 FOR NEXT ; : .5sec_Delay ( -- ) 1F4 FOR 1ms_Delay NEXT ; : MAIN ( -- ) BEGIN 8000 8 FOR