You are on page 1of 23

Concordia University

Electrical & Computer Engineering

COEN 311
Computer Organization & Software
Introduction and Terminology
All lectures adapted from notes by
Dr. Fadi Alzhouri
Dr. Sofiene Tahar, and Dr. Anjali Agarwal
Computing machine
• Application software
– Written in high-level language
• System software
– Compiler: translates HLL code to machine code
– Operating System: service code
• Handling input/output
• Managing memory and storage
• Scheduling tasks & sharing resources
• Hardware
– Processor
– Memory
– I/O ports (Controllers)

Dr. Fadi Alzhouri 2


Hardware Organization of a Computer System

Output Input
ports ports

Dr. Fadi Alzhouri 3


Hardware Organization of a Computer System (cont.)
• Processor (CPU) performs the actual processing of data and instructions.
– Processors are characterized by:
• Word length: determines the maximum value that can be represented and transferred
directly by the CPU (8, 16, 32, 64_bit processors).
• Clock Speed: measured in gigahertz (GHz), represents the number of clock cycles the
CPU can execute per second.

– The CPU consists of:


• Arithmetic Logic Unit (ALU) that performs mathematical and logical operations.
• Control unit (CU) that controls all processes in the CPU.

• Memory is used to store data and instructions that the CPU requires
during execution.

• Input/Output Units (Ports): supports the data and information exchange


between computer and connected I/O devices.

Dr. Fadi Alzhouri 4


Software system
• Software system consists of two main components:
– Operating system (OS):
– Application software:

Dr. Fadi Alzhouri 5


Software system (cont.)
• Software system consists of two main components:
– Operating system (OS): manages and controls the computer's
hardware resources and provides a platform for running
applications (e.g. Microsoft Windows, macOS, Linux, etc.).

– Application software: programs and software packages


designed to perform specific tasks or provide specific
functionalities for users (e.g. Microsoft Word, PowerPoint,
Google Chrome, ChatGPT, etc. ).

– How do I develop an application and how does the hardware


system run it?

Dr. Fadi Alzhouri 6


Abstract Levels of Program Code

Machine-Independent
• High-level languages:
– Are designed to be closer to human language. Application programs
– Examples: C++, Java

High-level languages
• Assembly languages:
– Are low-level languages that are specific to

Machine-dependent
a particular computer architecture.
Assembly language
– Examples: x86 assembly, ARM assembly,
and MIPS assembly.
Machine language
• Machine Languages:
– Are the lowest level of programming language
and consists of binary code (0s and 1s). Hardware

Dr. Fadi Alzhouri 7


Abstract Levels of Program Code (cont.)
• High-level languages
– Level of abstraction closer to
problem domain
– Provides for productivity and
portability
• Assembly languages
– Textual representation of
instructions
• Machine languages.
– Binary digits (bits)
– Encoded instructions and data

Dr. Fadi Alzhouri 8


Compilation flow
Software Word processing; Video app, Games
• Developers can write code in
a high-level language (e.g. C++) OS Windows 11, iOS, Linux
or a low-level language
(e.g. Assembly language). High Level Language C, C++, Java, Swift

Compiler C++ compiler

Assembly Language Instructions (processor dependent)


C compiler, Intel x86, ARMv8
Swift compiler for Apple
Assembler

Linker

Binary code (processor dependent)


Machine Code Intel x86, ARMv7, ARMv8

Hardware Processor: Intel Core i9, ARMv7M

Dr. Fadi Alzhouri 9


Compilation flow (Embedded Systems)

Assembly Language using


Editor or IDE program
Myfile.asm assembly file (or source file)

Assembler
List file
Myfile.o (or .odj Object file)

Linker

Machine Code
Executable file
Hardware

Dr. Fadi Alzhouri 10


Example: Assembly code vs. Machine code

• Machine code Assembly code


Memory Hex (binary) code
addresses Labels Mnemonics Operands
0000 480F _start: ldr R0, =n
0002 6801 ldr R1, [R0]
0004 480F ldr R0, =divisor
0006 6802 ldr R2, [R0]
0008 1ADB sub R3, R3, R3
000a 4291 loop: cmp R1, R2
000c DC02 bgt endloop
000e 1A89 sub R1, R1, R2
0010 3301 add R3, R3, #1
0012 E7FA b loop
0014 4809 endloop: ldr R0, =quotient
0016 6003 str R3, [R0]
0018 4809 ldr R0, =remainder
001a 6001 str R1, [R0]
001c 4801 ldr R0, =n
001e 6001 str R1,[R0]
0020 E7FE b .
0022 0000000C n: .word 12
0026 00000005 divisor: .word 5
002a 00000000 quotient: .space 4
002e 00000000 remainder: .space 4

Dr. Fadi Alzhouri 11


Example 2: Compiling Calculator Application

• It is just a simple abstraction example but not a


real implementation.
3 + 2 =? 5

High level SW Program Compiler Assembly Program Machine Program


begin Allocate vars mov R1,3 1000 01 0011
int a,b,c; to registers
a := 3; mov R2,2 1000 10 0010
b := 2; a ↔ R1 add R3,R1,R2 1010 11 01 10
c := a+b; b ↔ R2
end c ↔ R3

Dr. Fadi Alzhouri 12


Example 2: Compiling Calculator Application (cont.)

• It is just a simple abstraction example but not a


real implementation.
3 + 2 =? 5

Registers (R1,R2,…)
Machine Program

1000 01 0011
+
1000 10 0010
1010 11 01 10
CPU Memory

Dr. Fadi Alzhouri 13


What would be the focus of this course?
• Hardware
• CPU
• Memory
• The ARM architecture
• Assembly language programming for ARM processor.

Dr. Fadi Alzhouri 14


Microprocessors and Microcontrollers
• Microprocessor
– The entire CPU is on a single IC chip called a microprocessor.
– It is designed to execute general-purpose tasks and is often used in
applications.
– They usually require external components such as memory, input/output
devices, and other peripherals to be connected externally for complete
system functionality.
– Microprocessors are often designed to be versatile and allow to building of a
wide range of computing systems (a variety of laptops, PCs, and servers).
– Examples of popular microprocessors include Intel's x86 series (e.g., Intel
Core processors) and Cortex-A processors (e.g. ARMv8-A, ARMv7-A)

Dr. Fadi Alzhouri 15


Microprocessors and Microcontrollers (cont.)
• Microcontroller = System on Chip (SoC) = Micro Controller Unit (MCU)
– is an IC that combines a microprocessor core (CPU) with peripheral
components such as memory, input/output ports, timers, and serial
communication interfaces on a single chip.
– It is designed for specific tasks and applications where real-time control, low
power consumption are crucial.
– Microcontrollers have on-chip memory (ROM, RAM, or both) for program
storage and data manipulation reducing the need for external components.
– They are commonly used in Embedded systems (e.g., Medical Devices, Smart
Home Devices, Printers, Scanners, etc.)
– Examples of popular microcontrollers include Atmel AVR, Microchip PIC
series, and ARM Cortex-M (based on ARMv7-M architecture).

Dr. Fadi Alzhouri 16


Great Ideas in computer design!: Using abstraction
• Lower-level details are hidden to offer a simpler model at higher
levels.
• RISC: Reduced Instruction Set Computers
• CISC : Complex Instruction Sets Computers
• Early computer designs used CISC architecture which have more
complex instructions
• In RISC architecture, instruction set is simpler

Dr. Fadi Alzhouri 17


RISC vs CISC architecture
Reduced Instruction Set Computers (RISC)
– Fixed instruction size and a small instruction set: performs simple instructions that
require small number of basic steps to execute.
– Requires large number of instructions to perform a given task – large code size.
– Register-Based Architecture: have a large number of general-purpose registers. This
reduces the need to access memory.
– Advantage: Low cycles per second – each instruction is executed faster in one or a
few clock cycles.
– Example: Advanced RISC Machines (ARM) processor.

Complex Instruction Set Computers (CISC)


– Complex instructions that involve large number of steps.
– Fewer instructions needed to write a code – small code size.
– Variable Instruction Length: CISC instructions can vary in length, ranging from a few
bytes to several bytes.
– Accumulator-Based: calculations are performed using a dedicated accumulator
register.
– Disadvantage: High cycles per second
– Example: Motorola 68000 processor, and Intel x86.

Dr. Fadi Alzhouri 18


Von-Neuman vs Harvard architecture

• Von-Neuman :
– A common bus for both data as well as code
memory.
– Either an instruction can be fetched from
memory or data can be read/written to/from
memory during each memory access cycle.
– Instructions and data are stored in the same
memory subsystem and share a common bus to
the processor.
• Harvard:
– Separate memories for data and instructions
– Separate buses for data and instructions
– Data and instructions can be accessed
simultaneously
– Increases efficiency

Dr. Fadi Alzhouri 19


Von-Neuman vs Harvard architecture (cont.)

Von-Neuman : Harvard:

ARM ARM ARM ARM


Cortex-M0 Cortex-M1 Cortex-M3 Cortex-M7

ARMv6-M ARMv6-M ARMv7-M ARMv7E-M

Dr. Fadi Alzhouri 20


ARM processor
• ARM: Acron RISC Machine (or Advanced
RISC Machines)

• In 2010 alone, 6.1 billion ARM-based


processor, representing 95% of
smartphones, 35% of digital televisions,
and 10% of mobile computers

• As of 2019, 150 billion ARM processors


have been produced

Dr. Fadi Alzhouri 21


ARM processor specifications
• ARM Cortex-M processor is 32-bit processor.
– R0-R12: 13 general-purpose registers
– R13: Stack pointer (SP)
– R14: Link register (LR)
– R15: Program counter (PC)
– Special registers.

• The Accessible memory space is 4GB.


– ROM (Flash memory) -> On-chip code (program) & permanent data
– RAM (SRAM) -> On-chip data is stored in heap, stack
– Peripherals mapping -> I/O, timers, USART
– External RAM _> Off-chip memory for data
– External Device
– System -> vendor-specific memory.

• It is RISC processor.

Dr. Fadi Alzhouri 22


Application Example: iPhone 14 Pro
• A16 Bionic: (Sept. 2022)
– 64-bit system on chip (SoC)
Contains one microprocessor and
– Arm Processor many microcontrollers.
– RAM: 6 GB

ifixit.com/News
Dr. Fadi Alzhouri 23

You might also like