Variable Long-Precision Arithmetic (VLPA) for Recon Gurable

Total Page:16

File Type:pdf, Size:1020Kb

Variable Long-Precision Arithmetic (VLPA) for Recon Gurable UNIVERSITY OF CALIFORNIA Los Angeles Variable LongPrecision Arithmetic VLPA for Recongurable Copro cessor Architectures A dissertation submitted in partial satisfaction of the requirements for the degree Do ctor of Philosophy in Computer Science by Alexandre Ferreira Tenca c Copyright by Alexandre Ferreira Tenca ii The dissertation of Alexandre Ferreira Tenca is approved Prof Dr Willian Newman Prof Dr David Rennels Prof Dr Jason Cong Prof Dr Milos D Ercegovac Committee Chair University of California Los Angeles ABSTRACT OF THE DISSERTATION Variable LongPrecision Arithmetic VLPA for Recongurable Copro cessor Architectures by Alexandre Ferreira Tenca Do ctor of Philosophy in Computer Science University of California Los Angeles Professor Prof Dr Milos D Ercegovac Chair This is the abstract iii Contents Introduction The need for VLPA Alternative Arithmetic Systems Software Languages and Libraries for VLPA Existing Copro cessors for Long Precision Computations Chows VP Pro cessor CADAC Controlled Precision Decimal Arithmetic Unit Copro cessor for PascalXSC Interval Arithmetic Copro cessor JANUS VLP Copro cessor for the TM VLP Computation and RCArs Research Ob jectives Dissertation Outline Recongurable Copro cessor Architecture Recongurable Copro cessor Mo del FPGA Architecture FPGA Array Software and Hardware Interface Variable Longprecision Arithmetic VLPA Algorithms VLP Algorithms used in Software Notation and Conventions Software Algorithms for VLP Addition iv v Software Algorithms for VLP Multiplication Software Algorithms for VLP Division Software Algorithms for VLP SquareRo ot Hardware Implementation of VLP Algorithms Multiplication in VLP Copro cessors Division in VLP Copro cessors Squarero ot in VLP Copro cessors Online Algorithms for VLP Computations General Concepts and Scheduling Strategies Summary VLP Multiplier The VLP Multiplication Algorithm Data Path for VLP Multiplication Data Arrangement for Serial Computation Serial Computation of the Residual Pip elined Data Path VLP Multiplication with Precision less than m Truncation p oint to Satisfy Output Precision VLP Multiplication Algorithm for Truncated Results Gain in Performance Op erands with Dierent Precision Execution time of the VLP Multiplier VLP Divider VLP Divison Algorithm Selection Function Scaling Factor M Computation of the Scaling Factor at the Host Prescaling of Op erands vi Online Prescaler Selection Circuit Reducing the Number of Cycles Pip elined Op eration Execution Time VLP Square Ro ot VLP SquareRo ot Algorithm Convergence conditions for Output Selection Selection function with Comp ensated Residual Selection Circuit Performance Evaluation Optimization of the Number of Cycles Execution time Implementation Asp ects and Host Tasks for VLP Op eration Digit Co de Conversion CS to BS Converter BS to NR Converter Tasks Performed at the Host VLP Number Format OntheFly Conversion Digit Expansion and Compression VLP Floating Point Op erations VLP Circuit Design for FPGAs Imp ortant Design Asp ects FPGA Time Parameters Pip eline Degree Digit Representation vii Design of Arithmetic Op erators for FPGAs Addition Multiplication Summary of Results Reco der Circuit for the VLP Multiplier VLP Data Path Area Estimates Delay of Selection Functions Delay of VLP Division Selection Delay of VLP Square Ro ot Selection Performance Evaluation Copro cessor Reconguration Copro cessor Mo del Mo del Parameters Measurements Performance Estimate Copro cessor AreaTime Mo del Simulation Conclusion and Future Research Research Contributions Future Research A Timing Characteristics of the XC FPGAs B Test Program for LP Op erations using GMP version B Test Program for LP Integer Multiplication B Test Program for Floating Point Op erations C Digit radix transformation using BS Co de List of Tables Performance measurement of interval arithmetic on VPI with and without the arithmetic copro cessor VPIAC SSJa Cycle counts for various op erations in the VPIAC SSJa Recurrence equations for online arithmetic Number of stages in the digit by vector multiplier Example of highradix online division using prescaled op erands Example of VLP Square Ro ot in radix Truth table for the FS function FPGA Timing Parameters adapted from Xilinx data b o ok Areadelay of digitparallel adders in the XC Array Multiplier with Bo oth Reco ding CS output Extra area for the LinearArray Multiplier LSA Multiplication radix Area and time estimates for addition and multiplication of nbit op erators using input LUT FPGAs n Area of the VLP division selection function digits in radix n Area of the VLP square ro ot selection function digits in radix n Data Path area for digits in radix pip elined Area CLBs of the VLP data path for some values of n Maximum number of digits read simultaneously in each iteration Maximum area required to implement the VLP algorithms in FPGAs Number of cycles for longprecision op erations in GMP C pr og viii ix Signicant and exp onent manipulation time in GMP Other tasks p erformed by the host during VLP op erations Copro cessor parameters Parameters for the system Hostcopro cessor op eration Integer Multiplication Hostcopro cessor op eration VLP FP multiplication Hostcopro cessor op eration VLP FP divisionprescaling at the host Hostcopro cessor op eration VLP FP division prescaling at the copro cessor Hostcopro cessor op eration VLP FP square ro ot Variation in the Sp eedup with the Host sp eed List of Figures Solutions given to Very Long Precision Computation Copro cessor mo del Copro cessor Organization for VLP op eration Mo del for a Lo okup Table based congurable cell FPGA structure Structure of a CLB in the Xilinx XC series Linear Array of FPGAs SoftwareHardware interface for LP addition Flowchart of NewtonRaphson algorithm for division Flowchart of squarero ot computation using NewtonRaphson metho d Multiplication metho d in the VPIAC Spatial representation of online recurrence equation computation Multipleprecision computation of the recurrence equation Digitslices for VLP multiplication Online computation of the recurrence equation for multiplication Data path for VLP multiplication Digit by vector multiplier in online mo de One layer of the reduction structure Data path delays .
Recommended publications
  • Lab 7: Floating-Point Addition 0.0
    Lab 7: Floating-Point Addition 0.0 Introduction In this lab, you will write a MIPS assembly language function that performs floating-point addition. You will then run your program using PCSpim (just as you did in Lab 6). For testing, you are provided a program that calls your function to compute the value of the mathematical constant e. For those with no assembly language experience, this will be a long lab, so plan your time accordingly. Background You should be familiar with the IEEE 754 Floating-Point Standard, which is described in Section 3.6 of your book. (Hopefully you have read that section carefully!) Here we will be dealing only with single precision floating- point values, which are formatted as follows (this is also described in the “Floating-Point Representation” subsec- tion of Section 3.6 in your book): Sign Exponent (8 bits) Significand (23 bits) 31 30 29 ... 24 23 22 21 ... 0 Remember that the exponent is biased by 127, which means that an exponent of zero is represented by 127 (01111111). The exponent is not encoded using 2s-complement. The significand is always positive, and the sign bit is kept separately. Note that the actual significand is 24 bits long; the first bit is always a 1 and thus does not need to be stored explicitly. This will be important to remember when you write your function! There are several details of IEEE 754 that you will not have to worry about in this lab. For example, the expo- nents 00000000 and 11111111 are reserved for special purposes that are described in your book (representing zero, denormalized numbers and NaNs).
    [Show full text]
  • The Hexadecimal Number System and Memory Addressing
    C5537_App C_1107_03/16/2005 APPENDIX C The Hexadecimal Number System and Memory Addressing nderstanding the number system and the coding system that computers use to U store data and communicate with each other is fundamental to understanding how computers work. Early attempts to invent an electronic computing device met with disappointing results as long as inventors tried to use the decimal number sys- tem, with the digits 0–9. Then John Atanasoff proposed using a coding system that expressed everything in terms of different sequences of only two numerals: one repre- sented by the presence of a charge and one represented by the absence of a charge. The numbering system that can be supported by the expression of only two numerals is called base 2, or binary; it was invented by Ada Lovelace many years before, using the numerals 0 and 1. Under Atanasoff’s design, all numbers and other characters would be converted to this binary number system, and all storage, comparisons, and arithmetic would be done using it. Even today, this is one of the basic principles of computers. Every character or number entered into a computer is first converted into a series of 0s and 1s. Many coding schemes and techniques have been invented to manipulate these 0s and 1s, called bits for binary digits. The most widespread binary coding scheme for microcomputers, which is recog- nized as the microcomputer standard, is called ASCII (American Standard Code for Information Interchange). (Appendix B lists the binary code for the basic 127- character set.) In ASCII, each character is assigned an 8-bit code called a byte.
    [Show full text]
  • POINTER (IN C/C++) What Is a Pointer?
    POINTER (IN C/C++) What is a pointer? Variable in a program is something with a name, the value of which can vary. The way the compiler and linker handles this is that it assigns a specific block of memory within the computer to hold the value of that variable. • The left side is the value in memory. • The right side is the address of that memory Dereferencing: • int bar = *foo_ptr; • *foo_ptr = 42; // set foo to 42 which is also effect bar = 42 • To dereference ted, go to memory address of 1776, the value contain in that is 25 which is what we need. Differences between & and * & is the reference operator and can be read as "address of“ * is the dereference operator and can be read as "value pointed by" A variable referenced with & can be dereferenced with *. • Andy = 25; • Ted = &andy; All expressions below are true: • andy == 25 // true • &andy == 1776 // true • ted == 1776 // true • *ted == 25 // true How to declare pointer? • Type + “*” + name of variable. • Example: int * number; • char * c; • • number or c is a variable is called a pointer variable How to use pointer? • int foo; • int *foo_ptr = &foo; • foo_ptr is declared as a pointer to int. We have initialized it to point to foo. • foo occupies some memory. Its location in memory is called its address. &foo is the address of foo Assignment and pointer: • int *foo_pr = 5; // wrong • int foo = 5; • int *foo_pr = &foo; // correct way Change the pointer to the next memory block: • int foo = 5; • int *foo_pr = &foo; • foo_pr ++; Pointer arithmetics • char *mychar; // sizeof 1 byte • short *myshort; // sizeof 2 bytes • long *mylong; // sizeof 4 byts • mychar++; // increase by 1 byte • myshort++; // increase by 2 bytes • mylong++; // increase by 4 bytes Increase pointer is different from increase the dereference • *P++; // unary operation: go to the address of the pointer then increase its address and return a value • (*P)++; // get the value from the address of p then increase the value by 1 Arrays: • int array[] = {45,46,47}; • we can call the first element in the array by saying: *array or array[0].
    [Show full text]
  • Should Equalization Keep on Growing in an Era of Converging Fiscal Capacity?
    Should Equalization Keep On Growing in an Era of Converging Fiscal Capacity? Ben Eisen, Joel Emes and Steve Lafleur AUGUST 2017 Contents Executive Summary / i Introduction / 1 Equalization in Canada—Program Objectives and Structure / 3 GDP Growth Rate Rule—Origins and Rationale / 6 Implications of an Equalization Growth Floor Going Forward / 8 A Simple Fix for a Flaw in Policy Design—Eliminate the Equalization Growth Floor / 16 Discussion—Eliminating the Growth Floor Is a Necessary Condition for Further Reform / 20 Conclusion / 22 Annex 1: Projection Method / 23 Annex 2: Alternative Projection Scenario / 25 References / 26 About the Authors / 31 Acknowledgments / 32 Publishing Information / 33 Purpose, Funding, and Independence / 34 Supporting the Fraser Institute / 34 About the Fraser Institute / 35 Editorial Advisory Board / 36 fraserinstitute.org Eisen, Emes, and Lafleur • Should Equalization Keep On Growing? • i Executive Summary Equalization is a federal government program that aims to provide Canadians in all provinces with access to reasonably comparable public services at compar- able levels of taxation. It attempts to achieve this objective by providing cash payments from the federal government to governments of provinces that have a lower fiscal capacity—the ability to raise revenues. In recent years, largely as a result of economic slumps in several non-recipient provinces, disparities between the fiscal capacity of recipient and non-recipient provinces have gen- erally shrunk significantly. The logic of the equalization program suggests that, because the fis- cal capacities of recipient and non-recipient provinces are converging, the total equalization envelope should eventually begin to shrink as well. However, under the program’s current rules, aggregate equalization payments are required to continue growing (in line with recent national growth in GDP) in perpetuity.
    [Show full text]
  • Subtyping Recursive Types
    ACM Transactions on Programming Languages and Systems, 15(4), pp. 575-631, 1993. Subtyping Recursive Types Roberto M. Amadio1 Luca Cardelli CNRS-CRIN, Nancy DEC, Systems Research Center Abstract We investigate the interactions of subtyping and recursive types, in a simply typed λ-calculus. The two fundamental questions here are whether two (recursive) types are in the subtype relation, and whether a term has a type. To address the first question, we relate various definitions of type equivalence and subtyping that are induced by a model, an ordering on infinite trees, an algorithm, and a set of type rules. We show soundness and completeness between the rules, the algorithm, and the tree semantics. We also prove soundness and a restricted form of completeness for the model. To address the second question, we show that to every pair of types in the subtype relation we can associate a term whose denotation is the uniquely determined coercion map between the two types. Moreover, we derive an algorithm that, when given a term with implicit coercions, can infer its least type whenever possible. 1This author's work has been supported in part by Digital Equipment Corporation and in part by the Stanford-CNR Collaboration Project. Page 1 Contents 1. Introduction 1.1 Types 1.2 Subtypes 1.3 Equality of Recursive Types 1.4 Subtyping of Recursive Types 1.5 Algorithm outline 1.6 Formal development 2. A Simply Typed λ-calculus with Recursive Types 2.1 Types 2.2 Terms 2.3 Equations 3. Tree Ordering 3.1 Subtyping Non-recursive Types 3.2 Folding and Unfolding 3.3 Tree Expansion 3.4 Finite Approximations 4.
    [Show full text]
  • A Variable Precision Hardware Acceleration for Scientific Computing Andrea Bocco
    A variable precision hardware acceleration for scientific computing Andrea Bocco To cite this version: Andrea Bocco. A variable precision hardware acceleration for scientific computing. Discrete Mathe- matics [cs.DM]. Université de Lyon, 2020. English. NNT : 2020LYSEI065. tel-03102749 HAL Id: tel-03102749 https://tel.archives-ouvertes.fr/tel-03102749 Submitted on 7 Jan 2021 HAL is a multi-disciplinary open access L’archive ouverte pluridisciplinaire HAL, est archive for the deposit and dissemination of sci- destinée au dépôt et à la diffusion de documents entific research documents, whether they are pub- scientifiques de niveau recherche, publiés ou non, lished or not. The documents may come from émanant des établissements d’enseignement et de teaching and research institutions in France or recherche français ou étrangers, des laboratoires abroad, or from public or private research centers. publics ou privés. N°d’ordre NNT : 2020LYSEI065 THÈSE de DOCTORAT DE L’UNIVERSITÉ DE LYON Opérée au sein de : CEA Grenoble Ecole Doctorale InfoMaths EDA N17° 512 (Informatique Mathématique) Spécialité de doctorat :Informatique Soutenue publiquement le 29/07/2020, par : Andrea Bocco A variable precision hardware acceleration for scientific computing Devant le jury composé de : Frédéric Pétrot Président et Rapporteur Professeur des Universités, TIMA, Grenoble, France Marc Dumas Rapporteur Professeur des Universités, École Normale Supérieure de Lyon, France Nathalie Revol Examinatrice Docteure, École Normale Supérieure de Lyon, France Fabrizio Ferrandi Examinateur Professeur associé, Politecnico di Milano, Italie Florent de Dinechin Directeur de thèse Professeur des Universités, INSA Lyon, France Yves Durand Co-directeur de thèse Docteur, CEA Grenoble, France Cette thèse est accessible à l'adresse : http://theses.insa-lyon.fr/publication/2020LYSEI065/these.pdf © [A.
    [Show full text]
  • AAPM Adult Routine Head CT Protocols Document
    Adult Routine Head CT Protocols Version 2.0 3/1/2016 DISCLAIMER: TO THE EXTENT ALLOWED BY LOCAL LAW, THIS INFORMATION IS PROVIDED TO YOU BY THE AMERICAN ASSOCIATION OF PHYSICISTS IN MEDICINE, A NON-PROFIT ORGANIZATION ORGANIZED TO PROMOTE THE APPLICATION OF PHYSICS TO MEDICINE AND BIOLOGY, ENCOURAGE INTEREST AND TRAINING IN MEDICAL PHYSICS AND RELATED FIELDS ("AAPM"), 'AS IS' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, WHETHER ORAL OR WRITTEN, EXPRESS OR IMPLIED. AAPM SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OR CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, NONINFRINGEMENT AND FITNESS FOR A PARTICULAR PURPOSE. SOME JURISDICTIONS DO NOT ALLOW EXCLUSIONS OF IMPLIED WARRANTIES OR CONDITIONS, SO THE ABOVE EXCLUSION MAY NOT APPLY TO YOU. YOU MAY HAVE OTHER RIGHTS THAT VARY ACCORDING TO LOCAL LAW. TO THE EXTENT ALLOWED BY LOCAL LAW, IN NO EVENT WILL AAPM OR ITS SUBSIDIARIES, AFFILIATES OR VENDORS BE LIABLE FOR DIRECT, SPECIAL, INCIDENTAL, CONSEQUENTIAL OR OTHER DAMAGES (INCLUDING LOST PROFIT, LOST DATA, OR DOWNTIME COSTS), ARISING OUT OF THE USE, INABILITY TO USE, OR THE RESULTS OF USE OF THE PROVIDED INFORMATION, WHETHER BASED IN WARRANTY, CONTRACT, TORT OR OTHER LEGAL THEORY, AND WHETHER OR NOT ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. YOUR USE OF THE INFORMATION IS ENTIRELY AT YOUR OWN RISK. THIS INFORMATION IS NOT MEANT TO BE USED AS A SUBSTITUTE FOR THE REVIEW OF SCAN PROTOCOL PARAMETERS BY A QUALIFIED AND CERTIFIED PROFESSIONAL. USERS ARE CAUTIONED TO SEEK THE ADVICE OF A QUALIFIED AND CERTIFIED PROFESSIONAL BEFORE USING ANY PROTOCOL BASED ON THE PROVIDED INFORMATION. AAPM IS NOT RESPONSIBLE FOR A USER'S FAILURE TO VERIFY OR CONFIRM APPROPRIATE PERFORMANCE OF THE PROVIDED SCAN PARAMETERS.
    [Show full text]
  • CS31 Discussion 1E Spring 17’: Week 08
    CS31 Discussion 1E Spring 17’: week 08 TA: Bo-Jhang Ho [email protected] Credit to former TA Chelsea Ju Project 5 - Map cipher to crib } Approach 1: For each pair of positions, check two letters in cipher and crib are both identical or different } For each pair of positions pos1 and pos2, cipher[pos1] == cipher[pos2] should equal to crib[pos1] == crib[pos2] } Approach 2: Get the positions of the letter and compare } For each position pos, indexes1 = getAllPositions(cipher, pos, cipher[pos]) indexes2 = getAllPositions(crib, pos, crib[pos]) indexes1 should equal to indexes2 Project 5 - Map cipher to crib } Approach 3: Generate the mapping } We first have a mapping array char cipher2crib[128] = {‘\0’}; } Then whenever we attempt to map letterA in cipher to letterB in crib, we first check whether it violates the previous setup: } Is cipher2crib[letterA] != ‘\0’? // implies letterA has been used } Then cipher2crib[letterA] should equal to letterB } If no violation happens, } cipher2crib[letterA] = letterB; Road map of CS31 String Array Function Class Variable If / else Loops Pointer!! Cheat sheet Data type } int *a; } a is a variable, whose data type is int * } a stores an address of some integer “Use as verbs” } & - address-of operator } &b means I want to get the memory address of variable b } * - dereference operator } *c means I want to retrieve the value in address c Memory model Address Memory Contents 1000 1 byte 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 Memory model Address Memory
    [Show full text]
  • Chapter 9: Memory Management
    Chapter 9: Memory Management I Background I Swapping I Contiguous Allocation I Paging I Segmentation I Segmentation with Paging Operating System Concepts 9.1 Silberschatz, Galvin and Gagne 2002 Background I Program must be brought into memory and placed within a process for it to be run. I Input queue – collection of processes on the disk that are waiting to be brought into memory to run the program. I User programs go through several steps before being run. Operating System Concepts 9.2 Silberschatz, Galvin and Gagne 2002 Binding of Instructions and Data to Memory Address binding of instructions and data to memory addresses can happen at three different stages. I Compile time: If memory location known a priori, absolute code can be generated; must recompile code if starting location changes. I Load time: Must generate relocatable code if memory location is not known at compile time. I Execution time: Binding delayed until run time if the process can be moved during its execution from one memory segment to another. Need hardware support for address maps (e.g., base and limit registers). Operating System Concepts 9.3 Silberschatz, Galvin and Gagne 2002 Multistep Processing of a User Program Operating System Concepts 9.4 Silberschatz, Galvin and Gagne 2002 Logical vs. Physical Address Space I The concept of a logical address space that is bound to a separate physical address space is central to proper memory management. ✦ Logical address – generated by the CPU; also referred to as virtual address. ✦ Physical address – address seen by the memory unit. I Logical and physical addresses are the same in compile- time and load-time address-binding schemes; logical (virtual) and physical addresses differ in execution-time address-binding scheme.
    [Show full text]
  • Warner Sumpter, Usmc Force Recon 1967 - 68
    WARNER SUMPTER, USMC FORCE RECON 1967 - 68 Warner: My name is Warner Sumpter, that’s W-A-R-N-E-R S-U-M-P-T-E-R. I was in the United States Marine Corps assigned to 1st Force Reconnaissance Company in Vietnam assigned to the 3rd marine division on the DMZ and then back down to the Da Nang later on in my tour for the 1st marine division and I was there from July of 1966 through June of 1967. I was born on November 11, 1944 and I left Severna Park High School in November of 1962. The reason how I got into the military was that I was working and going to school at the same time and we had the Cuban missile crisis speech. I was watching that of course being covered by the news and John f. Kennedy gave his Cuban missile crisis speech. When he did as a young man who had been influenced by many neighbors and family members and friends who were World War 2 and Korean veterans I was afraid that my generation’s war would pass me by. I made the very unwise decision of leaving high school and I enlisted in the Marine Corps. I was 18 on November 11th which was a Saturday of 1962 on a Monday morning of the 13th I was sworn into the US Customs house in downtown Baltimore to the Marine Corps. From there I went into the Marine Corps serving first as [inaudible 00:01:52] because I turned down anything I qualified for.
    [Show full text]
  • Prisma User Guide
    Revision Date: 9/23/2021 Siemens Prisma 3T MRI Scanner User Guide Ahmanson-Lovelace Brain Mapping Center University of California, Los Angeles Revision Date: 9/23/2021 BMC Contacts ............................................................................................................................... 1 Scanner Operation ........................................................................................................................ 2 • How to do a “Standby” Reboot ............................................................................... 2 • How to Turn Off the MRI Scanner/Computer (Full Shutdown)............................. 3 • How to Turn on the MRI Scanner/Computer ......................................................... 4 • MR Scanner Error Save Log ................................................................................... 4 • How to Check the System Manager........................................................................ 5 • How to Restart the Coldhead .................................................................................. 6 • How to Reboot the Chiller ...................................................................................... 7 Re-import DICOM Data .............................................................................................................. 8 • How to Map a Dicom Network Folder on the Scanner Console ............................ 8 Export and Save Raw Data Files (.RDA and Raw).................................................................... 9 • How to
    [Show full text]
  • Objective-C Internals Realmac Software
    André Pang Objective-C Internals Realmac Software 1 Nice license plate, eh? In this talk, we peek under the hood and have a look at Objective-C’s engine: how objects are represented in memory, and how message sending works. What is an object? 2 To understand what an object really is, we dive down to the lowest-level of the object: what it actually looks like in memory. And to understand Objective-C’s memory model, one must first understand C’s memory model… What is an object? int i; i = 0xdeadbeef; de ad be ef 3 Simple example: here’s how an int is represented in C on a 32-bit machine. 32 bits = 4 bytes, so the int might look like this. What is an object? int i; i = 0xdeadbeef; ef be af de 4 Actually, the int will look like this on Intel-Chip Based Macs (or ICBMs, as I like to call them), since ICBMs are little- endian. What is an object? int i; i = 0xdeadbeef; de ad be ef 5 … but for simplicity, we’ll assume memory layout is big-endian for this presentation, since it’s easier to read. What is an object? typedef struct _IntContainer { int i; } IntContainer; IntContainer ic; ic.i = 0xdeadbeef; de ad be ef 6 This is what a C struct that contains a single int looks like. In terms of memory layout, a struct with a single int looks exactly the same as just an int[1]. This is very important, because it means that you can cast between an IntContainer and an int for a particular value with no loss of precision.
    [Show full text]