Learning Forth. Developer Technical Support DTS. for Macintosh Open Firmware (Part I) 2/1/01 version 0.9 (part I) 1
|
|
- William Fisher
- 5 years ago
- Views:
Transcription
1 Learning Forth for Macintosh Open Firmware (Part I) Developer Technical Support DTS 2/1/01 version 0.9 (part I) 1
2 Introduction This document is the first in a series of documents intended for hardware designers and device driver programmers that would like to learn and use Forth to examine, access and control hardware from low level in Open Firmware. This document covers the basics of Forth for Open Firmware. It provides definitions of Forth Terms, an outline of the Open Firmware structure, Basic I/O and basic Units and arithmetic operations of the Forth language. This document was originally created as a "PowerPoint" presentation and intended to be a tutorial for Forth in Open Firmware. Slides are in a sequential order, where later (higher numbered) slides build on and assume familiarity with earlier (lower numbered) slides. This documents is intended to cover enough of basic concepts and information about the Forth language and Open Firmware for developers to use some of the features in the Open Firmware environment. Detailed and complete information about Forth and Open Firmware is left to the documents listed under Reference Material in the second document of this series. 2/1/01 version 0.9 (part I) 2
3 What is Forth? Programming Language Interactive & Extensible User Interface Developed by Charles Moore 1970 National Radio Astronomy Observatory 2/1/01 version 0.9 (part I) 3
4 What is Forth at Apple? Programming Language for IEEE 1275 IEEE Standard for Boot (Initialization Configuration) Firmware The Open Firmware specification Used for booting Mac OS Used by PCI devices FCode drivers Plug and play Built In Self Test (BIST) Used by engineers to debug devices Used for hardware bringup Test and Initialization of New Hardware 2/1/01 version 0.9 (part I) 4
5 Course Material Definition of certain basis terms Forth System Dictionary Interpreter User interface Fundamentals 2/1/01 version 0.9 (part I) 5
6 Forth Terms Word Address Unit Name Dictionary Data stack Return stack Cell User Interface Interpreter FCode 2/1/01 version 0.9 (part I) 6
7 Definition of terms Word: The name of a Forth definition. In the text interpreter, word can also refer to a sequence of non-space characters to be processed. A Forth procedure or definition that does something (subroutine, command, etc.) A Word refers to a Forth definition as opposed to size or unit of data. 2/1/01 version 0.9 (part I) 7
8 Definition of terms Address Unit : The units, in Forth, which express the length of a region of memory. These units are usually bytes 2/1/01 version 0.9 (part I) 8
9 Definition of terms Name: What we call a Definition A Definition is a Forth execution procedure compiled into the dictionary. 2/1/01 version 0.9 (part I) 9
10 Definition of terms Dictionary: An extensible structure containing definitions and associated data space. Where we store words and do so in a top down manner The area in host memory where all Forth words are stored 2/1/01 version 0.9 (part I) 10
11 Definition of terms Data stack: An area of memory containing a last-in, first-out list of items that may be used for passing parameters between procedures. Used to pass arguments to words Forth uses the stack for memory and variables Note that the use of the term stack usually refers to the Data stack. 2/1/01 version 0.9 (part I) 11
12 Definition of terms Return stack: An area of memory containing a last-in, first-out list of items that may be used for program execution, temporary storage, and other purposes. Used to pass control between words & for looping The return stack is a second stack used for system purposes. It may also be used as a temporary stack by the Forth programmer; however, there are strong restrictions on such usage as specified by ANSI X3.2l /1/01 version 0.9 (part I) 12
13 Definition of terms Cell: The primary unit of information storage in the architecture of a Forth system. A unit of information in Forth system The word length of a processor is always referred to as a cell. This is also the size of an address, and is the size of a single item on Forth s stacks. 2/1/01 version 0.9 (part I) 13
14 Definition of terms User Interface: A command interpreter for humans to use. That portion of a Forth system that processes human commands 2/1/01 version 0.9 (part I) 14
15 Definition of terms Interpreter: An essentially closed executive routine which translates a stored pseudocode program into machine language and performs the desired and specific operations. An algorithm that processes and acts upon a string of commands When Forth Words are entered, they are both Processed & Run! 2/1/01 version 0.9 (part I) 15
16 Definition of terms FCode: A computer language defined by the IEEE 1394 standard, which is semantically similar to Forth, but is encoded as a sequence of binary byte codes representing a defined set of Forth definitions. FCode = Forth in "byte" form! 2/1/01 version 0.9 (part I) 16
17 Open Firmware (Forth) System Environment Three Interfaces User Interface Between Open Firmware and the human programmer Client Interface Between Open Firmware and the OS that is being "booted". i.e. Mac OS Device Interface Between Open Firmware and the developer s device. Used during probing 2/1/01 version 0.9 (part I) 17
18 User Interface Three Components of User Interface Basic I/O Dictionary Interpreter 2/1/01 version 0.9 (part I) 18
19 Basic I/O Input Command Line, "User" interface Cursor The cursor consists of 2 components. A numeric value indicating the depth of the data stack A Prompt (>) Indicating the data entry point Carriage Return A carriage return (<cr>) enters data onto the Stack # of Cells on the Stack 3 > 1234 Data{ 2/1/01 version 0.9 (part I) 19
20 Basic I/O Output Feedback Forth responds with after the carriage return. If input is recognized When data is entered, Forth "pushes the data on the stack and increments the stack depth. If input is NOT recognized An error message is displayed and the stack is emptied. 0 > 1234 <cr> 1 > Stack depth Incremented Forth Response 3 > qyz <cr> qyz, unknown word 0 > Empty Stack Error Message{ 2/1/01 version 0.9 (part I) 20
21 Basic I/O Output Data Stack Contents.s.s Displays the entire stack contents, unchanged. Contents are displayed in bottom to top order. (0 n) 0 > <cr> 3 >.s > Contents Stack{ Top of Stack (Last Entry) The Data Stack Bottom of Stack (First Entry) 2/1/01 version 0.9 (part I) 21
22 Dictionary The area in host memory where all Forth words are stored Stored as a linked list Stored in a top down fashion Last in first used (given duplicate Words)! ANSI X Forth words are the base set Built into the system User extensible words can be entered into the dictionary 2/1/01 version 0.9 (part I) 22
23 A word A word is separated by white space!!!!!! White space is: A new line, a tab, a space, a return or an enter character. ANSI words are built into a Forth system User words are defined using a colon definition A colon definition has the form: : name word_1 word_n ; White Space 2/1/01 version 0.9 (part I) 23
24 A Note About White Space In general, White Space, between data elements, is treated the same as entering a new cell on the stack. 0 > 1 1 > 2 2 > 3 3 > 4 4 >.s vs. 0 > >.s Where is White Space. 2/1/01 version 0.9 (part I) 24
25 A word example Using a colon definition, define a word that displays your name when you enter xyz at the user interface. A colon (:)( starts the definition and a semicolon (;) ends the definition. The Word definition's name = xyz. Dot quote (."(.") is a word that starts a display string that ends with quote ("). 0 > : xyz." hello it s me, Daffy Duck " ; Definition Start Name Quotation Start (Dot Quote) String Quotation End Definition End 2/1/01 version 0.9 (part I) 25
26 A word example (continued) hello it s me, Daffy Duck was the string A new word is entered into the Forth dictionary using the colon definition. : name word_1 word_n ; A word is executed by entering the name and a carriage return. xyz <cr> You can use the word "see" to display your word. see takes its argument from the next word in the input stream 2/1/01 version 0.9 (part I) 26
27 Interpreter Operation BEGIN Get a Word Search Dictionary Execute the Word Yes Word Found? No Attemp to convert Text to a Number Stack Underflow? Yes No Successful? No Issue Error Message Reset Stack & Interpreter Yes Push the Number onto the Stack ABORT! AGAIN go to BEGIN 2/1/01 version 0.9 (part I) 27
28 User Interface To enter the Open Firmware user interface start your Macintosh with the apple-option-o-f keys depressed (a.k.a. command, option, O, F keys) 2/1/01 version 0.9 (part I) 28
29 Fundamentals Stack Duplication dup Duplicate the top item on the stack 2dup Duplicate the top 2 items on the stack 3dup Duplicate the top 3 items on the stack?dup Duplicate the top item on the stack if it is nonzero dup 0> > dup 5>.s dup 0> > 2dup 6>.s dup 0> > 3dup 7>.s ?dup 0> >?dup 5>.s > >?dup 4>.s /1/01 version 0.9 (part I) 29
30 Fundamentals Stack Duplication over Copy 2nd stack item to the top of the stack 2over Copy 2nd pair of stack items to the top of the stack pick Copy N th stack item to the top of the stack 4 pick (copy 4th item) tuck Copy top stack item underneath the 2nd stack item over 0> > over 5>.s over 0> > 2over 6>.s pick 0> > 2 pick 5>.s tuck 0> > tuck 5>.s /1/01 version 0.9 (part I) 30
31 Fundamentals Stack Removal clear Empty the stack drop Remove the top item from the stack 2drop Remove the top 2 items from the stack clear 0> > clear 0>.s Empty drop 0> > drop 3>.s drop 0> > 2drop 2>.s 1 2 2/1/01 version 0.9 (part I) 31
32 Fundamentals Stack Removal 3drop nip Remove the top 3 items from the stack Remove the 2nd second stack item 3drop nip 0> > 3drop 1>.s 1 0> > nip 3>.s /1/01 version 0.9 (part I) 32
33 Fundamentals Stack Rearrangement roll Rotate n +1 stack items 1 roll (a b - - b a) 1 roll is same as swap rot Rotate the top 3 stack items (left) rot (a b c - - b c a) -rot Rotate the top 3 stack items (right) -rot (a b c - - c a b) 2rot Rotate the top 3 pairs of stack items (left) 2rot (a b c d e f - - c d e f a b) roll 0> > 2 roll 4>.s rot 0> > rot 4>.s rot 0> > -rot 4>.s rot 0> > 2rot 8>.s /1/01 version 0.9 (part I) 33
34 Fundamentals Stack Rearrangement swap Exchange the top 2 stack items 2swap swap (a b - - b a) Exchange the top 2 pairs of stack items depth 2swap (a b c d - - c d a b) Return the count of items on the stack swap 0> > swap 4>.s swap 0> > 2swap 4>.s depth 0> > depth 5>.s /1/01 version 0.9 (part I) 34
35 Fundamentals Return Stack >r r> Move the top data stack item to the return stack Move the top return stack item to the data stack Copy top return stack item to the data stack 2/1/01 version 0.9 (part I) 35
36 Fundamentals Arithmetic: Radix Single Precision Operators Bitwise Logical Operators Address Arithmetic 2/1/01 version 0.9 (part I) 36
37 Arithmetic Words that set or change the numeric conversion radix octal Sets the numeric conversion radix to eight Sets the radix to base 8 decimal e.g Sets the numeric conversion radix to ten Sets the radix to base 10 hex (hexadecimal) e.g Sets the numeric conversion radix to sixteen Sets the radix to base 16 * Default * e.g a b c d e f 10 2/1/01 version 0.9 (part I) 37
38 Arithmetic (Integer) Single Precision Operators + Add the 2nd and 1st numbers on the top of the stack, decrement the stack and replace the top of the stack with the sum - Subtract the 1st from the 2nd number on the top of the stack, decrement the stack and replace the top of the stack with the difference * Multiply the 2nd and 1st numbers on the top of the stack, decrement the stack and replace the top of the stack with the product / Divide the 1st by the 2nd number on the top of the stack, decrement the stack and replace the top of the stack with the quotient mod Divide the 1st by the 2nd number on the top of the stack, decrement the stack and replace the top of the stack with the remainder + - * / mod 0 > > + 3 >.s > > - 3 >.s > > * 3 >.s > > / 3 >.s > > mod 3 >.s /1/01 version 0.9 (part I) 38
39 Arithmetic (Integer) Single Precision Operators Increment the number on the top of the stack by 1 Decrement the number on the top of the stack by 1 Increment the number on the top of the stack by 2 Decrement the number on the top of the stack by > > 1+ 3 >.s > > 1-3 >.s > > 2+ 3 >.s > > 2-3 >.s /1/01 version 0.9 (part I) 39
40 Arithmetic Single Precision Operators (continued) abs Replace the number on the top of the stack with the absolute value of that number negate Negate value of the number on the top of the stack abs negate 0 > > abs 4 >.s ffffffff fffffffe fffffffd 4 0 > > negate 4 >.s fffffffc max Determine the maximum value of the 2nd and 1st numbers on the top of the stack, decrement the stack and replace the top of the stack with this value. max 0 > > max 3 >.s /1/01 version 0.9 (part I) 40
41 Arithmetic Single Precision Operators (continued) min Determine the minimum value of the 2nd and 1st numbers on the top of the stack, decrement the stack and replace the top of the stack with this value. even Replace the number on the top of the stack with the nearest even value that is greater than or equal to that number min even 0 > > min 3 >.s > > even 4 >.s bounds Prepare for a do or?do loop, where the top of the stack is the index and the 2nd from the top is the limit. (a looping parameter) (n cnt -- n+cnt n) bounds 0 > > bounds 2 >.s 3 1 Do 2 loops and stop at 1 2/1/01 version 0.9 (part I) 41
42 Arithmetic Bitwise Logical Operators lshift or << Shift the 2nd number on the top of the stack Left by the 1st number on the top of the stack (fill with 0), decrement the stack and replace the top of the stack with this value. rshift or >> Shift the 2nd number on the top of the stack Right by the 1st number on the top of the stack (fill with 0), decrement the stack and replace the top of the stack with this value. 2* Shift the number on the top of the stack Left by one bit (fill with 0), decrement the stack and replace the top of the stack with this value. 2/ Shift the number on the top of the stack Right by one bit, decrement the stack and replace the top of the stack with this value. lshift or << (shift 2 left, 1 time) rshift or >> 2* 2/ (shift 4 right, 2 times) (< 0100 = 1000) (>0100 = 0010) 0 > > lshift 3 >.s > > >> 3 >.s > > 2* 4 >.s > > 2/ 4 >.s /1/01 version 0.9 (part I) 42
43 Arithmetic Bitwise Logical Operators and Bitwise AND the 2nd number from the top of the stack with the1st number on the top of the stack, decrement the stack and replace the top of the stack with this value. or Bitwise OR the 2nd number from the top of the stack with the1st number on the top of the stack, decrement the stack and replace the top of the stack with this value. xor Bitwise Exclusive OR the 2nd number from the top of the stack with the1st number on the top of the stack, decrement the stack and replace the top of the stack with this value. invert or not Bitwise invert the number on the top of the stack replace it with this value. and or xor (0101 & 0110 = 0100) ( = 0111) (0101 ^ 0110 = 0011) invert or not (~ 0011 = 1100) 0 > > and 3 >.s > > or 3 >.s > > xor 3 >.s > > not 3 >.s 1 2 fffffffc 2/1/01 version 0.9 (part I) 43
44 Arithmetic Address Arithmetic /c Put the number of address units to a byte Value = 1 /w Put the number of address units to a doublet (doublet = A unit of data consisting of 16 bits) Value may vary between versions of systems. Typically 2 /l Put the number of address units to a quadlet (quadlet = A unit of data consisting of 32 bits) Value may vary between versions of systems. Typically 4 /c /w /l 0 > /c 1 >.s 1 0 > /w 1 >.s 2 0 > /l 1 >.s 4 2/1/01 version 0.9 (part I) 44
45 Arithmetic Address Arithmetic /n Put the number of address units to a cell. Value may vary between versions of systems. cells Multiply the number on the top of the stack by the value of /n and replace the top of the stack with this value. cell+ Increment the number on the top of the stack by the value of /n and replace the top of the stack with this value. /n cells cell+ 0 > /n 1 >.s 4 0 > > cells 1 >.s > > cells 1 >.s /1/01 version 0.9 (part I) 45
Number representations
Number representations Number bases Three number bases are of interest: Binary, Octal and Hexadecimal. We look briefly at conversions among them and between each of them and decimal. Binary Base-two, or
More informationBV Forth (ARM) Core Glossary ByVac ByVac Revision 1.0
BV Forth (ARM) Core Glossary ByVac ByVac 2007 www.byvac.co.uk Revision 1.0 ByVac Page 1 of 44 Contents 1. GLOSSARY... 3 2. FUNCTIONAL CROSS REFERENCE... 4 3. REVISIONS... 43 4. APPENDIX B RESOURCES...
More informationData Representation COE 301. Computer Organization Prof. Muhamed Mudawar
Data Representation COE 30 Computer Organization Prof. Muhamed Mudawar College of Computer Sciences and Engineering King Fahd University of Petroleum and Minerals Presentation Outline Positional Number
More informationUNIT- 3 Introduction to C++
UNIT- 3 Introduction to C++ C++ Character Sets: Letters A-Z, a-z Digits 0-9 Special Symbols Space + - * / ^ \ ( ) [ ] =!= . $, ; : %! &? _ # = @ White Spaces Blank spaces, horizontal tab, carriage
More informationNumber Systems Standard positional representation of numbers: An unsigned number with whole and fraction portions is represented as:
N Number Systems Standard positional representation of numbers: An unsigned number with whole and fraction portions is represented as: a n a a a The value of this number is given by: = a n Ka a a a a a
More informationArithmetic and Bitwise Operations on Binary Data
Arithmetic and Bitwise Operations on Binary Data CSCI 2400: Computer Architecture ECE 3217: Computer Architecture and Organization Instructor: David Ferry Slides adapted from Bryant & O Hallaron s slides
More informationBasic operators, Arithmetic, Relational, Bitwise, Logical, Assignment, Conditional operators. JAVA Standard Edition
Basic operators, Arithmetic, Relational, Bitwise, Logical, Assignment, Conditional operators JAVA Standard Edition Java - Basic Operators Java provides a rich set of operators to manipulate variables.
More informationCMPS 10 Introduction to Computer Science Lecture Notes
CMPS Introduction to Computer Science Lecture Notes Binary Numbers Until now we have considered the Computing Agent that executes algorithms to be an abstract entity. Now we will be concerned with techniques
More informationChapter 2: Number Systems
Chapter 2: Number Systems Logic circuits are used to generate and transmit 1s and 0s to compute and convey information. This two-valued number system is called binary. As presented earlier, there are many
More informationGO - OPERATORS. This tutorial will explain the arithmetic, relational, logical, bitwise, assignment and other operators one by one.
http://www.tutorialspoint.com/go/go_operators.htm GO - OPERATORS Copyright tutorialspoint.com An operator is a symbol that tells the compiler to perform specific mathematical or logical manipulations.
More informationLearning Forth. Developer Technical Support DTS. for Macintosh Open Firmware (Part II) 2/1/01 version 0.9 1
Learning Forth for Macintosh Open Firmware (Part II) Developer Technical Support DTS 2/1/01 version 0.9 1 Introduction This document is the second in a series of documents intended for hardware designers
More informationCSCI 2212: Intermediate Programming / C Chapter 15
... /34 CSCI 222: Intermediate Programming / C Chapter 5 Alice E. Fischer October 9 and 2, 25 ... 2/34 Outline Integer Representations Binary Integers Integer Types Bit Operations Applying Bit Operations
More informationDigital Systems COE 202. Digital Logic Design. Dr. Muhamed Mudawar King Fahd University of Petroleum and Minerals
Digital Systems COE 202 Digital Logic Design Dr. Muhamed Mudawar King Fahd University of Petroleum and Minerals Welcome to COE 202 Course Webpage: http://faculty.kfupm.edu.sa/coe/mudawar/coe202/ Lecture
More informationUNIT-II. Part-2: CENTRAL PROCESSING UNIT
Page1 UNIT-II Part-2: CENTRAL PROCESSING UNIT Stack Organization Instruction Formats Addressing Modes Data Transfer And Manipulation Program Control Reduced Instruction Set Computer (RISC) Introduction:
More information2. Define Instruction Set Architecture. What are its two main characteristics? Be precise!
Chapter 1: Computer Abstractions and Technology 1. Assume two processors, a CISC processor and a RISC processor. In order to run a particular program, the CISC processor must execute 10 million instructions
More information1. NUMBER SYSTEMS USED IN COMPUTING: THE BINARY NUMBER SYSTEM
1. NUMBER SYSTEMS USED IN COMPUTING: THE BINARY NUMBER SYSTEM 1.1 Introduction Given that digital logic and memory devices are based on two electrical states (on and off), it is natural to use a number
More informationOctal & Hexadecimal Number Systems. Digital Electronics
Octal & Hexadecimal Number Systems Digital Electronics What, More Number Systems? Why do we need more number systems? Humans understand decimal Check out my ten digits! Digital electronics (computers)
More informationCHW 261: Logic Design
CHW 261: Logic Design Instructors: Prof. Hala Zayed Dr. Ahmed Shalaby http://www.bu.edu.eg/staff/halazayed14 http://bu.edu.eg/staff/ahmedshalaby14# Slide 1 Slide 2 Slide 3 Digital Fundamentals CHAPTER
More informationChapter 3: part 3 Binary Subtraction
Chapter 3: part 3 Binary Subtraction Iterative combinational circuits Binary adders Half and full adders Ripple carry and carry lookahead adders Binary subtraction Binary adder-subtractors Signed binary
More informationThe. Binary. Number System
The Binary Number System Why is Binary important? Everything on a computer (or other digital device) is represented by Binary Numbers One to Five in various systems 1 2 3 4 5 I II III IV V 1 10 11 100
More informationChapter 2. Positional number systems. 2.1 Signed number representations Signed magnitude
Chapter 2 Positional number systems A positional number system represents numeric values as sequences of one or more digits. Each digit in the representation is weighted according to its position in the
More informationJAVA Programming Fundamentals
Chapter 4 JAVA Programming Fundamentals By: Deepak Bhinde PGT Comp.Sc. JAVA character set Character set is a set of valid characters that a language can recognize. It may be any letter, digit or any symbol
More informationDEPARTMENT OF MATHS, MJ COLLEGE
T. Y. B.Sc. Mathematics MTH- 356 (A) : Programming in C Unit 1 : Basic Concepts Syllabus : Introduction, Character set, C token, Keywords, Constants, Variables, Data types, Symbolic constants, Over flow,
More informationME 461 C review Session Fall 2009 S. Keres
ME 461 C review Session Fall 2009 S. Keres DISCLAIMER: These notes are in no way intended to be a complete reference for the C programming material you will need for the class. They are intended to help
More informationECE232: Hardware Organization and Design
ECE232: Hardware Organization and Design Lecture 4: Logic Operations and Introduction to Conditionals Adapted from Computer Organization and Design, Patterson & Hennessy, UCB Overview Previously examined
More informationShift and Rotate Instructions
Shift and Rotate Instructions Shift and rotate instructions facilitate manipulations of data (that is, modifying part of a 32-bit data word). Such operations might include: Re-arrangement of bytes in a
More informationOperators. Java operators are classified into three categories:
Operators Operators are symbols that perform arithmetic and logical operations on operands and provide a meaningful result. Operands are data values (variables or constants) which are involved in operations.
More informationSlide Set 1. for ENEL 339 Fall 2014 Lecture Section 02. Steve Norman, PhD, PEng
Slide Set 1 for ENEL 339 Fall 2014 Lecture Section 02 Steve Norman, PhD, PEng Electrical & Computer Engineering Schulich School of Engineering University of Calgary Fall Term, 2014 ENEL 353 F14 Section
More informationT02 Tutorial Slides for Week 2
T02 Tutorial Slides for Week 2 ENEL 353: Digital Circuits Fall 2017 Term Steve Norman, PhD, PEng Electrical & Computer Engineering Schulich School of Engineering University of Calgary 19 September, 2017
More informationComputer Architecture /
Computer Architecture 02-201 / 02-601 The Conceptual Architecture of a Computer PC CPU register 0 register 1 register 2 registers hold small amounts of data for processing by the CPU Reading / writing
More informationExcerpt from: Stephen H. Unger, The Essence of Logic Circuits, Second Ed., Wiley, 1997
Excerpt from: Stephen H. Unger, The Essence of Logic Circuits, Second Ed., Wiley, 1997 APPENDIX A.1 Number systems and codes Since ten-fingered humans are addicted to the decimal system, and since computers
More informationChapter 1 Preliminaries
Chapter 1 Preliminaries This chapter discusses the major classes of programming languages and the relationship among them. It also discusses the binary and the hexadecimal number systems which are used
More informationObjectives. Connecting with Computer Science 2
Objectives Learn why numbering systems are important to understand Refresh your knowledge of powers of numbers Learn how numbering systems are used to count Understand the significance of positional value
More informationSlide Set 1. for ENEL 353 Fall Steve Norman, PhD, PEng. Electrical & Computer Engineering Schulich School of Engineering University of Calgary
Slide Set 1 for ENEL 353 Fall 2017 Steve Norman, PhD, PEng Electrical & Computer Engineering Schulich School of Engineering University of Calgary Fall Term, 2017 SN s ENEL 353 Fall 2017 Slide Set 1 slide
More information2.1. Unit 2. Integer Operations (Arithmetic, Overflow, Bitwise Logic, Shifting)
2.1 Unit 2 Integer Operations (Arithmetic, Overflow, Bitwise Logic, Shifting) 2.2 Skills & Outcomes You should know and be able to apply the following skills with confidence Perform addition & subtraction
More informationNumeral Systems. -Numeral System -Positional systems -Decimal -Binary -Octal. Subjects:
Numeral Systems -Numeral System -Positional systems -Decimal -Binary -Octal Subjects: Introduction A numeral system (or system of numeration) is a writing system for expressing numbers, that is a mathematical
More informationQuick Reference Guide
SOFTWARE AND HARDWARE SOLUTIONS FOR THE EMBEDDED WORLD mikroelektronika Development tools - Books - Compilers Quick Reference Quick Reference Guide with EXAMPLES for Basic language This reference guide
More informationThe CPU and Memory. How does a computer work? How does a computer interact with data? How are instructions performed? Recall schematic diagram:
The CPU and Memory How does a computer work? How does a computer interact with data? How are instructions performed? Recall schematic diagram: 1 Registers A register is a permanent storage location within
More informationSwitching Circuits and Logic Design Prof. Indranil Sengupta Department of Computer Science and Engineering Indian Institute of Technology, Kharagpur
Switching Circuits and Logic Design Prof. Indranil Sengupta Department of Computer Science and Engineering Indian Institute of Technology, Kharagpur Lecture - 02 Octal and Hexadecimal Number Systems Welcome
More informationWork relative to other classes
Work relative to other classes 1 Hours/week on projects 2 C BOOTCAMP DAY 1 CS3600, Northeastern University Slides adapted from Anandha Gopalan s CS132 course at Univ. of Pittsburgh Overview C: A language
More informationLAB A Translating Data to Binary
LAB A Translating Data to Binary Create a directory for this lab and perform in it the following groups of tasks: LabA1.java 1. Write the Java app LabA1 that takes an int via a command-line argument args[0]
More informationOutline. What Digit? => Number System. Decimal (base 10) Significant Digits. Lect 03 Number System, Gates, Boolean Algebra. CS221: Digital Design
Lect 3 Number System, Gates, Boolean Algebra CS22: Digital Design Dr. A. Sahu Dept of Comp. Sc. & Engg. Indian Institute of Technology Guwahati Outline Number System Decimal, Binary, Octal, Hex Conversions
More informationNumber System. Introduction. Decimal Numbers
Number System Introduction Number systems provide the basis for all operations in information processing systems. In a number system the information is divided into a group of symbols; for example, 26
More informationCMPE223/CMSE222 Digital Logic Design. Positional representation
CMPE223/CMSE222 Digital Logic Design Number Representation and Arithmetic Circuits: Number Representation and Unsigned Addition Positional representation First consider integers Begin with positive only
More informationUser. Application program. Interfaces. Operating system. Hardware
Operating Systems Introduction to Operating Systems and Computer Hardware Introduction and Overview The operating system is a set of system software routines that interface between an application program
More informationFANF. programming language. written by Konstantin Dimitrov. Revision 0.1 February Programming language FANF 1 / 21
programming language FANF written by Konstantin Dimitrov Revision 0.1 February 2014 For comments and suggestions: knivd@me.com Programming language FANF 1 / 21 Table of Contents 1. Introduction...3 2.
More informationDigital Systems and Binary Numbers
Digital Systems and Binary Numbers Mano & Ciletti Chapter 1 By Suleyman TOSUN Ankara University Outline Digital Systems Binary Numbers Number-Base Conversions Octal and Hexadecimal Numbers Complements
More informationreply db y prompt db Enter your favourite colour:, 0 colour db 80 dup(?) i db 20 k db? num dw 4000 large dd 50000
Declaring Variables in Assembly Language As in Java, variables must be declared before they can be used Unlike Java, we do not specify a variable type in the declaration in assembly language Instead we
More informationChapter 3: Operators, Expressions and Type Conversion
101 Chapter 3 Operators, Expressions and Type Conversion Chapter 3: Operators, Expressions and Type Conversion Objectives To use basic arithmetic operators. To use increment and decrement operators. To
More information15-122: Principles of Imperative Computation, Fall 2015
15-122 Programming 5 Page 1 of 10 15-122: Principles of Imperative Computation, Fall 2015 Homework 5 Programming: Clac Due: Thursday, October 15, 2015 by 22:00 In this assignment, you will implement a
More informationCOMPUTER ORGANIZATION & ARCHITECTURE
COMPUTER ORGANIZATION & ARCHITECTURE Instructions Sets Architecture Lesson 5a 1 What are Instruction Sets The complete collection of instructions that are understood by a CPU Can be considered as a functional
More informationArithmetic Processing
CS/EE 5830/6830 VLSI ARCHITECTURE Chapter 1 Basic Number Representations and Arithmetic Algorithms Arithmetic Processing AP = (operands, operation, results, conditions, singularities) Operands are: Set
More informationISA 563 : Fundamentals of Systems Programming
ISA 563 : Fundamentals of Systems Programming Variables, Primitive Types, Operators, and Expressions September 4 th 2008 Outline Define Expressions Discuss how to represent data in a program variable name
More information1010 2?= ?= CS 64 Lecture 2 Data Representation. Decimal Numbers: Base 10. Reading: FLD Digits: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9
CS 64 Lecture 2 Data Representation Reading: FLD 1.2-1.4 Decimal Numbers: Base 10 Digits: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 Example: 3271 = (3x10 3 ) + (2x10 2 ) + (7x10 1 ) + (1x10 0 ) 1010 10?= 1010 2?= 1
More informationFundamentals of Programming Session 2
Fundamentals of Programming Session 2 Instructor: Reza Entezari-Maleki Email: entezari@ce.sharif.edu 1 Fall 2013 Sharif University of Technology Outlines Programming Language Binary numbers Addition Subtraction
More informationThe Design of C: A Rational Reconstruction
The Design of C: A Rational Reconstruction 1 Goals of this Lecture Help you learn about: The decisions that were available to the designers of C The decisions that were made by the designers of C and thereby
More informationAdvanced Computer Networks. Rab Nawaz Jadoon DCS. Assistant Professor COMSATS University, Lahore Pakistan. Department of Computer Science
Advanced Computer Networks Department of Computer Science DCS COMSATS Institute of Information Technology Rab Nawaz Jadoon Assistant Professor COMSATS University, Lahore Pakistan Advanced Computer Networks
More informationCOMP Overview of Tutorial #2
COMP 1402 Winter 2008 Tutorial #2 Overview of Tutorial #2 Number representation basics Binary conversions Octal conversions Hexadecimal conversions Signed numbers (signed magnitude, one s and two s complement,
More informationBits. Binary Digits. 0 or 1
Data Representation Bits Binary Digits 0 or 1 Everything stored in a computer is stored as bits. Bits can mean different things depending on how the software or hardware interpret the bits Bits are usually
More informationThe Design of C: A Rational Reconstruction"
The Design of C: A Rational Reconstruction 1 Goals of this Lecture Help you learn about: The decisions that were available to the designers of C The decisions that were made by the designers of C and thereby
More informationIntroduction to C Language
Introduction to C Language Instructor: Professor I. Charles Ume ME 6405 Introduction to Mechatronics Fall 2006 Instructor: Professor Charles Ume Introduction to C Language History of C Language In 1972,
More informationCS301 - Data Structures Glossary By
CS301 - Data Structures Glossary By Abstract Data Type : A set of data values and associated operations that are precisely specified independent of any particular implementation. Also known as ADT Algorithm
More informationC Language Part 1 Digital Computer Concept and Practice Copyright 2012 by Jaejin Lee
C Language Part 1 (Minor modifications by the instructor) References C for Python Programmers, by Carl Burch, 2011. http://www.toves.org/books/cpy/ The C Programming Language. 2nd ed., Kernighan, Brian,
More informationChapter 2 Data Representations
Computer Engineering Chapter 2 Data Representations Hiroaki Kobayashi 4/21/2008 4/21/2008 1 Agenda in Chapter 2 Translation between binary numbers and decimal numbers Data Representations for Integers
More informationNumber Systems CHAPTER Positional Number Systems
CHAPTER 2 Number Systems Inside computers, information is encoded as patterns of bits because it is easy to construct electronic circuits that exhibit the two alternative states, 0 and 1. The meaning of
More informationRui Wang, Assistant professor Dept. of Information and Communication Tongji University.
Data Representation ti and Arithmetic for Computers Rui Wang, Assistant professor Dept. of Information and Communication Tongji University it Email: ruiwang@tongji.edu.cn Questions What do you know about
More informationApplied Computer Programming
Applied Computer Programming Representation of Numbers. Bitwise Operators Course 07 Lect.eng. Adriana ALBU, PhD Politehnica University Timisoara Internal representation All data, of any type, processed
More informationA flow chart is a graphical or symbolic representation of a process.
Q1. Define Algorithm with example? Answer:- A sequential solution of any program that written in human language, called algorithm. Algorithm is first step of the solution process, after the analysis of
More informationFachhochschule Wedel Technical Report Nr Implementing the Forth Inner Interpreter in High Level Forth
Implementing the Forth Inner Interpreter in High Level Forth Ulrich Hoffmann Abstract This document defines a Forth threaded code (inner) interpreter written entirely in high level standard
More informationC++ is case sensitive language, meaning that the variable first_value, First_Value or FIRST_VALUE will be treated as different.
C++ Character Set a-z, A-Z, 0-9, and underscore ( _ ) C++ is case sensitive language, meaning that the variable first_value, First_Value or FIRST_VALUE will be treated as different. Identifier and Keywords:
More informationCOMPUTER ARCHITECTURE AND ORGANIZATION. Operation Add Magnitudes Subtract Magnitudes (+A) + ( B) + (A B) (B A) + (A B)
Computer Arithmetic Data is manipulated by using the arithmetic instructions in digital computers. Data is manipulated to produce results necessary to give solution for the computation problems. The Addition,
More informationSCHOOL OF ENGINEERING & BUILT ENVIRONMENT. Mathematics. Numbers & Number Systems
SCHOOL OF ENGINEERING & BUILT ENVIRONMENT Mathematics Numbers & Number Systems Introduction Numbers and Their Properties Multiples and Factors The Division Algorithm Prime and Composite Numbers Prime Factors
More informationInf2C - Computer Systems Lecture 2 Data Representation
Inf2C - Computer Systems Lecture 2 Data Representation Boris Grot School of Informatics University of Edinburgh Last lecture Moore s law Types of computer systems Computer components Computer system stack
More informationLESSON TITLE. Language English Local Language Introduction to Computer Science. Mr. VAR Sovannrath Submission Date October 30th, 2014 Version 1.
LESSON TITLE Country Cambodia Language English Local Language Course Title Introduction to Computer Science Lesson Title 06. Number Systems SME Mr. VAR Sovannrath Submission Date October 30th, 2014 Version
More informationBeginning C Programming for Engineers
Beginning Programming for Engineers R. Lindsay Todd Lecture 6: Bit Operations R. Lindsay Todd () Beginning Programming for Engineers Beg 6 1 / 32 Outline Outline 1 Place Value Octal Hexadecimal Binary
More informationLanguage Fundamentals Summary
Language Fundamentals Summary Claudia Niederée, Joachim W. Schmidt, Michael Skusa Software Systems Institute Object-oriented Analysis and Design 1999/2000 c.niederee@tu-harburg.de http://www.sts.tu-harburg.de
More informationLevel ISA3: Information Representation
Level ISA3: Information Representation 1 Information as electrical current At the lowest level, each storage unit in a computer s memory is equipped to contain either a high or low voltage signal Each
More informationPositional notation Ch Conversions between Decimal and Binary. /continued. Binary to Decimal
Positional notation Ch.. /continued Conversions between Decimal and Binary Binary to Decimal - use the definition of a number in a positional number system with base - evaluate the definition formula using
More informationData Representations & Arithmetic Operations
Data Representations & Arithmetic Operations Hiroaki Kobayashi 7/13/2011 7/13/2011 Computer Science 1 Agenda Translation between binary numbers and decimal numbers Data Representations for Integers Negative
More informationBefore Class Install SDCC Instructions in Installing_SiLabs-SDCC- Drivers document. Solutions to Number Systems Worksheet. Announcements.
August 15, 2016 Before Class Install SDCC Instructions in Installing_SiLabs-SDCC- Drivers document Install SiLabs Instructions in Installing_SiLabs-SDCC- Drivers document Install SecureCRT On LMS, also
More informationJAVA OPERATORS GENERAL
JAVA OPERATORS GENERAL Java provides a rich set of operators to manipulate variables. We can divide all the Java operators into the following groups: Arithmetic Operators Relational Operators Bitwise Operators
More informationComputer Sc. & IT. Digital Logic. Computer Sciencee & Information Technology. 20 Rank under AIR 100. Postal Correspondence
GATE Postal Correspondence Computer Sc. & IT 1 Digital Logic Computer Sciencee & Information Technology (CS) 20 Rank under AIR 100 Postal Correspondence Examination Oriented Theory, Practice Set Key concepts,
More informationCSE P 501 Compilers. Java Implementation JVMs, JITs &c Hal Perkins Winter /11/ Hal Perkins & UW CSE V-1
CSE P 501 Compilers Java Implementation JVMs, JITs &c Hal Perkins Winter 2008 3/11/2008 2002-08 Hal Perkins & UW CSE V-1 Agenda Java virtual machine architecture.class files Class loading Execution engines
More informationHForth Glossary. Introduction. Stack Diagrams. HForth Glossary GL - 1! " # $ % & ` ( ) * + ' -. / 0-9 : ; < = A Z [ / ] ^ _ a z { } ~
HForth Glossary Introduction This glossary defines the low level Forth words that are part of HForth. Music related words will be defined in the HMSL Manual. Some words, specific file I/O related words
More informationArithmetic and Bitwise Operations on Binary Data
Arithmetic and Bitwise Operations on Binary Data CSCI 224 / ECE 317: Computer Architecture Instructor: Prof. Jason Fritts Slides adapted from Bryant & O Hallaron s slides 1 Boolean Algebra Developed by
More informationBeyond Base 10: Non-decimal Based Number Systems
Beyond Base : Non-decimal Based Number Systems What is the decimal based number system? How do other number systems work (binary, octal and hex) How to convert to and from nondecimal number systems to
More informationChapter 1 Emad Felemban
Chapter 1 Emad Felemban Digital Computers and Digital Systems Binary Numbers Number Base Conversion Octal and Hexadecimal Numbers Complements Singed Binary Numbers Binary Codes Binary Storage and Registers
More information4 Programming Fundamentals. Introduction to Programming 1 1
4 Programming Fundamentals Introduction to Programming 1 1 Objectives At the end of the lesson, the student should be able to: Identify the basic parts of a Java program Differentiate among Java literals,
More informationObjects and Types. COMS W1007 Introduction to Computer Science. Christopher Conway 29 May 2003
Objects and Types COMS W1007 Introduction to Computer Science Christopher Conway 29 May 2003 Java Programs A Java program contains at least one class definition. public class Hello { public static void
More informationA Java program contains at least one class definition.
Java Programs Identifiers Objects and Types COMS W1007 Introduction to Computer Science Christopher Conway 29 May 2003 A Java program contains at least one class definition. public class Hello { public
More informationChapter 2. Instruction Set. RISC vs. CISC Instruction set. The University of Adelaide, School of Computer Science 18 September 2017
COMPUTER ORGANIZATION AND DESIGN The Hardware/Software Interface RISC-V Edition Chapter 2 Instructions: Language of the Computer These slides are based on the slides by the authors. The slides doesn t
More informationLet s put together a Manual Processor
Lecture 14 Let s put together a Manual Processor Hardware Lecture 14 Slide 1 The processor Inside every computer there is at least one processor which can take an instruction, some operands and produce
More informationCHAPTER 2 Number Systems
CHAPTER 2 Number Systems Objectives After studying this chapter, the student should be able to: Understand the concept of number systems. Distinguish between non-positional and positional number systems.
More informationCourse Schedule. CS 221 Computer Architecture. Week 3: Plan. I. Hexadecimals and Character Representations. Hexadecimal Representation
Course Schedule CS 221 Computer Architecture Week 3: Information Representation (2) Fall 2001 W1 Sep 11- Sep 14 Introduction W2 Sep 18- Sep 21 Information Representation (1) (Chapter 3) W3 Sep 25- Sep
More informationBasics of Java Programming
Basics of Java Programming Lecture 2 COP 3252 Summer 2017 May 16, 2017 Components of a Java Program statements - A statement is some action or sequence of actions, given as a command in code. A statement
More information(+A) + ( B) + (A B) (B A) + (A B) ( A) + (+ B) (A B) + (B A) + (A B) (+ A) (+ B) + (A - B) (B A) + (A B) ( A) ( B) (A B) + (B A) + (A B)
COMPUTER ARITHMETIC 1. Addition and Subtraction of Unsigned Numbers The direct method of subtraction taught in elementary schools uses the borrowconcept. In this method we borrow a 1 from a higher significant
More informationOverview of C. Basic Data Types Constants Variables Identifiers Keywords Basic I/O
Overview of C Basic Data Types Constants Variables Identifiers Keywords Basic I/O NOTE: There are six classes of tokens: identifiers, keywords, constants, string literals, operators, and other separators.
More informationcore430g2553.s43 ;C EXECUTE i*x xt -- j*x execute Forth word ;C at 'xt' ;Z lit -- x fetch inline literal to stack ;C EXIT -- exit a colon definition
core430g2553.s43 ;C EXECUTE i*x xt -- j*x execute Forth word ;C at 'xt' ;Z lit -- x fetch inline literal to stack ;C EXIT -- exit a colon definition ;C VARIABLE -- define a Forth VARIABLE ;C CONSTANT --
More informationCOE 202- Digital Logic. Number Systems II. Dr. Abdulaziz Y. Barnawi COE Department KFUPM. January 23, Abdulaziz Barnawi. COE 202 Logic Design
1 COE 0- Digital Logic Number Systems II Dr. Abdulaziz Y. Barnawi COE Department KFUPM COE 0 Logic Design January 3, 016 Objectives Base Conversion Decimal to other bases Binary to Octal and Hexadecimal
More informationEE292: Fundamentals of ECE
EE292: Fundamentals of ECE Fall 2012 TTh 10:00-11:15 SEB 1242 Lecture 22 121115 http://www.ee.unlv.edu/~b1morris/ee292/ 2 Outline Review Binary Number Representation Binary Arithmetic Combinatorial Logic
More information