Lab 7: A Calculator Using Stack Memory

Slides:



Advertisements
Similar presentations
Chapter 2: Data Manipulation
Advertisements

Chapter 1. Basic Structure of Computers
Microprocessors.
Table 7.1 Verilog Operators.
Eng. Mohammed Timraz Electronics & Communication Engineer University of Palestine Faculty of Engineering and Urban planning Software Engineering Department.
Give qualifications of instructors: DAP
 Suppose for a moment that you were asked to perform a task and were given the following list of instructions to perform:
CS 151 Digital Systems Design Lecture 37 Register Transfer Level
Lab Assignment 2: MIPS single-cycle implementation
DATAPATHS 3) Shifters. 4) Comparators 5) Counters.
Aug. 24, 2007ELEC 5200/6200 Project1 Computer Design Project ELEC 5200/6200-Computer Architecture and Design Fall 2007 Vishwani D. Agrawal James J.Danaher.
Midterm Wednesday Chapter 1-3: Number /character representation and conversion Number arithmetic Combinational logic elements and design (DeMorgan’s Law)
Computer Organization. Motivation Computer Design as an application of digital logic design  Computer = Processing Unit + Memory System  Processing.
SAP1 (Simple-As-Possible) Computer
1 Catalog of useful (structural) modules and architectures In this course we will be working mostly at the BEHAVIORAL and STRUCTURAL levels. We will rely.
Chapter 5 Basic Processing Unit
Machine Instruction Characteristics
Instruction Set Architecture
Computer Science 210 Computer Organization The von Neumann Architecture.
Chapter 1 An Introduction to Processor Design 부산대학교 컴퓨터공학과.
Lecture 9. MIPS Processor Design – Instruction Fetch Prof. Taeweon Suh Computer Science Education Korea University 2010 R&E Computer System Education &
Ceng 450 Project. Pinout of Processor Interrupt is optional Processor in_port[7:0] out_port[7:0] clock rst interrupt.
Lab 8: A Calculator Using Stack Memory
Microprocessor Dr. Rabie A. Ramadan Al-Azhar University Lecture 7.
General Concepts of Computer Organization Overview of Microcomputer.
What is µP? “An integrated circuit containing … a central processing unit (CPU) and a means to access external memory” -- (Ball 2000)
Multiple-Cycle Hardwired Control Digital Logic Design Instructor: Kasım Sinan YILDIRIM.
Computer Organization CS224 Fall 2012 Lesson 22. The Big Picture  The Five Classic Components of a Computer  Chapter 4 Topic: Processor Design Control.
ECE 445 – Computer Organization
Computer Science 101 Computer Systems Organization ALU, Control Unit, Instruction Set.
Overview of Super-Harvard Architecture (SHARC) Daniel GlickDaniel Glick – May 15, 2002 for V (Dewar)
Lecture 2 Microprocessor Architecture Image from:
A summary of TOY. 4 Main Components Data Processor Control Processor Memory Input/Output Device.
Computer Organization CDA 3103 Dr. Hassan Foroosh Dept. of Computer Science UCF © Copyright Hassan Foroosh 2002.
1. Building A CPU  We’ve built a small ALU l Add, Subtract, SLT, And, Or l Could figure out Multiply and Divide  What about the rest l How do.
Instructor: Oluwayomi Adamo Digital Systems Design.
Digital Computer Concept and Practice Copyright ©2012 by Jaejin Lee Control Unit.
Computer Organization and Assembly Languages Yung-Yu Chuang 2005/09/29
CS61C L20 Datapath © UC Regents 1 Microprocessor James Tan Adapted from D. Patterson’s CS61C Copyright 2000.
MICROPROCESSOR DETAILS 1 Updated April 2011 ©Paul R. Godin prgodin gmail.com.
Microprocessor Fundamentals Week 2 Mount Druitt College of TAFE Dept. Electrical Engineering 2008.
Digital Computer Concept and Practice Copyright ©2012 by Jaejin Lee Control Unit.
Controller Implementation
Class Exercise 1B.
Catalog of useful (structural) modules and architectures
BLOCK DIAGRAM OF INTEL 8085.
SAP1 (Simple-As-Possible) Computer
Control & Execution Finite State Machines for Control MIPS Execution.
Computer Science 210 Computer Organization
Morgan Kaufmann Publishers
Prof. Sirer CS 316 Cornell University
Computer Organization and Design
Processor (I).
Simple Processor Control Unit
The fetch-execute cycle
The Processor and Machine Language
Instructor: Alexander Stoytchev
Control & Execution Finite State Machines for Control MIPS Execution.
Computer Science 210 Computer Organization
Instructor: Alexander Stoytchev
Instructor: Alexander Stoytchev
Morgan Kaufmann Publishers The Processor
Computer Organization
22 October 3 classes before 2nd exam! Control 1/16/2019
COMS 361 Computer Organization
Overview Last lecture Digital hardware systems Today
Prof. Sirer CS 316 Cornell University
Computer Organization and Assembly Languages Yung-Yu Chuang 2005/09/29
Basic components Instruction processing
Presentation transcript:

Lab 7: A Calculator Using Stack Memory A simple computer design example A control unit (FSM) Stack memory - dual-port RAM Design project (an example) use single port RAM modify the datapath a more complex control unit

Motivation Computer Design as an application of digital logic design procedure Computer = Processing Unit + Memory System Processing Unit = Control + Datapath Control = Finite State Machine Inputs = Machine Instruction, Datapath Conditions Outputs = Register Transfer Control Signals Instruction Interpretation = Instruction Fetch, Decode, Execute Datapath = Functional Units + Registers Functional Units = ALU, Multipliers, Dividers, etc. Registers = Program Counter, Shifters, Storage Registers

Structure of a Computer Instruction Types Data Manipulation Add, Subtract, etc. Data Staging Load/Store data to/from memory Register-to-register move Control Conditional/unconditional branches subroutine call and return

Instruction/data format A stack computer stack: a last-in-first-out queue operand registers: the top of the stack simple instruction encoding easy implementation Instruction/data format 9 bits bit 8 = 1 bit 7-0: operation code bit 8 = 0 bit 7-0: data (127~-127, two’s complement) postfix format 3, 5, 8, 6, - (3’H100), +, + (3’H101), EOF (3’H1FF)

Block Diagram and Basic Function Basic components dual-port RAM (stack) one port for instruction access; the other for stack operation IR, BREG, AREG, ALU Dual-port RAM stack inst. IR B A ALU

An example An example: 3, 5, 8, 6, -, +, + Dual-port RAM 3 B A ALU

Dual-port RAM - 6 8 ALU 3, 5 Dual-port RAM + 7 3 ALU 10 2 Dual-port EOF 10 x ALU Dual-port RAM + 2 5 ALU 3 x 7

The block diagram Stack pointer Dual-port RAM stack Program counter inst. IR B A mux mux ALU

Dual-port RAM 16 * 9 bits inputs outputs DI: data input WE: write_enable (active high) WCLK: synchronous RAM - positive-edge triggered A: primary port r/w address DPA: dual port read address outputs AO: primary port output DPO: dual port output primary port: stack access for data stack pointer: an up-down counter dual port: program access program counter: an up counter

Stack pointer 4-bit up down counter push/write operation address = stack pointer ++ pop/read operation address = -- stack_pointer 4-bit up down counter input: ACLR, CLK, CLK_EN, UP_DWN_ output: CNTI: stack pointer CNTO: stack pointer for push stack pointer - 1 for pop possible problems longer propagation delay -1 + RAM access

Data Flow

Operations Pipelining Execution Fetch Exec operation code data execute the operation if available, pop data from the stack to A register (a memory read) data if A register contains data, push to the stack (a memory write) if B register contains data, shift to A register shift the data in IR to B register a dual-port memory is required one for fetching one for execution

FSM for the Control Unit OPR Fetch, sh_AB ,push States S0 S1 one operand S2 two operands S3 >= two operands S4 >= three operands Error Halt Operations fetch shift push/pop execution

Controls Inputs Outputs RESET: power-on reset IR: instruction register STP: stack pointer Outputs AB_SEL: select the inputs for registers A and B 0/1= push/pop A_CLK_EN, B_CLK_EN Latch regs A andB EOF_ = ~(IR == 1FF) ERROR_: syntax error IR_CLK_EN: latch IR STP_up_dn_: 0/1 = pop/push STP_CLK_EN: real push/pop

Operations and Controls fetch: IR_CLK_EN shift: B_CLK_EN, (A_CLK_EN), !AB_SEL push: STK_UP_DN_, STK_CLK_EN pop: !STK_UP_DN_, STK_CLK_EN,A_CLK_EN execution: AB_SEL, B_CLK_EN halt: !HALT_

Final Design Check symbol info Add 7seg output to show result

Lab Download an example project Perform timing verification The control-unit is incomplete You can do timing verification Perform timing verification Answer a couple of questions Design the control-unit An FSM Implement the calculator on the demo board Display the result using the 7-seg LEDs

Dual Port RAM assign AO = q[A] ; assign DPO = q[DPA] ; always @(posedge WCLK or posedge RST) if (RST) begin q[0] = 9'h002 ; q[1] = 9'h003 ; q[2] = 9'h007 ; q[3] = 9'h002 ; q[4] = 9'h009 ; q[5] = 9'h100 ; q[6] = 9'h100 ; q[7] = 9'h101 ; q[8] = 9'h002 ; q[9] = 9'h008 ; q[10] = 9'h100 ; q[11] = 9'h100 ; q[12] = 9'h101 ; q[13] = 9'h1ff ; end else if (WE) q[A] = DI ;