CSE 141L Computer Architecture Lab Fall 2003. Lecture 2



Similar documents
The 104 Duke_ACC Machine

MICROPROCESSOR AND MICROCOMPUTER BASICS

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

MACHINE ARCHITECTURE & LANGUAGE

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

Microprocessor & Assembly Language

Summary of the MARIE Assembly Language

Fall 2006 CS/ECE 333 Lab 1 Programming in SRC Assembly

The WIMP51: A Simple Processor and Visualization Tool to Introduce Undergraduates to Computer Organization

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

Computer organization

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

Building a computer. Electronic Numerical Integrator and Computer (ENIAC)

Central Processing Unit (CPU)

EE361: Digital Computer Organization Course Syllabus

Generating MIF files

AC : A PROCESSOR DESIGN PROJECT FOR A FIRST COURSE IN COMPUTER ORGANIZATION

Chapter 2 Logic Gates and Introduction to Computer Architecture

COMP 303 MIPS Processor Design Project 4: MIPS Processor Due Date: 11 December :59

Let s put together a Manual Processor

Notes on Assembly Language

Administrative Issues

PART B QUESTIONS AND ANSWERS UNIT I

CPU Organisation and Operation

Introducción. Diseño de sistemas digitales.1

CHAPTER 4 MARIE: An Introduction to a Simple Computer

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

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

1 Classical Universal Computer 3

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

Levels of Programming Languages. Gerald Penn CSC 324

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

Jianjian Song LogicWorks 4 Tutorials (5/15/03) Page 1 of 14

Q. Consider a dynamic instruction execution (an execution trace, in other words) that consists of repeats of code in this pattern:

High level code and machine code

Chapter 5 Instructor's Manual

CPU Organization and Assembly Language

A SystemC Transaction Level Model for the MIPS R3000 Processor

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

ASSEMBLY PROGRAMMING ON A VIRTUAL COMPUTER

The Advanced JTAG Bridge. Nathan Yawn 05/12/09

Figure 1: Graphical example of a mergesort 1.

An Introduction to MPLAB Integrated Development Environment

Digitale Signalverarbeitung mit FPGA (DSF) Soft Core Prozessor NIOS II Stand Mai Jens Onno Krah

LSN 2 Computer Processors

1 Description of The Simpletron

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

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

TEACHING COMPUTER ARCHITECTURE THROUGH SIMULATION (A BRIEF EVALUATION OF CPU SIMULATORS) *

1/20/2016 INTRODUCTION

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

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

UT69R000 MicroController Software Tools Product Brief

Digital Fundamentals. Lab 8 Asynchronous Counter Applications

Central Processing Unit Simulation Version v2.5 (July 2005) Charles André University Nice-Sophia Antipolis

Solution: start more than one instruction in the same clock cycle CPI < 1 (or IPC > 1, Instructions per Cycle) Two approaches:

PROGRAMMABLE LOGIC CONTROLLERS Unit code: A/601/1625 QCF level: 4 Credit value: 15 OUTCOME 3 PART 1

An Overview of Stack Architecture and the PSC 1000 Microprocessor

16-bit ALU, Register File and Memory Write Interface

Comp 255Q - 1M: Computer Organization Lab #3 - Machine Language Programs for the PDP-8

PCB Project (*.PrjPcb)

Programming Logic controllers

CS61: Systems Programing and Machine Organization

Instruction Set Architecture (ISA)

Systems I: Computer Organization and Architecture

8051 MICROCONTROLLER COURSE

Chapter 9 Computer Design Basics!

Here is a diagram of a simple computer system: (this diagram will be the one needed for exams) CPU. cache

isppac-powr1220at8 I 2 C Hardware Verification Utility User s Guide

picojava TM : A Hardware Implementation of the Java Virtual Machine

Graded ARM assembly language Examples

BASIC COMPUTER ORGANIZATION AND DESIGN

LC-3 Assembly Language

Two's Complement Adder/Subtractor Lab L03

02 B The Java Virtual Machine

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

(Refer Slide Time: 02:39)

PROBLEMS #20,R0,R1 #$3A,R2,R4

Embedded Systems. Review of ANSI C Topics. A Review of ANSI C and Considerations for Embedded C Programming. Basic features of C

İSTANBUL AYDIN UNIVERSITY

SIM-PL: Software for teaching computer hardware at secondary schools in the Netherlands

Chapter 7 Assembly Language

Digital Signal Controller (DSC) Development Tools

Parts of a Computer. Preparation. Objectives. Standards. Materials Micron Technology Foundation, Inc. All Rights Reserved

Soft processors for microcontroller programming education

Outline. hardware components programming environments. installing Python executing Python code. decimal and binary notations running Sage

Real-time Debugging using GDB Tracepoints and other Eclipse features

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

VLIW Processors. VLIW Processors

THREE YEAR DEGREE (HONS.) COURSE BACHELOR OF COMPUTER APPLICATION (BCA) First Year Paper I Computer Fundamentals

Design of Digital Circuits (SS16)

Instruction Set Design

DsPIC HOW-TO GUIDE Creating & Debugging a Project in MPLAB

CSC 2405: Computer Systems II

Pipeline Hazards. Structure hazard Data hazard. ComputerArchitecture_PipelineHazard1

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

Decimal Number (base 10) Binary Number (base 2)

OAMulator. Online One Address Machine emulator and OAMPL compiler.

Transcription:

CSE 141L Computer Architecture Lab Fall 2003 Lecture 2 Pramod V. Argade CSE141L: Computer Architecture Lab Instructor: TA: Readers: Pramod V. Argade (p2argade@cs.ucsd.edu) Office Hour: Tue./Thu. 9:30-10:30 AM (AP&M 4121) Kyle Downey (kdowney@cs.ucsd.edu) Office hour: Tuesday/Thursday 1 3 PM AP&M 2444 Dianne Shaw (dshaw@ucsd.edu) Office hour: Monday 12 2 PM AP&M 2444 Nam Nguyen (n28guye@ucsd.edu) Office hour: Friday 1-3 PM AP&M 2444 Lecture: Friday 8-8:50 AM, Center 119 Reference Book: LogicWorks4, Capilano Computing Systems, Available in Bookstore Web-page: http://www-cse.ucsd.edu/classes/fa03/cse141l Slide 2-2 1

Course Schedule Lecture # Date Topic 1 Sep. 26 No class 2 Oct. 3 Lab1: 8-bit Processor ISA 3 Oct. 10 Lab1 Discussion 4 Oct. 17 Lab2: Assembler, ISS 5 Oct. 24 LogicWorks 4 Overview 6 Oct. 31 Lab3: Data Path 7 Nov. 7 Lab3 Discussion 8 Nov. 14 Lab4: Full CPU 9 Nov. 21 Lab4 Discussion 10 Nov. 28 Thanksgiving Holiday 11 Dec. 5 Project testing during week 12 Dec. 12 No Class Slide 2-3 Lab 2 Due: Lab Due Dates Before 8:00 AM Friday, October 31 st No late submissions! I plan to disclose a range of clock cycles from your Lab 2 reports (no names) Slide 2-4 2

Microprocessor Design Steps Design Instruction Set Architecture (ISA) Code applications Develop software generation tools Develop instruction set simulator (ISS) Design datapath, verify it Design the Processor, simulate logic Verify the processor Fabricate the chip Slide 2-5 Develop Assembler for your ISS Converts assembly file to hex code Language choice for assembler: C, C++, Java or Perl Command line: assembler i mean.s o mean.dis Output generated: mean.dis (annotated with hex code) mean.imi (memory image in hex) Slide 2-6 3

Assembler Code Process command line options Open input file and output files Parse each line Gather fields: label, instruction mnemonic, Detect errors and report them Assemble instruction Generate output to.dis Generate output to.imi Close files Slide 2-7 Assembler Input and Output Input // mean.s // r0 used to index array... 000 start: mov r3, $0 // r3 = 0, has address of a[ 0 ] 001 ld r0, *r3 // r0 points to a[ 0 ] 002 mov r2, $0 // r2 = sum_low = 0 Output // mean.dis // r0 used to index array... 0x0c 000 start: mov r3, $0 // r3 = 0, has address of a[ 0 ] 0xe3 001 ld r0, *r3 // r0 points to a[ 0 ] 0x08 002 mov r2, $0 // r2 = sum_low = 0 Slide 2-8 4

Are your 3 programs functionally correct? Slide 2-9 General Architecture Challenges ISA What is the performance? How to find it out for huge programs? How to optimize the ISA? How to test what if scenarios? Design How to verify the design? What is the golden reference for behavior? Slide 2-10 5

Answer: Instruction Set Simulator (ISS) Slide 2-11 What is an ISS? Software model of your processor Runs on a PC or workstation Is aware of: Processor s internal resources ISA Size and characteristics of I-Mem & D-Mem Provides Run-time statistics Debug capabilities Slide 2-12 6

Input: What does an ISS do? Instruction and data memory image Output: Instruction trace Run-time statistics Number of instructions executed Utilization of resources and instructions... Slide 2-13 What is a Reset? What happens on PC when you hit Power button (cold boot) Does extensive Power On Self Test (POST) Reset button (warm boot) Reset is a special pin on a processor Processor and hardware is initialized to a known state PC set to a known value Internal registers set to a known value Instruction execution starts Slide 2-14 7

Structure of ISS Written in C++ or Java (C is ok too) Define a class (say, Proc) Members are resources of the processor PC, register file, I-Mem, D-Mem, Slide 2-15 Methods in ISS loadimem(): loads instruction memory image Reads hex machine code from a text file loaddmem(): loads data memory image Reads hex data from a text file reset(): reset the processor Initialize internal state of the processor Set PC = 0 and start execution Slide 2-16 8

Methods in ISS: Runloop() Executes instructions May take an argument Number of instructions to execute Enables single stepping Generates instruction trace Disassembles instruction Prints results and other side effects Slide 2-17 Components of Runloop() Fetch: Read instruction from I-Memat location pointed to by PC Decode: Analyze instruction Find opcode and other fields, such as, register(s), immediate data, branch offset, etc. Note destination for the result Read operand(s) from register(s) (if any) Slide 2-18 9

Components of Runloop() Execute: Fetch operand(s) from register(s) Do ALU operation Read D-Mem Select result: either ALU output or data read from D-Mem Resolve whether a branch is taken or not Slide 2-19 Components of Runloop() Memory/Register Writeback Write result to register/d-mem Set next PC If instruction is not a control transfer instruction, or branch is not taken PC = PC +1 Else PC = target of the branch Slide 2-20 10

Components of Runloop() Generate instruction trace Disassemble instruction Print instruction side effects Stop execution if HALT instruction Else continue with the next instruction Slide 2-21 Example Instruction Trace 0x5d 009: ADD R3, $0x1 { Result = 0x 3 } 0xfb 010: ST R2, *R3 { Addr = 0x3, Result = 0x15 } 0x18 011: MOV R2, $0x4 0x65 012: SUB R1, $0x { Result = 0x 6 } 0x74 013: CMPEQ R1, $0x0 { Flag = 0 } 0x33 014: MOV R0, $0xf 0x53 015: ADD R0, $0x3 { Result = 0x12 } 0x51 016: ADD R0, $0x1 { Result = 0x13 } 0x40 017: JMPF *R0 0xf6 019: ST R1, *R2 { Addr = 0x4, Result = 0x6 } 0x19 020: MOV R2, $0x5 Slide 2-22 11

Utility Methods in ISS dumpimem(): Dumps contents of instruction memory Optionally takes start and end address dumpdmem() Dumps contents of data memory Optionally takes start and end address Both useful for debugging the program Slide 2-23 Instantiate class Proc Main() Load I-Mem, D-Mem Reset the processor Interactive loop Receive user command Execute runloop() Dump memory Slide 2-24 12

What you will turn in for Lab 2 Summary of your ISA from Lab 1 as well as assembly listing for the three programs, including the machine code for each instruction. Complete code for the Assembler and ISS, including all the header files and makefile. Complete instruction trace for the three programs executing correctly on the ISS. Data memory dump before and after running each one of the three programs. Also, dynamic instruction count for each one of the three programs. Answer to the questions below. Use turnin script (instructions are on the web) Slide 2-25 Tips for debugging programs Typical problems Machine code translation errors ISS bugs Logic errors in your program code Infinite loops Branch to invalid I-Mem location Memory fetch from invalid D-Mem location Branch target may change if you modify code Print instruction side effects in trace! Slide 2-26 13

You should have completely functional three programs at the end of Lab2! Slide 2-27 Homework: Review LogicWorks 4 Head start on Lab 3 where: You will design datapath Register file, ALU and other elements Implement and test logic No submission! Slide 2-28 14

LogicWorks 4 Review Various components available in Standard Libraries. D Flip-flop, logic gates, multiplexors, registers, adders, clock, binary switch, binary display, hex keypad, hex display, etc. How to connect a bus to various components. How to define a subcircuit bottom up Create a subcircuit Use it to define the pins on the parent symbol. How to simulate a circuit and generate waveforms. Slide 2-29 What you need for Lab2 UNIX workstations Accounts Tools GCC GDB or DDD debugger Slide 2-30 15

Lab 2 Due: Lab Due Dates Before 8:00 AM Friday, October 31 st No late submissions! I plan to disclose a range of clock cycles from your Lab 2 reports (no names) Slide 2-31 16