1 Lab Session-IV CSIT-120 Fall 2000 Precedence Rules Machine Language Programming The “Micro” Machine The “Micro” Simulator The “Micro” Translator (Thanks.

Slides:



Advertisements
Similar presentations
GCSE Computing Lesson 5.
Advertisements

Dr. Ken Hoganson, © August 2014 Programming in R COURSE NOTES 2 Hoganson Language Translation.
The 8051 Microcontroller and Embedded Systems
Chapter 2 Machine Language.
 Suppose for a moment that you were asked to perform a task and were given the following list of instructions to perform:
The Little man computer
Lab6 – Debug Assembly Language Lab
Snick  snack A Working Computer Slides based on work by Bob Woodham and others.
LC-3 Computer LC-3 Instructions
The Analytical Engine Module 6 Program Translation.
CSCE 121, Sec 200, 507, 508 Fall 2010 Prof. Jennifer L. Welch.
1 Lab Session-IV CSIT-120 Spring 2001 Lab 3 Revision and Exercises Rev: Precedence Rules Lab Exercise 4-A Machine Language Programming The “Micro” Machine.
Chapter 7 Low-Level Programming Languages. 2 Chapter Goals List the operations that a computer can perform Discuss the relationship between levels of.
C++ Programming: From Problem Analysis to Program Design, Third Edition Chapter 1: An Overview of Computers and Programming Languages C++ Programming:
Data Transfer & Decisions I (1) Fall 2005 Lecture 3: MIPS Assembly language Decisions I.
© Janice Regan, CMPT 128, Jan CMPT 128 Introduction to Computing Science for Engineering Students Creating a program.
1 Lab Session-III CSIT-120 Fall 2000 Revising Previous session Data input and output While loop Exercise Limits and Bounds Session III-B (starts on slide.
An Interactive Web-Based Simulation of a General Computer Architecture
Dr Masri Ayob TK 2633: Microprocessor & Interfacing Lecture 7: Assembly Language.
IT253: Computer Organization Lecture 4: Instruction Set Architecture Tonga Institute of Higher Education.
1 Programming in Machine Language SCSC 311 Spring 2011.
Computer Systems Organization CS 1428 Foundations of Computer Science.
Microcode Source: Digital Computer Electronics (Malvino and Brown)
CSC 3210 Computer Organization and Programming Chapter 1 THE COMPUTER D.M. Rasanjalee Himali.
CSCI 211 Intro Computer Organization –Consists of gates for logic And Or Not –Processor –Memory –I/O interface.
Using the Computer Turning it on – Your computers in the lab should be turned on, but if you arrive and the screen is blank, do the following: Hit the.
Copyright 2006 by Timothy J. McGuire, Ph.D. 1 MIPS Assembly Language CS 333 Sam Houston State University Dr. Tim McGuire.
Represents different voltage levels High: 5 Volts Low: 0 Volts At this raw level a digital computer is instructed to carry out instructions.
COMPILERS CLASS 22/7,23/7. Introduction Compiler: A Compiler is a program that can read a program in one language (Source) and translate it into an equivalent.
1.4 Representation of data in computer systems Instructions.
ECEG-3202 Computer Architecture and Organization Chapter 6 Instruction Sets: Addressing Modes and Formats.
Digital Computer Concept and Practice Copyright ©2012 by Jaejin Lee Control Unit.
Georgia Institute of Technology Speed part 1 Barb Ericson Georgia Institute of Technology May 2006.
Copyright 2006 by Timothy J. McGuire, Ph.D. 1 MIPS Assembly Language CS 333 Sam Houston State University Dr. Tim McGuire.
Simple ALU How to perform this C language integer operation in the computer C=A+B; ? The arithmetic/logic unit (ALU) of a processor performs integer arithmetic.
Digital Computer Concept and Practice Copyright ©2012 by Jaejin Lee Control Unit.
Computer Operation. Binary Codes CPU operates in binary codes Representation of values in binary codes Instructions to CPU in binary codes Addresses in.
Some of the utilities associated with the development of programs. These program development tools allow users to write and construct programs that the.
CSCI-365 Computer Organization Lecture Note: Some slides and/or pictures in the following are adapted from: Computer Organization and Design, Patterson.
Writing an Assembly-language program MIPS assembly language using MARS: MIPS Assembler and Runtime Simulator CS-2710 Dr. Mark L. Hornick 1.
The Little man computer
INTRODUCTION TO AVRASSEMBLY PROGRAMMING
Displacement (Indexed) Stack
ISA - Instruction Set Architecture
Addressing Modes in Microprocessors
Computer Science 210 Computer Organization
MIPS Instruction Set Advantages
Control Unit Lecture 6.
CSCI-235 Micro-Computer Applications
Programming in Machine Language
Prof. Sirer CS 316 Cornell University
William Stallings Computer Organization and Architecture 8th Edition
C++ Programming: From Problem Analysis to Program Design
CS 301 Fall 2001 – Chapter 3 Slides by Prof. Hartman, following “IBM PC Assembly Language Programming” by Peter Abel 9/17/2018.
Starter Read the Feedback Click on Add new Feedback Open Realsmart
The Processor and Machine Language
Computer Science 210 Computer Organization
Unit# 8: Introduction to Computer Programming
Hmmm Assembly Language
Computer Science I CSC 135.
CSCE Fall 2013 Prof. Jennifer L. Welch.
ECEG-3202 Computer Architecture and Organization
CSCE Fall 2012 Prof. Jennifer L. Welch.
Prof. Sirer CS 316 Cornell University
CISC101 Reminders Labs start this week. Meet your TA! Get help with:
Program Execution.
William Stallings Computer Organization and Architecture 8 th Edition Chapter 11 Instruction Sets: Addressing Modes and Formats.
1.3.7 High- and low-level languages and their translators
Hmmm Assembly Language
Presentation transcript:

1 Lab Session-IV CSIT-120 Fall 2000 Precedence Rules Machine Language Programming The “Micro” Machine The “Micro” Simulator The “Micro” Translator (Thanks to Genti) Experiment 4.1 and Lab Exercise 4-B Experiment 4.2 Lab 4 Continued

2 Mixing Arithmetic Operations When we try to perform several arithmetic operations in one expression, the expression becomes quite complex For example, consider the following Q = (A+B*C)(A+B/C) Q = ((A+B)*C)((A+B)/C)??? Q = (A+(B*C))(A+(B/C))???

3 Precedence Rules In order to resolve complex expressions without any ambiguity, a set of precedence rules is defined ( )Parenthesis have top priority In arithmetic operations, * and / take precedence over + and - = has lowest priority

4 Machine Language Programming All programs written in C++, Java or any other user-level language are translated to the machine language after compilation Look at an example that shows how a C++ program line will be converted to the machine language of “Micro”, an example machine

5 C++ Program My_var = this_data+next_data Compilation and Linking //Load R5 from Memory //Load R4 from Memory //Add R4,R5 & store result in R //Store R6 into Memory The Compilation of Programs

6 Machine Language Programs A compiled and linked program is a series of machine language instructions and data Each processor has its own set of machine language instructions Can programs compiled for Pentium II run on Alpha workstation?

7 The “Micro” Machine The Micro Machine has >256 Memory cells, each cell can hold 1 byte >Memory addresses range 00-FF (two digits) >16 General Purpose Registers >Register addresses range 0-F (one digit) >Program Counter and Instruction Register >12 Machine Language Instructions (1-C)

8 The “Micro” Simulator The “Micro” Simulator is a C++ Program Download this program by visiting “The Micro” link in the labs webpage of the course Click on “micro” to download or cut & paste this program and save as a C++ file Double click on this file to run Visual C++ Compile and run the program

9 The Micro Simulator The full screen display shows the contents of the memory from cell 00 to cell FF It also shows contents of registers R0 through R15 PC and IR contents are visible too The machine has several single-letter commands (4-A): Experiment 4.1 (PC incr?)

10 Genti’s Translator It is obvious that writing hex code is cryptic and prone to errors. If anything goes wrong, it is difficult to trace the errors (or debug the code) To make it “human-friendly”, Our TA last semester Mr. Genti developed a translator for the assembly language of “micro”

11 Genti’s Translator This translator assumes the program is written using some suggested mnemonics Following is a list of instructions and their corresponding hex code and mnemonics

12 Genti’s Translator

13 Strategy for Programming “Micro” Develop your program using this list in a text file using wordpad or notepad Run Genti’s translator by using the link given in the course web pages Program asks for input file name and output file name It will leave the hex code in a text file Keep that file in view when you load the program into “micro” simulator

14 The Power to Simulate The Micro Simulator can run programs designed by you too Lab Exercise 4-B Design a program that adds values 1 through 5 together and leaves the result in register R9. These values should be loaded into the memory by hand. (4-C) Experiment 4.2

15 Lab-4 Continued The Micro Machine and its Simulator The JUMP instruction and its usage Experiment 4.4

16 Micro and its Simulator What is the memory size in Micro? How many instructions are there? How can we start executing a program in Micro? What is the difference between S and G commands? What does Genti’s Translator do?

17 JUMP Instruction JUMP instruction is provided to facilitate the implementation of loops and branches Its format is B RXY (JUMP RXY) It means “jump to location XY if R=R0 Unconditional jump if R0 compared to itself Experiment 4.4