Decision Procedures. An Algorithmic Point of View. Bit-Vectors. D. Kroening O. Strichman. Version 1.0, ETH/Technion

Size: px
Start display at page:

Download "Decision Procedures. An Algorithmic Point of View. Bit-Vectors. D. Kroening O. Strichman. Version 1.0, ETH/Technion"

Transcription

1 Decision Procedures An Algorithmic Point of View Bit-Vectors D. Kroening O. Strichman ETH/Technion Version 1.0, 2007

2 Part VI Bit-Vectors

3 Outline 1 Introduction to Bit-Vector Logic 2 Syntax 3 Semantics 4 Decision procedures for Bit-Vector Logic Flattening Bit-Vector Logic Incremental flattening D. Kroening, O. Strichman (ETH/Technion) Decision Procedures Version 1.0, / 24

4 Decision Procedures for System-Level Software What kind of logic do we need for system-level software? D. Kroening, O. Strichman (ETH/Technion) Decision Procedures Version 1.0, / 24

5 Decision Procedures for System-Level Software What kind of logic do we need for system-level software? State { int created = 0; } IoCreateDevice.exit { if ($return==status SUCCESS) created = 1; } IoDeleteDevice.exit { created = 0; } fun AddDevice.exit { if (created && (pdevobj->flags & DO DEVICE INITIALIZING)!= 0) { abort "AddDevice routine failed to set " "~DO DEVICE INITIALIZING flag"; } } An Invariant of Microsoft Windows Device Drivers D. Kroening, O. Strichman (ETH/Technion) Decision Procedures Version 1.0, / 24

6 Decision Procedures for System-Level Software What kind of logic do we need for system-level software? State { int created = 0; } IoCreateDevice.exit { if ($return==status SUCCESS) created = 1; } IoDeleteDevice.exit { created = 0; } Bit-wise AND fun AddDevice.exit { if (created && (pdevobj->flags & DO DEVICE INITIALIZING)!= 0) { abort "AddDevice routine failed to set " "~DO DEVICE INITIALIZING flag"; } } An Invariant of Microsoft Windows Device Drivers D. Kroening, O. Strichman (ETH/Technion) Decision Procedures Version 1.0, / 24

7 Decision Procedures for System-Level Software What kind of logic do we need for system-level software? We need bit-vector logic with bit-wise operators, arithmetic overflow We want to scale to large programs must verify large formulas D. Kroening, O. Strichman (ETH/Technion) Decision Procedures Version 1.0, / 24

8 Decision Procedures for System-Level Software What kind of logic do we need for system-level software? We need bit-vector logic with bit-wise operators, arithmetic overflow We want to scale to large programs must verify large formulas Examples of program analysis tools that generate bit-vector formulas: CBMC SATABS F-Soft (NEC) SATURN (Stanford, Alex Aiken) EXE (Stanford, Dawson Engler, David Dill) Variants of those developed at IBM, Microsoft D. Kroening, O. Strichman (ETH/Technion) Decision Procedures Version 1.0, / 24

9 Bit-Vector Logic: Syntax formula : formula formula formula atom atom : term rel term Boolean-Identifier term[ constant ] rel : = < term : term op term identifier term constant atom?term:term term[ constant : constant ] ext( term ) op : + / << >> & D. Kroening, O. Strichman (ETH/Technion) Decision Procedures Version 1.0, / 24

10 Bit-Vector Logic: Syntax formula : formula formula formula atom atom : term rel term Boolean-Identifier term[ constant ] rel : = < term : term op term identifier term constant atom?term:term term[ constant : constant ] ext( term ) op : + / << >> & x: bit-wise negation of x ext(x): sign- or zero-extension of x x << d: left shift with distance d x y: concatenation of x and y D. Kroening, O. Strichman (ETH/Technion) Decision Procedures Version 1.0, / 24

11 Semantics Danger! (x y > 0) (x > y) Valid over R/N, but not over the bit-vectors. (Many compilers have this sort of bug) D. Kroening, O. Strichman (ETH/Technion) Decision Procedures Version 1.0, / 24

12 Width and Encoding The meaning depends on the width and encoding of the variables. D. Kroening, O. Strichman (ETH/Technion) Decision Procedures Version 1.0, / 24

13 Width and Encoding The meaning depends on the width and encoding of the variables. Typical encodings: Binary encoding l 1 x := a i 2 i i=0 Two s complement l 2 [x] := 2 n 1 a n 1 + a i 2 i i=0 But maybe also fixed-point, floating-point,... D. Kroening, O. Strichman (ETH/Technion) Decision Procedures Version 1.0, / 24

14 Examples = 200 [ ] = = -56 [ ] = 100 D. Kroening, O. Strichman (ETH/Technion) Decision Procedures Version 1.0, / 24

15 Width and Encoding Notation to clarify width and encoding: x [32]S D. Kroening, O. Strichman (ETH/Technion) Decision Procedures Version 1.0, / 24

16 Width and Encoding Notation to clarify width and encoding: x [32]S Width in bits U: unsigned binary S: signed two s complement D. Kroening, O. Strichman (ETH/Technion) Decision Procedures Version 1.0, / 24

17 Bit-vectors made formal Definition (Bit-Vector) A bit-vector is a vector of Boolean values with a given length l: b : {0,..., l 1} {0, 1} D. Kroening, O. Strichman (ETH/Technion) Decision Procedures Version 1.0, / 24

18 Bit-vectors made formal Definition (Bit-Vector) A bit-vector is a vector of Boolean values with a given length l: b : {0,..., l 1} {0, 1} The value of bit number i of x is x(i). We also write x i for x(i). b l 1 b l 2 b 2 b 1 b 0 } {{ } l bits D. Kroening, O. Strichman (ETH/Technion) Decision Procedures Version 1.0, / 24

19 λ-notation for bit-vectors λ expressions are functions without a name D. Kroening, O. Strichman (ETH/Technion) Decision Procedures Version 1.0, / 24

20 λ-notation for bit-vectors λ expressions are functions without a name Examples: The vector of length l that consists of zeros: λi {0,..., l 1}.0 A function that inverts (flips all bits in) a bit-vector: bv-invert(x) := λi {0,..., l 1}. x i A bit-wise OR: bv-or(x, y) := λi {0,..., l 1}.(x i y i ) = we now have semantics for the bit-wise operators. D. Kroening, O. Strichman (ETH/Technion) Decision Procedures Version 1.0, / 24

21 Example (x [10] y [5] )[14] x[9] D. Kroening, O. Strichman (ETH/Technion) Decision Procedures Version 1.0, / 24

22 Example This is translated as follows: (x [10] y [5] )[14] x[9] x[9] = x 9 D. Kroening, O. Strichman (ETH/Technion) Decision Procedures Version 1.0, / 24

23 Example This is translated as follows: (x [10] y [5] )[14] x[9] x[9] = x 9 (x y) = λi.(i < 5)?y i : x i 5 D. Kroening, O. Strichman (ETH/Technion) Decision Procedures Version 1.0, / 24

24 Example This is translated as follows: (x [10] y [5] )[14] x[9] x[9] = x 9 (x y) = λi.(i < 5)?y i : x i 5 (x y)[14] = (λi.(i < 5)?y i : x i 5 )(14) D. Kroening, O. Strichman (ETH/Technion) Decision Procedures Version 1.0, / 24

25 Example This is translated as follows: (x [10] y [5] )[14] x[9] x[9] = x 9 (x y) = λi.(i < 5)?y i : x i 5 (x y)[14] = (λi.(i < 5)?y i : x i 5 )(14) Final result: (λi.(i < 5)?y i : x i 5 )(14) x 9 D. Kroening, O. Strichman (ETH/Technion) Decision Procedures Version 1.0, / 24

26 Semantics for arithmetic expressions What is the output of the following program? unsigned char number = 200; number = number + 100; printf("sum: %d\n", number); D. Kroening, O. Strichman (ETH/Technion) Decision Procedures Version 1.0, / 24

27 Semantics for arithmetic expressions What is the output of the following program? unsigned char number = 200; number = number + 100; printf("sum: %d\n", number); On most architectures, this is 44! = = 100 = = 44 D. Kroening, O. Strichman (ETH/Technion) Decision Procedures Version 1.0, / 24

28 Semantics for arithmetic expressions What is the output of the following program? unsigned char number = 200; number = number + 100; printf("sum: %d\n", number); On most architectures, this is 44! = = 100 = = 44 = Bit-vector arithmetic uses modular arithmetic! D. Kroening, O. Strichman (ETH/Technion) Decision Procedures Version 1.0, / 24

29 Semantics for arithmetic expressions Semantics for addition, subtraction: a [l] + U b [l] = c [l] a + b = c mod 2 l a [l] U b [l] = c [l] a b = c mod 2 l D. Kroening, O. Strichman (ETH/Technion) Decision Procedures Version 1.0, / 24

30 Semantics for arithmetic expressions Semantics for addition, subtraction: a [l] + U b [l] = c [l] a + b = c mod 2 l a [l] U b [l] = c [l] a b = c mod 2 l a [l] + S b [l] = c [l] [a] + [b] = [c] mod 2 l a [l] S b [l] = c [l] [a] [b] = [c] mod 2 l D. Kroening, O. Strichman (ETH/Technion) Decision Procedures Version 1.0, / 24

31 Semantics for arithmetic expressions Semantics for addition, subtraction: a [l] + U b [l] = c [l] a + b = c mod 2 l a [l] U b [l] = c [l] a b = c mod 2 l a [l] + S b [l] = c [l] [a] + [b] = [c] mod 2 l a [l] S b [l] = c [l] [a] [b] = [c] mod 2 l We can even mix the encodings: a [l]u + U b [l]s = c [l]u a + [b] = c mod 2 l D. Kroening, O. Strichman (ETH/Technion) Decision Procedures Version 1.0, / 24

32 Semantics for relational operators Semantics for <,,, and so on: a [l]u < b [l]u a < b a [l]s < b [l]s [a] < [b] D. Kroening, O. Strichman (ETH/Technion) Decision Procedures Version 1.0, / 24

33 Semantics for relational operators Semantics for <,,, and so on: Mixed encodings: a [l]u < b [l]u a < b a [l]s < b [l]s [a] < [b] a [l]u < b [l]s a < [b] a [l]s < b [l]u [a] < b Note that most compilers don t support comparisons with mixed encodings. D. Kroening, O. Strichman (ETH/Technion) Decision Procedures Version 1.0, / 24

34 Complexity Satisfiability is undecidable for an unbounded width, even without arithmetic. D. Kroening, O. Strichman (ETH/Technion) Decision Procedures Version 1.0, / 24

35 Complexity Satisfiability is undecidable for an unbounded width, even without arithmetic. It is NP-complete otherwise. D. Kroening, O. Strichman (ETH/Technion) Decision Procedures Version 1.0, / 24

36 A simple decision procedure Transform Bit-Vector Logic to Propositional Logic Most commonly used decision procedure Also called bit-blasting D. Kroening, O. Strichman (ETH/Technion) Decision Procedures Version 1.0, / 24

37 A simple decision procedure Transform Bit-Vector Logic to Propositional Logic Most commonly used decision procedure Also called bit-blasting Bit-Vector Flattening 1 Convert propositional part as before 2 Add a Boolean variable for each bit of each sub-expression (term) 3 Add constraint for each sub-expression We denote the new Boolean variable for i of term t by µ(t) i. D. Kroening, O. Strichman (ETH/Technion) Decision Procedures Version 1.0, / 24

38 Bit-vector flattening What constraints do we generate for a given term? D. Kroening, O. Strichman (ETH/Technion) Decision Procedures Version 1.0, / 24

39 Bit-vector flattening What constraints do we generate for a given term? This is easy for the bit-wise operators. Example for a [l] b: l 1 (µ(t) i = (a i b i )) i=0 (read x = y over bits as x y) D. Kroening, O. Strichman (ETH/Technion) Decision Procedures Version 1.0, / 24

40 Bit-vector flattening What constraints do we generate for a given term? This is easy for the bit-wise operators. Example for a [l] b: l 1 (µ(t) i = (a i b i )) i=0 (read x = y over bits as x y) We can transform this into CNF using Tseitin s method. D. Kroening, O. Strichman (ETH/Technion) Decision Procedures Version 1.0, / 24

41 Flattening bit-vector arithmetic How to flatten a + b? D. Kroening, O. Strichman (ETH/Technion) Decision Procedures Version 1.0, / 24

42 Flattening bit-vector arithmetic How to flatten a + b? we can build a circuit that adds them! a b i FA o s Full Adder s (a + b + i ) mod 2 a b i o (a + b + i ) div 2 a b + a i + b i The full adder in CNF: (a b o) (a b i o) (a b i o) ( a b i o) ( a b i o) ( a b o) D. Kroening, O. Strichman (ETH/Technion) Decision Procedures Version 1.0, / 24

43 Flattening bit-vector arithmetic Ok, this is good for one bit! How about more? D. Kroening, O. Strichman (ETH/Technion) Decision Procedures Version 1.0, / 24

44 Flattening bit-vector arithmetic Ok, this is good for one bit! How about more? 8-Bit ripple carry adder (RCA) o a 7 b 7 a 6 b 6 a 5 b 5 a 5 b 4 a 4 b 3 a 3 b 2 a 2 b 1 a 0 b 0 FA FA FA FA FA FA FA FA s 7 s 6 s 5 s 4 s 3 s 2 s 1 s 0 i Also called carry chain adder Adds l variables Adds 6 l clauses D. Kroening, O. Strichman (ETH/Technion) Decision Procedures Version 1.0, / 24

45 Multipliers Multipliers result in very hard formulas Example: a b = c b a c x < y x > y CNF: About variables, unsolvable for current SAT solvers Similar problems with division, modulo Q: Why is this hard? D. Kroening, O. Strichman (ETH/Technion) Decision Procedures Version 1.0, / 24

46 Multipliers Multipliers result in very hard formulas Example: a b = c b a c x < y x > y CNF: About variables, unsolvable for current SAT solvers Similar problems with division, modulo Q: Why is this hard? Q: How do we fix this? D. Kroening, O. Strichman (ETH/Technion) Decision Procedures Version 1.0, / 24

47 Incremental flattening ϕ f := ϕ sk, F := ϕ sk : Boolean part of ϕ F : set of terms that are in the encoding I: set of terms that are inconsistent with the current assignment D. Kroening, O. Strichman (ETH/Technion) Decision Procedures Version 1.0, / 24

48 Incremental flattening ϕ f := ϕ sk, F := Is ϕ f SAT? ϕ sk : Boolean part of ϕ F : set of terms that are in the encoding I: set of terms that are inconsistent with the current assignment D. Kroening, O. Strichman (ETH/Technion) Decision Procedures Version 1.0, / 24

49 Incremental flattening ϕ f := ϕ sk, F := Is ϕ f SAT? No! UNSAT ϕ sk : Boolean part of ϕ F : set of terms that are in the encoding I: set of terms that are inconsistent with the current assignment D. Kroening, O. Strichman (ETH/Technion) Decision Procedures Version 1.0, / 24

50 Incremental flattening ϕ f := ϕ sk, F := Is ϕ f SAT? Yes! compute I No! UNSAT ϕ sk : Boolean part of ϕ F : set of terms that are in the encoding I: set of terms that are inconsistent with the current assignment D. Kroening, O. Strichman (ETH/Technion) Decision Procedures Version 1.0, / 24

51 Incremental flattening ϕ f := ϕ sk, F := Is ϕ f SAT? Yes! compute I No! UNSAT I = SAT ϕ sk : Boolean part of ϕ F : set of terms that are in the encoding I: set of terms that are inconsistent with the current assignment D. Kroening, O. Strichman (ETH/Technion) Decision Procedures Version 1.0, / 24

52 Incremental flattening ϕ f := ϕ sk, F := Pick F (I \ F ) F := F F ϕ f := ϕ f Constraint(F ) Is ϕ f SAT? Yes! I compute I No! UNSAT I = SAT ϕ sk : Boolean part of ϕ F : set of terms that are in the encoding I: set of terms that are inconsistent with the current assignment D. Kroening, O. Strichman (ETH/Technion) Decision Procedures Version 1.0, / 24

53 Incremental flattening Idea: add easy parts of the formula first Only add hard parts when needed ϕ f only gets stronger use an incremental SAT solver D. Kroening, O. Strichman (ETH/Technion) Decision Procedures Version 1.0, / 24

Decision Procedures in the Theory of Bit-Vectors

Decision Procedures in the Theory of Bit-Vectors Decision Procedures in the Theory of Bit-Vectors Sukanya Basu Guided by: Prof. Supratik Chakraborty Department of Computer Science and Engineering, Indian Institute of Technology, Bombay May 1, 2010 Sukanya

More information

The subset of bit-vector arithmetic that we consider is defined by the following grammar:

The subset of bit-vector arithmetic that we consider is defined by the following grammar: 6 Bit Vectors 6.1 Bit-Vector Arithmetic The design of computer systems is error-prone, and, thus, decision procedures for reasoning about such systems are highly desirable. A computer system uses bit vectors

More information

Decision Procedures. An Algorithmic Point of View. Decision Procedures for Propositional Logic. D. Kroening O. Strichman.

Decision Procedures. An Algorithmic Point of View. Decision Procedures for Propositional Logic. D. Kroening O. Strichman. Decision Procedures An Algorithmic Point of View Decision Procedures for Propositional Logic D. Kroening O. Strichman ETH/Technion Version 1.0, 2007 Part I Decision Procedures for Propositional Logic Outline

More information

Lecture Topics. Announcements. Today: Integer Arithmetic (P&H ) Next: continued. Consulting hours. Introduction to Sim. Milestone #1 (due 1/26)

Lecture Topics. Announcements. Today: Integer Arithmetic (P&H ) Next: continued. Consulting hours. Introduction to Sim. Milestone #1 (due 1/26) Lecture Topics Today: Integer Arithmetic (P&H 3.1-3.4) Next: continued 1 Announcements Consulting hours Introduction to Sim Milestone #1 (due 1/26) 2 1 Overview: Integer Operations Internal representation

More information

Chapter Two MIPS Arithmetic

Chapter Two MIPS Arithmetic Chapter Two MIPS Arithmetic Computer Organization Review Binary Representation Used for all data and instructions Fixed size values: 8, 16, 32, 64 Hexadecimal Sign extension Base and virtual machines.

More information

Arithmetic and Bitwise Operations on Binary Data

Arithmetic 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 information

COMP2611: Computer Organization. Data Representation

COMP2611: Computer Organization. Data Representation COMP2611: Computer Organization Comp2611 Fall 2015 2 1. Binary numbers and 2 s Complement Numbers 3 Bits: are the basis for binary number representation in digital computers What you will learn here: How

More information

CS 31: Introduction to Computer Systems. 03: Binary Arithmetic January 29

CS 31: Introduction to Computer Systems. 03: Binary Arithmetic January 29 CS 31: Introduction to Computer Systems 03: Binary Arithmetic January 29 WiCS! Swarthmore Women in Computer Science Slide 2 Today Binary Arithmetic Unsigned addition Subtraction Representation Signed magnitude

More information

Arithmetic Logic Unit. Digital Computer Design

Arithmetic Logic Unit. Digital Computer Design Arithmetic Logic Unit Digital Computer Design Arithmetic Circuits Arithmetic circuits are the central building blocks of computers. Computers and digital logic perform many arithmetic functions: addition,

More information

More about Binary 9/6/2016

More about Binary 9/6/2016 More about Binary 9/6/2016 Unsigned vs. Two s Complement 8-bit example: 1 1 0 0 0 0 1 1 2 7 +2 6 + 2 1 +2 0 = 128+64+2+1 = 195-2 7 +2 6 + 2 1 +2 0 = -128+64+2+1 = -61 Why does two s complement work this

More information

Binary Arithmetic. Daniel Sanchez Computer Science & Artificial Intelligence Lab M.I.T.

Binary Arithmetic. Daniel Sanchez Computer Science & Artificial Intelligence Lab M.I.T. Binary Arithmetic Daniel Sanchez Computer Science & Artificial Intelligence Lab M.I.T. MIT 6.004 Fall 2018 Reminder: Encoding Positive Integers Bit i in a binary representation (in right-to-left order)

More information

INF2270 Spring Philipp Häfliger. Lecture 4: Signed Binaries and Arithmetic

INF2270 Spring Philipp Häfliger. Lecture 4: Signed Binaries and Arithmetic INF2270 Spring 2010 Philipp Häfliger Lecture 4: Signed Binaries and Arithmetic content Karnaugh maps revisited Binary Addition Signed Binary Numbers Binary Subtraction Arithmetic Right-Shift and Bit Number

More information

Binary Adders. Ripple-Carry Adder

Binary Adders. Ripple-Carry Adder Ripple-Carry Adder Binary Adders x n y n x y x y c n FA c n - c 2 FA c FA c s n MSB position Longest delay (Critical-path delay): d c(n) = n d carry = 2n gate delays d s(n-) = (n-) d carry +d sum = 2n

More information

CSE 351: The Hardware/Software Interface. Section 2 Integer representations, two s complement, and bitwise operators

CSE 351: The Hardware/Software Interface. Section 2 Integer representations, two s complement, and bitwise operators CSE 351: The Hardware/Software Interface Section 2 Integer representations, two s complement, and bitwise operators Integer representations In addition to decimal notation, it s important to be able to

More information

Application of Propositional Logic II - How to Test/Verify my C program? Moonzoo Kim

Application of Propositional Logic II - How to Test/Verify my C program? Moonzoo Kim Application of Propositional Logic II - How to Test/Verify my C program? Moonzoo Kim 2 Solving Various Problems using SAT Solver Sudoku Puzzle Encoding 1 Encoding 2 Verify/Testing C Programs Encoding 3

More information

Register Transfer Language and Microoperations (Part 2)

Register Transfer Language and Microoperations (Part 2) Register Transfer Language and Microoperations (Part 2) Adapted by Dr. Adel Ammar Computer Organization 1 MICROOPERATIONS Computer system microoperations are of four types: Register transfer microoperations

More information

CPE300: Digital System Architecture and Design

CPE300: Digital System Architecture and Design CPE300: Digital System Architecture and Design Fall 2011 MW 17:30-18:45 CBC C316 Arithmetic Unit 10122011 http://www.egr.unlv.edu/~b1morris/cpe300/ 2 Outline Recap Fixed Point Arithmetic Addition/Subtraction

More information

ECE 2030D Computer Engineering Spring problems, 5 pages Exam Two 8 March 2012

ECE 2030D Computer Engineering Spring problems, 5 pages Exam Two 8 March 2012 Instructions: This is a closed book, closed note exam. Calculators are not permitted. If you have a question, raise your hand and I will come to you. Please work the exam in pencil and do not separate

More information

CS 31: Intro to Systems Binary Arithmetic. Kevin Webb Swarthmore College January 26, 2016

CS 31: Intro to Systems Binary Arithmetic. Kevin Webb Swarthmore College January 26, 2016 CS 31: Intro to Systems Binary Arithmetic Kevin Webb Swarthmore College January 26, 2016 Reading Quiz Unsigned Integers Suppose we had one byte Can represent 2 8 (256) values If unsigned (strictly non-negative):

More information

P( Hit 2nd ) = P( Hit 2nd Miss 1st )P( Miss 1st ) = (1/15)(15/16) = 1/16. P( Hit 3rd ) = (1/14) * P( Miss 2nd and 1st ) = (1/14)(14/15)(15/16) = 1/16

P( Hit 2nd ) = P( Hit 2nd Miss 1st )P( Miss 1st ) = (1/15)(15/16) = 1/16. P( Hit 3rd ) = (1/14) * P( Miss 2nd and 1st ) = (1/14)(14/15)(15/16) = 1/16 CODING and INFORMATION We need encodings for data. How many questions must be asked to be certain where the ball is. (cases: avg, worst, best) P( Hit 1st ) = 1/16 P( Hit 2nd ) = P( Hit 2nd Miss 1st )P(

More information

CS 31: Intro to Systems Binary Arithmetic. Martin Gagné Swarthmore College January 24, 2016

CS 31: Intro to Systems Binary Arithmetic. Martin Gagné Swarthmore College January 24, 2016 CS 31: Intro to Systems Binary Arithmetic Martin Gagné Swarthmore College January 24, 2016 Unsigned Integers Suppose we had one byte Can represent 2 8 (256) values If unsigned (strictly non-negative):

More information

CS 64 Week 1 Lecture 1. Kyle Dewey

CS 64 Week 1 Lecture 1. Kyle Dewey CS 64 Week 1 Lecture 1 Kyle Dewey Overview Bitwise operation wrap-up Two s complement Addition Subtraction Multiplication (if time) Bitwise Operation Wrap-up Shift Left Move all the bits N positions to

More information

COMP 122/L Lecture 2. Kyle Dewey

COMP 122/L Lecture 2. Kyle Dewey COMP 122/L Lecture 2 Kyle Dewey Outline Operations on binary values AND, OR, XOR, NOT Bit shifting (left, two forms of right) Addition Subtraction Twos complement Bitwise Operations Bitwise AND Similar

More information

Number Systems. Readings: , Problem: Implement simple pocket calculator Need: Display, adders & subtractors, inputs

Number Systems. Readings: , Problem: Implement simple pocket calculator Need: Display, adders & subtractors, inputs Number Systems Readings: 3-3.3.3, 3.3.5 Problem: Implement simple pocket calculator Need: Display, adders & subtractors, inputs Display: Seven segment displays Inputs: Switches Missing: Way to implement

More information

Inf2C - Computer Systems Lecture 2 Data Representation

Inf2C - 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 information

CS/COE0447: Computer Organization

CS/COE0447: Computer Organization CS/COE0447: Computer Organization and Assembly Language Chapter 3 Sangyeun Cho Dept. of Computer Science Five classic components I am like a control tower I am like a pack of file folders I am like a conveyor

More information

CS/COE0447: Computer Organization

CS/COE0447: Computer Organization Five classic components CS/COE0447: Computer Organization and Assembly Language I am like a control tower I am like a pack of file folders Chapter 3 I am like a conveyor belt + service stations I exchange

More information

But first, encode deck of cards. Integer Representation. Two possible representations. Two better representations WELLESLEY CS 240 9/8/15

But first, encode deck of cards. Integer Representation. Two possible representations. Two better representations WELLESLEY CS 240 9/8/15 Integer Representation Representation of integers: unsigned and signed Sign extension Arithmetic and shifting Casting But first, encode deck of cards. cards in suits How do we encode suits, face cards?

More information

ECE331: Hardware Organization and Design

ECE331: Hardware Organization and Design ECE331: Hardware Organization and Design Lecture 9: Binary Addition & Multiplication Adapted from Computer Organization and Design, Patterson & Hennessy, UCB Pop Quiz! Using 4 bits signed integer notation:

More information

CS/COE 0447 Example Problems for Exam 2 Spring 2011

CS/COE 0447 Example Problems for Exam 2 Spring 2011 CS/COE 0447 Example Problems for Exam 2 Spring 2011 1) Show the steps to multiply the 4-bit numbers 3 and 5 with the fast shift-add multipler. Use the table below. List the multiplicand (M) and product

More information

Basic operators, Arithmetic, Relational, Bitwise, Logical, Assignment, Conditional operators. JAVA Standard Edition

Basic 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 information

Chapter 2. Positional number systems. 2.1 Signed number representations Signed magnitude

Chapter 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 information

Introduction to CBMC: Part 1

Introduction to CBMC: Part 1 Software Engineering Institute Carnegie Mellon University Pittsburgh, PA 15213 Arie Gurfinkel, Sagar Chaki October 2, 2007 Many slides are courtesy of Daniel Kroening Bug Catching with SAT Solvers Main

More information

Bitwise Data Manipulation. Bitwise operations More on integers

Bitwise Data Manipulation. Bitwise operations More on integers Bitwise Data Manipulation Bitwise operations More on integers bitwise operators ex Bitwise operators on fixed-width bit vectors. AND & OR XOR ^ NOT ~ 01101001 & 01010101 01000001 01101001 01010101 01101001

More information

Computer Architecture and System Software Lecture 02: Overview of Computer Systems & Start of Chapter 2

Computer Architecture and System Software Lecture 02: Overview of Computer Systems & Start of Chapter 2 Computer Architecture and System Software Lecture 02: Overview of Computer Systems & Start of Chapter 2 Instructor: Rob Bergen Applied Computer Science University of Winnipeg Announcements Website is up

More information

Lecture 2: Symbolic Model Checking With SAT

Lecture 2: Symbolic Model Checking With SAT Lecture 2: Symbolic Model Checking With SAT Edmund M. Clarke, Jr. School of Computer Science Carnegie Mellon University Pittsburgh, PA 15213 (Joint work over several years with: A. Biere, A. Cimatti, Y.

More information

Le L c e t c ur u e e 2 To T p o i p c i s c t o o b e b e co c v o e v r e ed e Variables Operators

Le L c e t c ur u e e 2 To T p o i p c i s c t o o b e b e co c v o e v r e ed e Variables Operators Course Name: Advanced Java Lecture 2 Topics to be covered Variables Operators Variables -Introduction A variables can be considered as a name given to the location in memory where values are stored. One

More information

Combining forces to solve Combinatorial Problems, a preliminary approach

Combining forces to solve Combinatorial Problems, a preliminary approach Combining forces to solve Combinatorial Problems, a preliminary approach Mohamed Siala, Emmanuel Hebrard, and Christian Artigues Tarbes, France Mohamed SIALA April 2013 EDSYS Congress 1 / 19 Outline Context

More information

P( Hit 2nd ) = P( Hit 2nd Miss 1st )P( Miss 1st ) = (1/15)(15/16) = 1/16. P( Hit 3rd ) = (1/14) * P( Miss 2nd and 1st ) = (1/14)(14/15)(15/16) = 1/16

P( Hit 2nd ) = P( Hit 2nd Miss 1st )P( Miss 1st ) = (1/15)(15/16) = 1/16. P( Hit 3rd ) = (1/14) * P( Miss 2nd and 1st ) = (1/14)(14/15)(15/16) = 1/16 CODING and INFORMATION We need encodings for data. How many questions must be asked to be certain where the ball is. (cases: avg, worst, best) P( Hit 1st ) = 1/16 P( Hit 2nd ) = P( Hit 2nd Miss 1st )P(

More information

4/8/17. Admin. Assignment 5 BINARY. David Kauchak CS 52 Spring 2017

4/8/17. Admin. Assignment 5 BINARY. David Kauchak CS 52 Spring 2017 4/8/17 Admin! Assignment 5 BINARY David Kauchak CS 52 Spring 2017 Diving into your computer Normal computer user 1 After intro CS After 5 weeks of cs52 What now One last note on CS52 memory address binary

More information

Arithmetic Operations

Arithmetic Operations Arithmetic Operations Arithmetic Operations addition subtraction multiplication division Each of these operations on the integer representations: unsigned two's complement 1 Addition One bit of binary

More information

Arithmetic and Bitwise Operations on Binary Data

Arithmetic 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 information

Deductive Methods, Bounded Model Checking

Deductive Methods, Bounded Model Checking Deductive Methods, Bounded Model Checking http://d3s.mff.cuni.cz Pavel Parízek CHARLES UNIVERSITY IN PRAGUE faculty of mathematics and physics Deductive methods Pavel Parízek Deductive Methods, Bounded

More information

Arithmetic Circuits. Design of Digital Circuits 2014 Srdjan Capkun Frank K. Gürkaynak.

Arithmetic Circuits. Design of Digital Circuits 2014 Srdjan Capkun Frank K. Gürkaynak. Arithmetic Circuits Design of Digital Circuits 2014 Srdjan Capkun Frank K. Gürkaynak http://www.syssec.ethz.ch/education/digitaltechnik_14 Adapted from Digital Design and Computer Architecture, David Money

More information

Introduction to CBMC. Software Engineering Institute Carnegie Mellon University Pittsburgh, PA Arie Gurfinkel December 5, 2011

Introduction to CBMC. Software Engineering Institute Carnegie Mellon University Pittsburgh, PA Arie Gurfinkel December 5, 2011 Software Engineering Institute Carnegie Mellon University Pittsburgh, PA 15213 December 5, 2011 based on slides by Daniel Kroening Bug Catching with SAT-Solvers Main Idea: Given a program and a claim use

More information

Microcomputers. Outline. Number Systems and Digital Logic Review

Microcomputers. Outline. Number Systems and Digital Logic Review Microcomputers Number Systems and Digital Logic Review Lecture 1-1 Outline Number systems and formats Common number systems Base Conversion Integer representation Signed integer representation Binary coded

More information

Will introduce various operators supported by C language Identify supported operations Present some of terms characterizing operators

Will introduce various operators supported by C language Identify supported operations Present some of terms characterizing operators Operators Overview Will introduce various operators supported by C language Identify supported operations Present some of terms characterizing operators Operands and Operators Mathematical or logical relationships

More information

Computer Organization

Computer Organization Register Transfer Logic Department of Computer Science Missouri University of Science & Technology hurson@mst.edu 1 Note, this unit will be covered in three lectures. In case you finish it earlier, then

More information

COMPUTER ARCHITECTURE AND ORGANIZATION Register Transfer and Micro-operations 1. Introduction A digital system is an interconnection of digital

COMPUTER ARCHITECTURE AND ORGANIZATION Register Transfer and Micro-operations 1. Introduction A digital system is an interconnection of digital Register Transfer and Micro-operations 1. Introduction A digital system is an interconnection of digital hardware modules that accomplish a specific information-processing task. Digital systems vary in

More information

CHAPTER V NUMBER SYSTEMS AND ARITHMETIC

CHAPTER V NUMBER SYSTEMS AND ARITHMETIC CHAPTER V-1 CHAPTER V CHAPTER V NUMBER SYSTEMS AND ARITHMETIC CHAPTER V-2 NUMBER SYSTEMS RADIX-R REPRESENTATION Decimal number expansion 73625 10 = ( 7 10 4 ) + ( 3 10 3 ) + ( 6 10 2 ) + ( 2 10 1 ) +(

More information

Software and Hardware

Software and Hardware Software and Hardware Numbers At the most fundamental level, a computer manipulates electricity according to specific rules To make those rules produce something useful, we need to associate the electrical

More information

Experiment 7 Arithmetic Circuits Design and Implementation

Experiment 7 Arithmetic Circuits Design and Implementation Experiment 7 Arithmetic Circuits Design and Implementation Introduction: Addition is just what you would expect in computers. Digits are added bit by bit from right to left, with carries passed to the

More information

Introduction. Following are the types of operators: Unary requires a single operand Binary requires two operands Ternary requires three operands

Introduction. Following are the types of operators: Unary requires a single operand Binary requires two operands Ternary requires three operands Introduction Operators are the symbols which operates on value or a variable. It tells the compiler to perform certain mathematical or logical manipulations. Can be of following categories: Unary requires

More information

Small Formulas for Large Programs: On-line Constraint Simplification In Scalable Static Analysis

Small Formulas for Large Programs: On-line Constraint Simplification In Scalable Static Analysis Small Formulas for Large Programs: On-line Constraint Simplification In Scalable Static Analysis Isil Dillig, Thomas Dillig, Alex Aiken Stanford University Scalability and Formula Size Many program analysis

More information

Lec-6-HW-3-ALUarithmetic-SOLN

Lec-6-HW-3-ALUarithmetic-SOLN Lec-6-HW-3-ALUarithmetic-SOLN Reading, PP, Chp 2: 2.1 (Bits and datatypes) 2.2 (signed and unsigned integers) 2.3 (2's complement) 2.4 (positional notation) 2.5 (int. add/sub, signed/unsigned overflow)

More information

Chapter 4. Combinational Logic

Chapter 4. Combinational Logic Chapter 4. Combinational Logic Tong In Oh 1 4.1 Introduction Combinational logic: Logic gates Output determined from only the present combination of inputs Specified by a set of Boolean functions Sequential

More information

Spear Modular Arithmetic Format Specification Version 1.0

Spear Modular Arithmetic Format Specification Version 1.0 Spear Modular Arithmetic Format Specification Version 1.0 Domagoj Babić babic cs.ubc.ca Date: 2007/12/21 17:48:12 Revision: 1.7 1 Legal Matters Copyright (c) 2007 Domagoj Babić. Permission is granted

More information

Operators. Lecture 3 COP 3014 Spring January 16, 2018

Operators. Lecture 3 COP 3014 Spring January 16, 2018 Operators Lecture 3 COP 3014 Spring 2018 January 16, 2018 Operators Special built-in symbols that have functionality, and work on operands operand an input to an operator Arity - how many operands an operator

More information

9/2/2016. Expressions are Used to Perform Calculations. ECE 120: Introduction to Computing. Five Arithmetic Operators on Numeric Types

9/2/2016. Expressions are Used to Perform Calculations. ECE 120: Introduction to Computing. Five Arithmetic Operators on Numeric Types University of Illinois at Urbana-Champaign Dept. of Electrical and Computer Engineering ECE 120: Introduction to Computing Expressions are Used to Perform Calculations Let s talk in more detail starting

More information

1/31/2017. Expressions are Used to Perform Calculations. ECE 120: Introduction to Computing. Five Arithmetic Operators on Numeric Types

1/31/2017. Expressions are Used to Perform Calculations. ECE 120: Introduction to Computing. Five Arithmetic Operators on Numeric Types University of Illinois at Urbana-Champaign Dept. of Electrical and Computer Engineering ECE 120: Introduction to Computing Expressions are Used to Perform Calculations Let s talk in more detail starting

More information

ECE 2030B 1:00pm Computer Engineering Spring problems, 5 pages Exam Two 10 March 2010

ECE 2030B 1:00pm Computer Engineering Spring problems, 5 pages Exam Two 10 March 2010 Instructions: This is a closed book, closed note exam. Calculators are not permitted. If you have a question, raise your hand and I will come to you. Please work the exam in pencil and do not separate

More information

Binary Representations and Arithmetic

Binary Representations and Arithmetic Binary Representations and Arithmetic 9--26 Common number systems. Base : decimal Base 2: binary Base 6: hexadecimal (memory addresses) Base 8: octal (obsolete computer systems) Base 64 (email attachments,

More information

Signed Multiplication Multiply the positives Negate result if signs of operand are different

Signed Multiplication Multiply the positives Negate result if signs of operand are different Another Improvement Save on space: Put multiplier in product saves on speed: only single shift needed Figure: Improved hardware for multiplication Signed Multiplication Multiply the positives Negate result

More information

Chapter 3: Arithmetic for Computers

Chapter 3: Arithmetic for Computers Chapter 3: Arithmetic for Computers Objectives Signed and Unsigned Numbers Addition and Subtraction Multiplication and Division Floating Point Computer Architecture CS 35101-002 2 The Binary Numbering

More information

DRAM uses a single capacitor to store and a transistor to select. SRAM typically uses 6 transistors.

DRAM uses a single capacitor to store and a transistor to select. SRAM typically uses 6 transistors. Data Representation Data Representation Goal: Store numbers, characters, sets, database records in the computer. What we got: Circuit that stores 2 voltages, one for logic 0 (0 volts) and one for logic

More information

Digital Arithmetic. Digital Arithmetic: Operations and Circuits Dr. Farahmand

Digital Arithmetic. Digital Arithmetic: Operations and Circuits Dr. Farahmand Digital Arithmetic Digital Arithmetic: Operations and Circuits Dr. Farahmand Binary Arithmetic Digital circuits are frequently used for arithmetic operations Fundamental arithmetic operations on binary

More information

Binary Adders: Half Adders and Full Adders

Binary Adders: Half Adders and Full Adders Binary Adders: Half Adders and Full Adders In this set of slides, we present the two basic types of adders: 1. Half adders, and 2. Full adders. Each type of adder functions to add two binary bits. In order

More information

Computer Architecture and Organization: L04: Micro-operations

Computer Architecture and Organization: L04: Micro-operations Computer Architecture and Organization: L4: Micro-operations By: A. H. Abdul Hafez Abdul.hafez@hku.edu.tr, ah.abdulhafez@gmail.com, hafez@research.iiit.ac.in 1 Outlines 1. Arithmetic microoperation 2.

More information

36 Modular Arithmetic

36 Modular Arithmetic 36 Modular Arithmetic Tom Lewis Fall Term 2010 Tom Lewis () 36 Modular Arithmetic Fall Term 2010 1 / 10 Outline 1 The set Z n 2 Addition and multiplication 3 Modular additive inverse 4 Modular multiplicative

More information

LECTURE 3 C++ Basics Part 2

LECTURE 3 C++ Basics Part 2 LECTURE 3 C++ Basics Part 2 OVERVIEW Operators Type Conversions OPERATORS Operators are special built-in symbols that have functionality, and work on operands. Operators are actually functions that use

More information

UNIT 3 OPERATORS. [Marks- 12]

UNIT 3 OPERATORS. [Marks- 12] 1 UNIT 3 OPERATORS [Marks- 12] SYLLABUS 2 INTRODUCTION C supports a rich set of operators such as +, -, *,,

More information

Seminar in Software Engineering Presented by Dima Pavlov, November 2010

Seminar in Software Engineering Presented by Dima Pavlov, November 2010 Seminar in Software Engineering-236800 Presented by Dima Pavlov, November 2010 1. Introduction 2. Overview CBMC and SAT 3. CBMC Loop Unwinding 4. Running CBMC 5. Lets Compare 6. How does it work? 7. Conclusions

More information

1010 2?= ?= CS 64 Lecture 2 Data Representation. Decimal Numbers: Base 10. Reading: FLD Digits: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9

1010 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 information

Verilog Lab. Two s Complement Add/Sub Unit. TA: Xin-Yu Shi

Verilog Lab. Two s Complement Add/Sub Unit. TA: Xin-Yu Shi Verilog Lab. Two s Complement Add/Sub Unit TA: Xin-Yu Shi genius@access.ee.ntu.edu.tw Introduction In previous lecture, what you have learned : Complete representation for binary negative number Arithmetic

More information

New Encodings of Pseudo-Boolean Constraints into CNF

New Encodings of Pseudo-Boolean Constraints into CNF New Encodings of Pseudo-Boolean Constraints into CNF Olivier Bailleux, Yacine Boufkhad, Olivier Roussel olivier.bailleux@u-bourgogne.fr boufkhad@liafa.jussieu.fr roussel@cril.univ-artois.fr New Encodings

More information

Integer Representation

Integer Representation Integer Representation Representation of integers: unsigned and signed Modular arithmetic and overflow Sign extension Shifting and arithmetic Multiplication Casting 1 Fixed- width integer encodings Unsigned

More information

CHAPTER 4: Register Transfer Language and Microoperations

CHAPTER 4: Register Transfer Language and Microoperations CS 224: Computer Organization S.KHABET CHAPTER 4: Register Transfer Language and Microoperations Outline Register Transfer Language Register Transfer Bus and Memory Transfers Arithmetic Microoperations

More information

Arithmetic Logic Unit

Arithmetic Logic Unit Arithmetic Logic Unit A.R. Hurson Department of Computer Science Missouri University of Science & Technology A.R. Hurson 1 Arithmetic Logic Unit It is a functional bo designed to perform "basic" arithmetic,

More information

Expressions and Assignment Statements

Expressions and Assignment Statements Expressions and Assignment Statements Introduction Expressions are the fundamental means of specifying computations in a programming language To understand expression evaluation, need to be familiar with

More information

The type of all data used in a C (or C++) program must be specified

The type of all data used in a C (or C++) program must be specified The type of all data used in a C (or C++) program must be specified A data type is a description of the data being represented That is, a set of possible values and a set of operations on those values

More information

Chapter 7. Expressions and Assignment Statements (updated edition 11) ISBN

Chapter 7. Expressions and Assignment Statements (updated edition 11) ISBN Chapter 7 Expressions and Assignment Statements (updated edition 11) ISBN 0-321-49362-1 Chapter 7 Topics Introduction Arithmetic Expressions Overloaded Operators Type Conversions Relational and Boolean

More information

REGISTER TRANSFER LANGUAGE

REGISTER TRANSFER LANGUAGE REGISTER TRANSFER LANGUAGE The operations executed on the data stored in the registers are called micro operations. Classifications of micro operations Register transfer micro operations Arithmetic micro

More information

Symbolic Execution. Wei Le April

Symbolic Execution. Wei Le April Symbolic Execution Wei Le 2016 April Agenda What is symbolic execution? Applications History Interal Design: The three challenges Path explosion Modeling statements and environments Constraint solving

More information

Semester Transition Point. EE 109 Unit 11 Binary Arithmetic. Binary Arithmetic ARITHMETIC

Semester Transition Point. EE 109 Unit 11 Binary Arithmetic. Binary Arithmetic ARITHMETIC 1 2 Semester Transition Point EE 109 Unit 11 Binary Arithmetic At this point we are going to start to transition in our class to look more at the hardware organization and the low-level software that is

More information

361 div.1. Computer Architecture EECS 361 Lecture 7: ALU Design : Division

361 div.1. Computer Architecture EECS 361 Lecture 7: ALU Design : Division 361 div.1 Computer Architecture EECS 361 Lecture 7: ALU Design : Division Outline of Today s Lecture Introduction to Today s Lecture Divide Questions and Administrative Matters Introduction to Single cycle

More information

EE 109 Unit 6 Binary Arithmetic

EE 109 Unit 6 Binary Arithmetic EE 109 Unit 6 Binary Arithmetic 1 2 Semester Transition Point At this point we are going to start to transition in our class to look more at the hardware organization and the low-level software that is

More information

Fundamentals of Programming Session 2

Fundamentals 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 information

On a 64-bit CPU. Size/Range vary by CPU model and Word size.

On a 64-bit CPU. Size/Range vary by CPU model and Word size. On a 64-bit CPU. Size/Range vary by CPU model and Word size. unsigned short x; //range 0 to 65553 signed short x; //range ± 32767 short x; //assumed signed There are (usually) no unsigned floats or doubles.

More information

Parallel logic circuits

Parallel logic circuits Computer Mathematics Week 9 Parallel logic circuits College of Information cience and Engineering Ritsumeikan University last week the mathematics of logic circuits the foundation of all digital design

More information

CHW 261: Logic Design

CHW 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 information

Informatics Ingeniería en Electrónica y Automática Industrial

Informatics Ingeniería en Electrónica y Automática Industrial Informatics Ingeniería en Electrónica y Automática Industrial Operators and expressions in C Operators and expressions in C Numerical expressions and operators Arithmetical operators Relational and logical

More information

Lecture 12 Integers. Computer and Network Security 19th of December Computer Science and Engineering Department

Lecture 12 Integers. Computer and Network Security 19th of December Computer Science and Engineering Department Lecture 12 Integers Computer and Network Security 19th of December 2016 Computer Science and Engineering Department CSE Dep, ACS, UPB Lecture 12, Integers 1/40 Outline Data Types Representation Conversions

More information

EXPERIMENT #8: BINARY ARITHMETIC OPERATIONS

EXPERIMENT #8: BINARY ARITHMETIC OPERATIONS EE 2 Lab Manual, EE Department, KFUPM EXPERIMENT #8: BINARY ARITHMETIC OPERATIONS OBJECTIVES: Design and implement a circuit that performs basic binary arithmetic operations such as addition, subtraction,

More information

Chapter 7. Expressions and Assignment Statements

Chapter 7. Expressions and Assignment Statements Chapter 7 Expressions and Assignment Statements Chapter 7 Topics Introduction Arithmetic Expressions Overloaded Operators Type Conversions Relational and Boolean Expressions Short-Circuit Evaluation Assignment

More information

CS 33. Data Representation, Part 2. CS33 Intro to Computer Systems VII 1 Copyright 2018 Thomas W. Doeppner. All rights reserved.

CS 33. Data Representation, Part 2. CS33 Intro to Computer Systems VII 1 Copyright 2018 Thomas W. Doeppner. All rights reserved. CS 33 Data Representation, Part 2 CS33 Intro to Computer Systems VII 1 Copyright 2018 Thomas W. Doeppner. All rights reserved. Signed Integers Two s complement b w-1 = 0 Þ non-negative number value = b

More information

Expressions & Assignment Statements

Expressions & Assignment Statements Expressions & Assignment Statements 1 Topics Introduction Arithmetic Expressions Overloaded Operators Type Conversions Relational and Boolean Expressions Short-Circuit Evaluation Assignment Statements

More information

18733: Applied Cryptography S17. Mini Project. due April 19, 2017, 11:59pm EST. φ(x) := (x > 5) (x < 10)

18733: Applied Cryptography S17. Mini Project. due April 19, 2017, 11:59pm EST. φ(x) := (x > 5) (x < 10) 18733: Applied Cryptography S17 Mini Project due April 19, 2017, 11:59pm EST 1 SMT Solvers 1.1 Satisfiability Modulo Theory SMT (Satisfiability Modulo Theories) is a decision problem for logical formulas

More information

For Example: P: LOAD 5 R0. The command given here is used to load a data 5 to the register R0.

For Example: P: LOAD 5 R0. The command given here is used to load a data 5 to the register R0. Register Transfer Language Computers are the electronic devices which have several sets of digital hardware which are inter connected to exchange data. Digital hardware comprises of VLSI Chips which are

More information

Lab Assignment 1. Developing and Using Testbenches

Lab Assignment 1. Developing and Using Testbenches Lab Assignment 1 Developing and Using Testbenches Task 1 Develop a testbench in VHDL to test and verify the operation of an ALU (Arithmetic Logic Unit), specified using Fig. 1 and Tables 1 and 2. The ALU

More information

Bits, Words, and Integers

Bits, 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 information