Computer Organization and Architecture

TagsComputer science



Rapaport (2018) provides a more explicit characterization of a computational system defined as any “physical plausible implementation of anything logically equivalent to a universal Turing machine”.

[1] N. Angius, G. Primiero, and R. Turner, “The Philosophy of Computer Science (Stanford Encyclopedia of Philosophy),” Stanford.edu, 2013. [Online]. Available: https://plato.stanford.edu/entries/computer-science/. [Accessed: 30-Aug-2021]

Examples are:

Video game console.





Why do computers use binary?

Because electricity with 10 states is not the easy way. Please try to sum two numbers with electricity and ten states.

Why is random access memory called random?

“Random” means that the data does not have to be stored or read in any particular sequence. Random means lacking a definite plan, purpose, or pattern. Historically called random access memory because any data word can be accessed as easily as any other.


Computer graphics and related stuff in modern computers

Fonts are vectors when you have an operating system they are saved as files in a special location in the storage device in order to show something on the screen, you need to pass by GPU. . But, also fonts and other graphical stuff are stored in the firmware (e.g. EFI or BIOS) itself.

Fonts, UNICODE, UTF-8, ASCII, and others.

All are bits. But it is depending on who receives that word and then executes an operation or another one.

PRINTF(01001100) -> Send to Graphics Processing Unit -> PRINT A on Screen

ADD(01001100,01001100) -> Send to Proccesor -> 76 + 76 and send in register. 

Levels of the answer:

Compiler, Assembler, Binary, Hardware, Formal languages.



Where is the ASCII table located in the memory? Which type of memory do we use to store it?

How did computers understand ASCII bit? For example, 01001100 is L, not 76. Does a computer store integers according to ASCII?



MARS MIPS simulator - Missouri State University. (2017, December 07). Retrieved from https://courses.missouristate.edu/KenVollmar/MARS





Metrics units

GiB or GB 2102^{10}

Gbps 10910^9

Type Space

1 ASCII char is 1 byte

Field-programmable gate array

Hardware description language


Memory hierarchy.

When people say “memory” normally refers to RAM. However, today we have a memory hierarchy. We explain the memory layout in the RAM, register behavior, and communication between the RAM and the processor using MARS.


Little Endian, Big Endian.

Arrays, Structs (or classes), numbers, and chars. Offset.




Address vs Content.

1.3.1 Bit and Byte Order

Intel® 64 and IA-32 Architectures Software Developer Manuals. (2020, December 22). Retrieved from https://www.intel.com/content/www/us/en/developer/articles/technical/intel-sdm.html

Little Endian vs Big Endian

TODO: In the model, we must include the stored program, the “word” concept, the “program to process” process, an array, a list, and a tree. We must include a model with electronic.

A word is a sequence of O(w)O(w) bits where a processor can operate with them in constant time O(1)O(1).

How many bits does a WORD contain in 32/64 bit OS respectively? (2023, January 15). Retrieved from https://stackoverflow.com/questions/5295903/how-many-bits-does-a-word-contain-in-32-64-bit-os-respectively

So, suppose we say a word of 64 bits, it means you ca

Learn MIPS Assembly in Y Minutes. (2023, January 15). Retrieved from https://learnxinyminutes.com/docs/mips

Memory Layout —RAM layout


Heap Memory



Memory in action

Where do you locate data in memory? What looks like a memory layout with different types?

Assembler (and computer) doesn’t have types.


The most basic data type is an int. Now, we save a byte 8 bits, so the largest decimal you can save in a byte is 281=2552^8-1=255. You are going to experiment with it .data, so you don’t need registers.

constant: .byte 97
MARS with int memory layout

Assemble it and now you can observe the memory layout in the execute tab.

Congratulations! You are allocated a byte with the value 97 at the address 0x1001000.

Ok, maybe you are thinking that interesting happened in boundaries. That is a negative number and a considerable number —a number is out-of-range for a signed value. Managing negative numbers means you have to deal with 2 complements. It means when you allocate a byte with signed values, you can express 271=1272^7-1=127 positive numbers and you can express 255271=126255-2^7-1=126 negative numbers; therefore, a big number happened when you have a decimal number greater than 127127 and less than 256 (128x255128\le x\le255) —if you express a number greater than 255 your program will have strange behaviors.

127 case.

var1: .byte 127

-1 case.

var1: .byte -1

128 case.

var1: .byte 128
line 2 column 13: "128" is out-of-range for a signed value and possibly truncated

Word, byte, and word alignment TODO Registers.

But, what happened if you want to save a word?

var1: .word 100
var2: .word 300
var3: .word 140
var4: .word 5000
var5: .word 10000
var6: .word 20000
var7: .word 30000
var8: .word 60000
var9: .word 70000
var1: .word 100
var2: .word 300
var3: .word 140
var4: .word 5000
var5: .word 10000
var6: .word 20000
var7: .word 30000
var8: .word 60000
var9: .word 70000

And array?

var1: .word 1 2 3 4 5 6 7 8

You want fill out the memory

var1: .word 1 2 3 4 5 6 7 8
var2: .word 1 2 3 4 5 6 7 8
var3: .word 1 2 3 4 5 6 7 8
var4: .word 1 2 3 4 5 6 7 8
var5: .word 1 2 3 4 5 6 7 8
var6: .word 1 2 3 4 5 6 7 8
var7: .word 1 2 3 4 5 6 7 8
var8: .word 1 2 3 4 5 6 7 8
var9: .word 1 2 3 4 5 6 7 8
var10: .word 1 2 3 4 5 6 7 8
var11: .word 1 2 3 4 5 6 7 8
var12: .word 1 2 3 4 5 6 7 8
var13: .word 1 2 3 4 5 6 7 8
var14: .word 1 2 3 4 5 6 7 8
var15: .word 1 2 3 4 5 6 7 8
var16: .word 1 2 3 4 5 6 7 8

And what happened if you run out of memory?


constant: .byte 'a'


var1: .asciiz	"Hello"



var1: .word 0x20FF 0x100019AF '0'

Bit Twiddling Hacks or Bit manipulation






Builtin functions of GCC compiler


Worked examples


Getting 32 bit words out of 64-bit values in C/C++ and not worrying about endianness. (2023, January 15). Retrieved from https://stackoverflow.com/questions/2194310/getting-32-bit-words-out-of-64-bit-values-in-c-c-and-not-worrying-about-endian

Computer hierarchy

Programmer’s point of view

Domain language level

Assembly language level

Operating system machine level

Instruction set architecture level (ISA level)

Microarchitecture level

Digital logic level

User’s point of view

Application software

Operating system




What is the first process? General boot process.

A typical boot process for commercial computers.

  1. Motherboard
  1. Firmware. BIOS/EFI. Bootloader. Protected mode.
  1. Kernel.
  1. User interface.
  1. User Applications.

So, our first problem is starting after firmware.

GDT Tutorial


We know by memory hierarchy the CPU has memory, it has registers.



Procedures & The Stack


Computer performance measurement




Real Assembly. Systems based on microprocessors.

1. El universo digital del IBM PC, AT y PS/2. Ciriaco García de Celis, documentación

gratuita en la red

2. Los microprocesadores Intel. Barry B. Brey, Ed. Prentice-Hall

3. IBM PC & XT, Assembly Language. Leo. J. Scalon, Ed. Brady

4. Arquitectura, programación y diseño de sistemas basados en microprocesadores

(80x86/80186/80286). Yu-Cheng Liu y Glenn A. Gibson, Ed. Anaya

Building the computer

mortbopet. "VSRTL." GitHub, 27 Jan. 2023, github.com/mortbopet/VSRTL.

Computing with Register Machines by SICP.

Nöding, Florian. "How a CPU works: Bare metal C on my RISC-V toy CPU." 26 Jan. 2023, florian.noeding.com/posts/risc-v-toy-cpu/cpu-from-scratch.


Computer arithmetic with circuits in a datapath

Next steps

Implementation of mathematical functions in computer (no lib).

0.9 Von Neumann Model? Mauchly model?

This was teamwork, then We called EDVAC Model from “First Draft of a Report on the EDVAC”, no Von Neumann Model.

0.8 Turing model

0.10 Computer components

Store program

Evans, D. C. A. (2017, October 10). Stored Program Computer. Youtube. Retrieved from https://www.youtube.com/watch?v=j3XikkuFDSk&ab_channel=DrCraigA.Evans


At ieee dot org, B. K. k. (2020, August 25). Programmed Introduction to MIPS Assembly Language. Retrieved from https://chortle.ccsu.edu/assemblytutorial/index.html#part1


Lague, S. (2020, November 16). Exploring How Computers Work. Youtube. Retrieved from https://www.youtube.com/watch?v=QZwneRb-zqA&t=4s&ab_channel=SebastianLague