Monday, February 16, 2015
|
|
- Mavis Simon
- 5 years ago
- Views:
Transcription
1 Monday, February 16, 2015 Topics for today How assemblers work Symbol tables ILC Pass 1 algorithm, Error checking Pass 2 Immediate mode and equate Assembler variants: Disassembler, Cross assembler Macros Having looked at enough Pep/8 to complete programs 3 (and 4), we now return to topics skipped in Chapters 5 and 6 First, look at how assemblers work from Chapter 5 How assemblers work In a sentence: An assembler translates symbols to numbers There are various symbols in an assembly language program but they fall into two groups: (1) those that are part of the assembly language itself eg end deco stro block (2) those that a user is free to make up (within length limits) the labels on instructions or data locations The forward reference problem In general, an assembler cannot read a program just once and output a translation as it goes along This is because a symbol can be used before it is defined Consider the following deci N,d ; input count of lines N : block 2 ; variable for line count When the assembler reads the first line, it does not (yet) know the value that N represents Even if the language requires users to declare all data at the top of the program we may still have forward references in branch instructions as in the first line of the following br main A: block 2 B: block 2 main: deci A,d Comp 162 Notes Page 1 of 11 February 16, 2015
2 So a typical assembler reads the source program twice (makes two passes over the text): Pass 1: get values of symbols Pass 2: do the actual translation 1 An assembler makes use of tables in translating the program and there will be two types of tables corresponding to the two types of symbol Fixed Tables - contain those symbols that are part of the language such as the opcodes and directives The structure of these tables can be optimized for fast access, eg entries ordered alphabetically Entries in the opcode table would associate with each symbolic opcode information such as its numeric translation, number of operands, valid addressing modes and so on Symbol Template Operand Bytes Modes Allowed ROLr r No 1 STr 1110raaa Yes 3 d,s,x,n,sf,sx,sxf STOP No 1 BR a Yes 3 i,x The fixed tables are initialized before the user program is read and do not change Variable Table - contains those symbols that the user is free to choose such as labels on instructions and data locations (think about the identifiers in a high-level language program) This table is empty before the user program is read and entries are made during Pass 1 We can depict the operation of a two-pass assembler thus: 1 It is possible to write an assembler that only requires one pass but it is tricky Reading the source program twice is rarely a problem so two passes are preferred Comp 162 Notes Page 2 of 11 February 16, 2015
3 Source Program Pass 1 Pass 2 Object Program Fixed Tables Variable Table Organization of tables In theory, it does not matter how fast the assembler performs the translation as long as it is correct But in practice we would like it to proceed as fast as possible Much of what an assembler does is look up symbols in tables so if we can make look-ups fast, the assembly operation as a whole will be Fixed tables In a fixed table we know what the entries are Some possibilities for organizing such a table are (a) order by expected frequency common symbols will be found quicker (b) order by actual frequency Start with some ordering then when an entry is used move it closer to the beginning of the table (c) order alphabetically and do a binary/logarithmic search (d) use a hash function to map each symbol to a different address in a table To look up a symbol from the program, apply the hash function and look at the contents of the corresponding address (more on hashing below) Variable tables The problem with the user-defined symbols is that we don t know how many symbols there will be or what they will be so options (a), (b) and (c) are not good It is common to use a hash-table approach making provision for dealing with two symbols that hash to the same address Comp 162 Notes Page 3 of 11 February 16, 2015
4 Hashing: a small example Hashing involves devising a function that maps the objects to be stored (in our case user-defined identifiers) onto addresses (probably indexes of a table) If the function is simple, hashing can be very fast A simple function is: ( rank(1 st character) + rank(last character) ) % table-size The following shows the value of this function for some typical identifiers assuming table addresses ranging from 0 to 9 Symbol Rank(1 st ) Rank(Last) Rank(1st)+rank(last) Rank(1 st )+Rank(last))%10 TOP N COUNT LAB LOOP When a symbol hashes to an address that is already full we can just use the next free one so after entering the examples above, our 10-entry table looks like Index Contents Value COUNT 4 LAB 5 6 TOP 7 8 N 9 LOOP Assembler operation: Pass 1 Typically, Pass 1 does the majority of the error checking of the source program In the case of Pep/8 Pass 1 does all the checking Pass 1 is also responsible for determining the value of each user-defined symbol It constructs a table of symbols and corresponding values It uses a variable called the Instruction Location Counter (ILC) to keep track of the amount of space required in memory by a translation of the program read so far If we are translating the following program by hand Comp 162 Notes Page 4 of 11 February 16, 2015
5 charo A,d charo B,d stop A: byte H B: byte I end We can figure the translation of the first line is 3 bytes (and will occupy bytes 0,1,2 in memory), the translation of the second line is also three bytes (bytes 3, 4 and 5) the translation of the third line occupies one byte (byte 6) So the symbol A is a label on byte 7 and therefore the value of the symbol A is 7 Similarly the value of B is 8 We could replace the first line of the program by charo 7,d and it would translate the same Next we will see how Pass 1 of the assembler uses the ILC to do the same Pass 1: ILC The Instruction Location Counter (ILC) is a variable used by the assembler to assign appropriate values to labels it is initialized to zero it is incremented by number of bytes required by translation of the current line When a label is encountered, its value is (usually) the current value of the ILC (See later for an exception) Example Label Program Line Bytes occupied ILC before ILC after deci N,d lda N,d asra next: deci M,d adda N,d brv end br next end: stop M: block N: block end n/a 24 The final value of the ILC is the size of the program in bytes Comp 162 Notes Page 5 of 11 February 16, 2015
6 After Pass 1 we have Symbol Value N 22 next 7 M 20 end 19 Pep/8 limitations? Large block declarations work The following assembles lda 1,i stop x: block y: block 2 end A program with 10,000 different labels also appeared to assemble correctly Pass 1: Algorithm Here is a pseudocode algorithm for Pass 1 ILC = 0 read line while ( line!= END) { if errors(line) output errormessage } else if ( notallcomment(line)) { extractsymbols (line,symbollist) updatetable (symbollist,ilc) ILC = ILC + spaceneeds(line) // see below } if (end-of-file) { output ("missing end"); exit } else read line Comp 162 Notes Page 6 of 11 February 16, 2015
7 Computing the space needs of a source line Pass 1 has to figure out how many bytes will be generated by the translation of a line (symbolic instruction or pseudo operation) so it can update the ILC correctly This can be more or less complicated In Pep/8 it is relatively straightforward Here are some examples of lines and the number of bytes its translation takes up in the object program Line Bytes byte 4 1 ascii "*" 1 asra 1 word 0 2 ascii "Hi" 2 loada 10,i 3 ascii "ABCDE" 5 (in general, the number of chars) ascii X=\t \n Result\x00 14 (might be tricky to count them!) block N N Here is another example of processing by Pass 1 (verify the ILC values for yourself) Program ILC before ILC after a: block b: byte c: word d: word 0x e: ascii f: ascii 0x g: block 0x h: byte '\x12' Error checking Here is a list of typical errors that might be detected by an assembler during Pass 1 * symbol defined more than once * instruction has incorrect number of operands * misspelled directive/opcode * invalid addressing mode * missing end * invalid constant (eg, a non-digit character in a decimal number) * missing symbol definition (detected at the end of Pass 1) * invalid string delimiter Comp 162 Notes Page 7 of 11 February 16, 2015
8 Note that while the Pep/8 assembler will detect an error in a line, the error message it gives may not be the best indicator of what the error is For example, when erroneous operand is present main: asra 2;ERROR: Comment expected Assembly operation: Pass 2 If Pass 1 does not find any errors in the source program then Pass 2 uses the symbol table constructed in Pass 1 and the table of opcode information to translate the program For example if M has a value of 15 after Pass 1 then LDA M,d Translates to = C0 00 0F LDr A d <value of symbol M> We assumed that in order to do the error checking of Pass 1 and the translation of Pass 2, the table of opcodes contains information such as the following (see Figure 52) Symbol Template Operand Bytes Modes Allowed ROLr r Yes 1 STr 1110raaa Yes 3 d,s,x,n,sf,sx,sxf STOP No 1 Error detection in Pass 2 In Pep/8 there are no errors that are detectable only in Pass 2 Here is an example of an error in another assembly languages that can be detected only in Pass 2 The fragment includes a branch instruction to a label further down the program X: jmpgt X ; jump to X if result greater than 0 Comp 162 Notes Page 8 of 11 February 16, 2015
9 Suppose that the space in the jmpgt instruction that holds the relative address of X (amount to be added to the PC to make the jump) is limited to 1 byte This means we can only jump to locations within about 127 bytes of current location During Pass 1 we do not know where X is so no error can be signaled If during Pass 2 we find that X is too far away for us to put the distance in the single byte available then we indicate an error The programmer will have to find a different way to implement this branch The equate directive The equate directive lets us associate a symbolic name with a value It is processed in Pass 1 and ignored in Pass 2 so it does not matter where it appears in the program We have seen how to figure out the values that Pass 1 will give to symbols If equate is used, just remember that it does not occupy any space in the object program Consider the following a: block 25 maxu: equate 19 count: word 0 total: word 0 tab : equate 0x09 n: block 8 t: ascii "END" w: byte 'x' Verify for yourself that after Pass 1 the symbol table with contain the following symbols and values Symbol Value a 0 maxu 19 count 25 total 27 tab 9 n 29 t 37 w 40 Comp 162 Notes Page 9 of 11 February 16, 2015
10 Assembler variant 1: Disassembler (see p 207) We cannot in general perform a reverse translation of an object program because data and instructions are indistinguishable in memory For example, in Pep/8 and subsp 2,i translates to byte h word 2 translates to A disassembler can offer two or more translations of a memory block and let the user sort out which is correct Given access to the symbol tables it may be able to make the translation a little more readable In Pep/8, a memory dump shows the (printable) ASCII characters For example, a memory dump of ; test program lda 48,i stro mess1,d deco 51,i stro mess2,d stop mess1: ascii "Adding 34 and 17 gives: \x00" mess2: ascii " Correct! \n\x00" end gives the following 0000 C D À0A A&Add E ing 34 a E nd 17 gi A ves: C F orrect! A Assembler variant 2: Cross assembler A cross assembler is just an assembler that produces an object program for a system different from the one on which it itself runs An example would be using an assembler on an Intel-based Windows system to produce code for an appliance (eg, microwave or BMW or cellphone) that uses a non-intel CPU Often used when the target machine does not have a memory large enough to hold an assembler or perhaps where the target machine only exists on paper Comp 162 Notes Page 10 of 11 February 16, 2015
11 Macros Many real assemblers allow users to declare macro instructions (macros) Here is an example macro SWAP x,y Load r1 %x Move %y, %x Store r1 %x end Now the user can use SWAP as if it were a built-in instruction SWAP P,Q While processing of macros can be built in to Pass 1, it is simpler to have macro definition and expansion handled by Pass 0 Pass 0 uses a table to store the macro definitions and outputs, for Pass 1, a copy of the source code from which macro definitions have been removed and macro calls expanded Macros can be defined for IF, ENDIF, FOR, WHILE and so on to give the assembly language a high-level flavor Reading Unfortunately, Warford does not have much on how the assembler works Section 51 has what little there is Comp 162 Notes Page 11 of 11 February 16, 2015
Wednesday, September 21, 2016
Wednesday, September 21, 2016 Topics for today More high-level to translations Compilers and Assemblers How assemblers work Symbol tables ILC Pass 1 algorithm, Error checking Pass 2 Immediate mode and
More informationWednesday, September 20, 2017
Wednesday, September 20, 2017 Topics for today More high-level to Pep/9 translations Compilers and Assemblers How assemblers work Symbol tables ILC Pass 1 algorithm, Error checking Pass 2 Immediate mode
More informationWednesday, February 15, 2017
Wednesday, February 15, 2017 Topics for today Before and after assembly: Macros, Linkers Overview of Chapter 6 Branching Unconditional Status bits and branching If statements While statements The V and
More informationWednesday, September 27, 2017
Wednesday, September 27, 2017 Topics for today Chapter 6: Mapping High-level to assembly-level The Pep/9 run-time stack (6.1) Stack-relative addressing (,s) SP manipulation Stack as scratch space Global
More informationMonday, October 17, 2016
Monday, October 17, 2016 Topics for today C functions and Pep/8 subroutines Passing parameters by reference Globals Locals Reverse Engineering II Representation of Booleans C Functions and Pep/8 Subroutines
More informationMonday, March 9, 2015
Monday, March 9, 2015 Topics for today C functions and Pep/8 subroutines Passing parameters by reference Globals Locals More reverse engineering: Pep/8 to C Representation of Booleans C Functions and Pep/8
More informationWednesday, February 7, 2018
Wednesday, February 7, 2018 Topics for today The Pep/9 memory Four example programs The loader The assembly language level (Chapter 5) Symbolic Instructions Assembler directives Immediate mode and equate
More informationExtra-credit QUIZ Pipelining -due next time-
QUIZ Pipelining A computer pipeline has 4 processors, as shown above. Each processor takes 15 ms to execute, and each instruction must go sequentially through all 4 processors. A program has 10 instructions.
More informationMonday, March 6, We have seen how to translate void functions. What about functions that return a value such as
Monday, March 6, 2017 Topics for today C functions and Pep/9 subroutines Translating functions (c) Non-void functions (d) Recursive functions Reverse Engineering: Pep/9 to C C Functions and Pep/9 Subroutines
More informationMonday, February 11, 2013
Monday, February 11, 2013 Topics for today The Pep/8 memory Four example programs The loader The assembly language level (Chapter 5) Symbolic Instructions Assembler directives Immediate mode and equate
More informationWednesday, March 12, 2014
Wednesday, March 12, 2014 Topics for today Solutions to HW #3 Arrays and Indexed Addressing Global arrays Local arrays Buffer exploit attacks Solutions to Homework #3 1. deci N,d < (a) N not defined lda
More informationWednesday, February 28, 2018
Wednesday, February 28, 2018 Topics for today C functions and Pep/9 subroutines Introduction Location of subprograms in a program Translating functions (a) Void functions (b) Void functions with parameters
More informationMonday, October 26, 2015
Monday, October 26, 2015 Topics for today Indexed branching Implementation of switch statement Reusable subroutines Indexed branching It turns out that arrays are useful in translating other language constructs,
More informationQUIZ. Name all the 4 parts of the fetch-execute cycle.
QUIZ Name all the 4 parts of the fetch-execute cycle. 1 Solution Name all the 4 parts of the fetch-execute cycle. 2 QUIZ Name two fundamental differences between magnetic drives and optical drives: 3 Solution
More informationLow-level software. Components Circuits Gates Transistors
QUIZ Pipelining A computer pipeline has 4 processors, as shown above. Each processor takes 15 ms to execute, and each instruction must go sequentially through all 4 processors. A program has 10 instructions.
More informationWednesday, October 17, 2012
Wednesday, October 17, 2012 Topics for today Arrays and Indexed Addressing Arrays as parameters of functions Multi-dimensional arrays Indexed branching Implementation of switch statement Arrays as parameters
More informationQUIZ. Name all the 4 parts of the fetch-execute cycle.
QUIZ Name all the 4 parts of the fetch-execute cycle. 1 Solution Name all the 4 parts of the fetch-execute cycle. 2 QUIZ Name two fundamental differences between magnetic drives and optical drives: 3 QUIZ
More informationThe Assembly Language Level. Chapter 7
The Assembly Language Level Chapter 7 Definitions Translator Converts user program to another language Source language Language of original program Target language Language into which source code is converted
More informationMonday, October 24, 2016
Monday, October 24, 2016 Topics for today Arrays and Indexed Addressing Arrays as parameters of functions Multi-dimensional arrays Option A: Space-minimal solution Option B: Iliffe vectors Array bound
More informationWednesday, April 22, 2015
Wednesday, April 22, 2015 Topics for today Topics for Exam 3 Process management (Chapter 8) Loader Traps Interrupts, Time-sharing Storage management (Chapter 9) Main memory (1) Uniprogramming (2) Fixed-partition
More informationWednesday, February 4, Chapter 4
Wednesday, February 4, 2015 Topics for today Introduction to Computer Systems Static overview Operation Cycle Introduction to Pep/8 Features of the system Operational cycle Program trace Categories of
More informationMonday, March 27, 2017
Monday, March 27, 2017 Topics for today Indexed branching Implementation of switch statement Reusable subroutines Indexed branching It turns out that arrays are useful in translating other language constructs,
More informationMonday, November 7, Structures and dynamic memory
Monday, November 7, 2016 Topics for today Structures Structures and dynamic memory Grammars and Languages (Chapter 7) String generation Parsing Regular languages Structures We have seen one composite data
More informationMonday, September 28, 2015
Monda, September 28, 2015 Topics for toda Chapter 6: Mapping High-level to assembl-level The Pep/8 run-time stack (6.1) Stack-relative addressing (,s) SP manipulation Stack as scratch space Global variables
More informationWednesday, February 19, 2014
Wednesda, Februar 19, 2014 Topics for toda Solutions to HW #2 Topics for Eam #1 Chapter 6: Mapping High-level to assembl-level The Pep/8 run-time stack Stack-relative addressing (,s) SP manipulation Stack
More informationChapter. Assembly Language
Chapter 5 Assembly Language Mappings The mapping from Asmb5 to ISA3 is one-toone The mapping from HOL6 to Asmb5 is oneto-many Symbols Defined by an identifier followed by a colon at the start of a statement
More informationWednesday, April 19, 2017
Wednesday, April 19, 2017 Topics for today Process management (Chapter 8) Loader Traps Interrupts, Time-sharing Storage management (Chapter 9) Main memory (1) Uniprogramming (2) Fixed-partition multiprogramming
More informationLOW-LEVEL PROGRAMMING LANAGUAGES AND PSEUDOCODE. Introduction to Computer Engineering 2015 Spring by Euiseong Seo
LOW-LEVEL PROGRAMMING LANAGUAGES AND PSEUDOCODE Introduction to Computer Engineering 2015 Spring by Euiseong Seo Where are we? Chapter 1: The Big Picture Chapter 2: Binary Values and Number Systems Chapter
More informationWednesday, March 29, Implementation of sets in an efficient manner illustrates some bit-manipulation ideas.
Wednesday, March 29, 2017 Topics for today Sets: representation and manipulation using bits Dynamic memory allocation Addressing mode summary Sets Implementation of sets in an efficient manner illustrates
More informationWednesday, March 14, 2018
Wednesday, March 14, 2018 Topics for today Arrays and Indexed Addressing Arrays as parameters of functions Multi-dimensional arrays Option A: Space-minimal solution Option B: Iliffe vectors Array bound
More informationWednesday, April
Wednesday, April 9. 2014 Topics for today Addressing mode summary Structures Structures and dynamic memory Grammars and Languages (Chapter 7) String generation Parsing Regular languages Summary of addressing
More informationMonday, March 13, 2017
Monday, March 13, 2017 Topics for today Arrays and Indexed Addressing Global arrays Local arrays Buffer exploit attacks Arrays and indexed addressing (section 6.4) So far we have looked at scalars (int,
More informationCSC 221: Computer Organization, Spring 2009
1 of 7 4/17/2009 10:52 AM Overview Schedule Resources Assignments Home CSC 221: Computer Organization, Spring 2009 Practice Exam 2 Solutions The exam will be open-book, so that you don't have to memorize
More informationMonday, November 9, 2015
Monday, November 9, 2015 Topics for today Grammars and Languages (Chapter 7) Finite State Machines Semantic actions Code generation - Overview nalysis lgorithm 1: evaluation of postfix lgorithm 2: infix
More informationWednesday, September 6, 2017
Wednesday, September 6, 2017 Topics for today Arithmetic operations and status bits Logical operators Introduction to bigger bases Encoding characters Coding in general Status bits We saw last time that
More informationWednesday, September 13, Chapter 4
Wednesday, September 13, 2017 Topics for today Introduction to Computer Systems Static overview Operation Cycle Introduction to Pep/9 Features of the system Operational cycle Program trace Categories of
More informationLow-Level Programming Languages and Pseudocode
Chapter 6 Low-Level Programming Languages and Pseudocode Chapter Goals List the operations that a computer can perform Describe the important features of the Pep/8 virtual machine Distinguish between immediate
More informationMonday, April 14, 2014
Monday, April 14, 2014 Topics for today Grammars and Languages (Chapter 7) Finite State Machines Semantic actions Code generation - Overview Analysis Algorithm 1: evaluation of postfix Algorithm 2: infix
More informationWednesday, April 16, 2014
Wednesday, pril 16, 2014 Topics for today Homework #5 solutions Code generation nalysis lgorithm 4: infix to tree Synthesis lgorithm 5: tree to code Optimization HW #5 solutions 1. lda 0,i ; for sum of
More informationThe A ssembly Assembly Language Level Chapter 7 1
The Assembly Language Level Chapter 7 1 Contemporary Multilevel Machines A six-level l computer. The support method for each level is indicated below it.2 Assembly Language Level a) It is implemented by
More informationECE 206, Fall 2001: Lab 3
ECE 206, : Lab 3 Data Movement Instructions Learning Objectives This lab will give you practice with a number of LC-2 programming constructs. In particular you will cover the following topics: - Load/store
More informationWrite "Nell" Write "N" Write "e" Write "l" Write "l" Write "N" Write 4E (hex) Write "e" W rite 65 (hex) Write "l" W rite 6C (hex)
Chapter 7 Exercises 1. What does it mean when we say that a computer is a programmable device? Programmable means that data and instructions are logically the same and are stored in the same place. The
More informationLecture #2 January 30, 2004 The 6502 Architecture
Lecture #2 January 30, 2004 The 6502 Architecture In order to understand the more modern computer architectures, it is helpful to examine an older but quite successful processor architecture, the MOS-6502.
More information3.0 Instruction Set. 3.1 Overview
3.0 Instruction Set 3.1 Overview There are 16 different P8 instructions. Research on instruction set usage was the basis for instruction selection. Each instruction has at least two addressing modes, with
More information(Refer Slide Time: 1:40)
Computer Architecture Prof. Anshul Kumar Department of Computer Science and Engineering, Indian Institute of Technology, Delhi Lecture - 3 Instruction Set Architecture - 1 Today I will start discussion
More informationA rubric for programming assignments
Fall 2012 Comp 162 Peter Smith A rubric for programming assignments Generally, half the points for a program assignment are for the Correctness of the program with respect to the specification. The other
More informationMonday, August 28, 2017
Monday, August 28, 2017 Topics for today Course in context. Course outline, requirements, grading. Administrivia: Tutoring: Department, PLTL, LRC Knowledge Survey The concept of a multi-level machine Motivations
More informationMonday, April 15, We will lead up to the Analysis and Synthesis algorithms involved by first looking at three simpler ones.
Monday, pril 15, 2013 Topics for today Code generation nalysis lgorithm 1: evaluation of postfix lgorithm 2: infix to postfix lgorithm 3: evaluation of infix lgorithm 4: infix to tree Synthesis lgorithm
More information2.2 THE MARIE Instruction Set Architecture
2.2 THE MARIE Instruction Set Architecture MARIE has a very simple, yet powerful, instruction set. The instruction set architecture (ISA) of a machine specifies the instructions that the computer can perform
More information1 Little Man Computer
1 Little Man Computer Session 5 Reference Notes CPU Architecture and Assembly 1.1 Versions Little Man Computer is a widely used simulator of a (very simple) computer. There are a number of implementations.
More informationsarm User Guide Note that a space must appear before the operation field because any word beginning in the first column is a label
sarm User Guide The sarm is program that implements an experimental CPU simulator. It is called experimental because it is not yet complete, and it also incorporates facilities that are not conventionally
More informationCS311 Lecture: The Architecture of a Simple Computer
CS311 Lecture: The Architecture of a Simple Computer Objectives: July 30, 2003 1. To introduce the MARIE architecture developed in Null ch. 4 2. To introduce writing programs in assembly language Materials:
More informationOverview COMP Microprocessors and Embedded Systems. Lecture 11: Memory Access - I. August, 2003
Overview COMP 3221 Microprocessors and Embedded Systems Memory Access in Assembly Data Structures in Assembly Lecture 11: Memory Access - I http://www.cse.unsw.edu.au/~cs3221 August, 2003 Saeid@unsw.edu.au
More informationMonday, April 9, 2018
Monday, April 9, 208 Topics for today Grammars and Languages (Chapter 7) Finite State Machines Semantic actions Code generation Overview Finite State Machines (see 7.2) If a language is regular (Type 3)
More informationCSC 220: Computer Organization Unit 12 CPU programming
College of Computer and Information Sciences Department of Computer Science CSC 220: Computer Organization Unit 12 CPU programming 1 Instruction set architectures Last time we built a simple, but complete,
More informationTopic Notes: MIPS Instruction Set Architecture
Computer Science 220 Assembly Language & Comp. Architecture Siena College Fall 2011 Topic Notes: MIPS Instruction Set Architecture vonneumann Architecture Modern computers use the vonneumann architecture.
More informationIntroduction to Programming in C Department of Computer Science and Engineering. Lecture No. #29 Arrays in C
Introduction to Programming in C Department of Computer Science and Engineering Lecture No. #29 Arrays in C (Refer Slide Time: 00:08) This session will learn about arrays in C. Now, what is the word array
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 informationAssembly Language Programming
Experiment 3 Assembly Language Programming Every computer, no matter how simple or complex, has a microprocessor that manages the computer s arithmetical, logical and control activities. A computer program
More informationSyntax of LC-3 assembly: Language elements. Instructions
LC-3 Assembly Language (Textbook Chapter 7) Assembly and assembler Machine language - binary 0001110010000110 Assembly language - symbolic ADD R6, R2, R6 ; increment index reg. Assembler is a program that
More informationLaboratory. Low-Level. Languages. Objective. References. Study simple machine language and assembly language programs.
Laboratory Low-Level 7 Languages Objective Study simple machine language and assembly language programs. References Software needed: 1) A web browser (Internet Explorer or Netscape) 2) Applet from the
More informationCS 101, Mock Computer Architecture
CS 101, Mock Computer Architecture Computer organization and architecture refers to the actual hardware used to construct the computer, and the way that the hardware operates both physically and logically
More informationWriting ARM Assembly. Steven R. Bagley
Writing ARM Assembly Steven R. Bagley Introduction Previously, looked at how the system is built out of simple logic gates Last week, started to look at the CPU Writing code in ARM assembly language Assembly
More informationWednesday, November 4, 2009
Wednesday, November 4, 2009 Topics for today Storage management Main memory (1) Uniprogramming (2) Fixed-partition multiprogramming (3) Variable-partition multiprogramming (4) Paging (5) Virtual memory
More informationBits, Words, and Integers
Computer Science 52 Bits, Words, and Integers Spring Semester, 2017 In this document, we look at how bits are organized into meaningful data. In particular, we will see the details of how integers are
More informationObjectives. Chapter 4: Control Structures I (Selection) Objectives (cont d.) Control Structures. Control Structures (cont d.) Relational Operators
Objectives Chapter 4: Control Structures I (Selection) In this chapter, you will: Learn about control structures Examine relational and logical operators Explore how to form and evaluate logical (Boolean)
More informationCS 430 Computer Architecture. C/Assembler Arithmetic and Memory Access William J. Taffe. David Patterson
CS 430 Computer Architecture C/Assembler Arithmetic and Memory Access William J. Taffe using notes of David Patterson 1 Overview C operators, operands Variables in Assembly: Registers Comments in Assembly
More informationWhen an instruction is initially read from memory it goes to the Instruction register.
CS 320 Ch. 12 Instruction Sets Computer instructions are written in mnemonics. Mnemonics typically have a 1 to 1 correspondence between a mnemonic and the machine code. Mnemonics are the assembly language
More informationWednesday, November 15, 2017
Wednesday, November 15, 2017 Topics for today Code generation Synthesis Algorithm 5: tree to code Optimizations Code generation Algorithm 5: generating assembly code Visiting all the nodes in a linked
More informationECE 3120 Lab 1 Code Entry, Assembly, and Execution
ASSEMBLY PROGRAMMING WITH CODE WARRIOR The purpose of this lab is to introduce you to the layout and structure of assembly language programs and their format, as well as to the use of the Code Warrior
More informationControl Structures. Code can be purely arithmetic assignments. At some point we will need some kind of control or decision making process to occur
Control Structures Code can be purely arithmetic assignments At some point we will need some kind of control or decision making process to occur C uses the if keyword as part of it s control structure
More informationYou ll be reading more about tools for branching in Sections 3.4, and We are skipping Sections 3.5, 3.11 and 3.13-end of chapter.
CS 1050 - Preview for Session 6 You ll be reading more about tools for branching in Sections 3.4, 3.6-3.10 and 3.12. We are skipping Sections 3.5, 3.11 and 3.13-end of chapter. Section 3.4 Logical Operators
More informationMicrocontroller Systems
µcontroller systems 1 / 43 Microcontroller Systems Engineering Science 2nd year A2 Lectures Prof David Murray david.murray@eng.ox.ac.uk www.robots.ox.ac.uk/ dwm/courses/2co Michaelmas 2014 µcontroller
More informationCSE 140L Spring 2010 Bonus Final
CSE 140L Spring 2010 Bonus Final Logistics for Bonus Final: This final should be done in individually. Use Xilinx tools version 10.1. What is due: - Report: o Submit a single report in.pdf form via email
More informationLecture 7: Examples, MARS, Arithmetic
Lecture 7: Examples, MARS, Arithmetic Today s topics: More examples MARS intro Numerical representations 1 Dealing with Characters Instructions are also provided to deal with byte-sized and half-word quantities:
More informationChapter 4: Control Structures I (Selection) Objectives. Objectives (cont d.) Control Structures. Control Structures (cont d.
Chapter 4: Control Structures I (Selection) In this chapter, you will: Objectives Learn about control structures Examine relational and logical operators Explore how to form and evaluate logical (Boolean)
More informationWednesday, November 8, 2017
Wednesday, November 8, 207 Topics for today Grammars and Languages (hapter 7) Finite State Machines Semantic actions ode generation - Overview Finite State Machines (see 7.2) If a language is regular (Type
More informationComputer Architecture
Computer Architecture Chapter 2 Instructions: Language of the Computer Fall 2005 Department of Computer Science Kent State University Assembly Language Encodes machine instructions using symbols and numbers
More informationComputer Organization & Assembly Language Programming
Computer Organization & Assembly Language Programming CSE 2312 Lecture 11 Introduction of Assembly Language 1 Assembly Language Translation The Assembly Language layer is implemented by translation rather
More information2) [ 2 marks] Both of the following statements cause the value $0300 to be stored in location $1000, but at different times. Explain the difference.
1) [ 9 marks] Write a sequence of directives for an HCS12 assembly language program that performs all of these tasks, in this order: a) Define an array called Measurements starting from memory location
More informationAPPM 2460 Matlab Basics
APPM 2460 Matlab Basics 1 Introduction In this lab we ll get acquainted with the basics of Matlab. This will be review if you ve done any sort of programming before; the goal here is to get everyone on
More informationComputer Science and Engineering 331. Midterm Examination #1. Fall Name: Solutions S.S.#:
Computer Science and Engineering 331 Midterm Examination #1 Fall 2000 Name: Solutions S.S.#: 1 41 2 13 3 18 4 28 Total 100 Instructions: This exam contains 4 questions. It is closed book and notes. Calculators
More informationLC-3 Assembly Language. (Textbook Chapter 7)"
LC-3 Assembly Language (Textbook Chapter 7)" Assembly and assembler" Machine language - binary" 0001110010000110 Assembly language - symbolic" ADD R6, R2, R6 ; increment index reg. Assembler is a program
More informationTABLE OF CONTENTS 2 CHAPTER 1 3 CHAPTER 2 4 CHAPTER 3. Algorithm Design & Problem Solving. Programming. Databases
2 CHAPTER 1 Algorithm Design & Problem Solving 3 CHAPTER 2 Programming 4 CHAPTER 3 Databases TABLE OF CONTENTS 1. ALGORITHM DESIGN & PROBLEM-SOLVING 1.1 Problem-solving & Design Every computer system is
More informationComputer Science 324 Computer Architecture Mount Holyoke College Fall Topic Notes: MIPS Instruction Set Architecture
Computer Science 324 Computer Architecture Mount Holyoke College Fall 2009 Topic Notes: MIPS Instruction Set Architecture vonneumann Architecture Modern computers use the vonneumann architecture. Idea:
More informationI ve been getting this a lot lately So, what are you teaching this term? Computer Organization. Do you mean, like keeping your computer in place?
I ve been getting this a lot lately So, what are you teaching this term? Computer Organization. Do you mean, like keeping your computer in place? here s the monitor, here goes the CPU, Do you need a class
More information4.1 COMPUTATIONAL THINKING AND PROBLEM-SOLVING
4.1 COMPUTATIONAL THINKING AND PROBLEM-SOLVING 4.1.2 ALGORITHMS ALGORITHM An Algorithm is a procedure or formula for solving a problem. It is a step-by-step set of operations to be performed. It is almost
More informationInstruction-Level Parallelism Dynamic Branch Prediction. Reducing Branch Penalties
Instruction-Level Parallelism Dynamic Branch Prediction CS448 1 Reducing Branch Penalties Last chapter static schemes Move branch calculation earlier in pipeline Static branch prediction Always taken,
More informationCS , Fall 2004 Exam 1
Andrew login ID: Full Name: CS 15-213, Fall 2004 Exam 1 Tuesday October 12, 2004 Instructions: Make sure that your exam is not missing any sheets, then write your full name and Andrew login ID on the front.
More informationStatic Checking and Intermediate Code Generation Pat Morin COMP 3002
Static Checking and Intermediate Code Generation Pat Morin COMP 3002 Static Checking and Intermediate Code Generation Parser Static Checker Intermediate Code Generator Intermediate Code Generator Parse
More information5. Control Statements
5. Control Statements This section of the course will introduce you to the major control statements in C++. These control statements are used to specify the branching in an algorithm/recipe. Control statements
More informationInstructions: Assembly Language
Chapter 2 Instructions: Assembly Language Reading: The corresponding chapter in the 2nd edition is Chapter 3, in the 3rd edition it is Chapter 2 and Appendix A and in the 4th edition it is Chapter 2 and
More informationIntroduction. C provides two styles of flow control:
Introduction C provides two styles of flow control: Branching Looping Branching is deciding what actions to take and looping is deciding how many times to take a certain action. Branching constructs: if
More informationGechstudentszone.wordpress.com
CHAPTER -2 2.1 Basic Assembler Functions: The basic assembler functions are: ASSEMBLERS-1 Translating mnemonic language code to its equivalent object code. Assigning machine addresses to symbolic labels.
More informationCS102: Variables and Expressions
CS102: Variables and Expressions The topic of variables is one of the most important in C or any other high-level programming language. We will start with a simple example: int x; printf("the value of
More informationARM Assembly Language. Programming
Outline: ARM Assembly Language the ARM instruction set writing simple programs examples Programming hands-on: writing simple ARM assembly programs 2005 PEVE IT Unit ARM System Design ARM assembly language
More informationComputer Systems and Networks. ECPE 170 Jeff Shafer University of the Pacific. MARIE Simulator
ECPE 170 Jeff Shafer University of the Pacific MARIE Simulator 2 Schedule Today MARIE assembly programming Friday 17 th MARIE assembly programming Monday 20 th No class Wednesday 22 nd MARIE assembly programming
More informationIntro to Programming. Unit 7. What is Programming? What is Programming? Intro to Programming
Intro to Programming Unit 7 Intro to Programming 1 What is Programming? 1. Programming Languages 2. Markup vs. Programming 1. Introduction 2. Print Statement 3. Strings 4. Types and Values 5. Math Externals
More information9/3/2015. Data Representation II. 2.4 Signed Integer Representation. 2.4 Signed Integer Representation
Data Representation II CMSC 313 Sections 01, 02 The conversions we have so far presented have involved only unsigned numbers. To represent signed integers, computer systems allocate the high-order bit
More informationMore advanced CPUs. August 4, Howard Huang 1
More advanced CPUs In the last two weeks we presented the design of a basic processor. The datapath performs operations on register and memory data. A control unit translates program instructions into
More information