Professional Documents
Culture Documents
Numbering systems.
Converting numbers from one
number system to another
Position and non-position numbering systems.
Fundamentals of numbering systems. Decimal, binary,
hexadecimal and octal numbering system. Rules for
conversion of numbers from decimal to binary system.
Reverse conversion. Conversion of numbers in
hexadecimal system
Parallelism
Applications
Computer architectures:
Instruction set architecture
Machine organization
Hardware
Operating
systems
Performance
measurement
and evaluation
Programming
languages
Interface design
History
Computer functioning
A typical application program, widely used (like word
processor, email, spreadsheet, etc) consist of tens,
hundreds of thousands or even more lines of code
(MSOffice 2013 44 M lines of code) 1M = 18 000
pages printed text
During its functioning the program also relies on other
software like system software, including operating
system (Windows 7 40 M lines code), compilers and
assemblers
System software software providing commonly used
services to application programs
Operating systems a program that manages and
supervises the computer resources (units) during the
functioning of the computer
Computer functioning
Some of the most important functions of
the operating system are
- handling basic I/O operations
- allocating storage and memory
- sharing the resources (processor,
memory) of the computer among multiple
applications
Application software
System software
Hardware
Computer functioning
Every computer must perform arithmetic
operations
For example in assembler (a low level
programming language, unlike C, Java, C++
which are high level programming language) the
instruction:
add a, b, c
makes the computer to add 2 variables - b and
and place the result in the variable
The same action in would be: = b +
Computer functioning
The translation of a high level language program
like C, where many actions are similar to those
in mathematics, into an assembly language
program is done by a program called compiler
The reason for this is that the high level
language programs are designed to be
convenient for use of the programmers who
write down algorithms and present tasks in those
languages, while the low level languages are
designed to be close and matching as much as
possible the hardware of the computer
/processor
Computer functioning
Low level languages (assemblers) are
being also translated into machine
language (or machine code), which can be
executed by the processor of the
machine
The machine code is loaded into the
memory of the system (computer) and the
processor is told to start executing this
code
Computer functioning
Unlike in the high level languages, the operands
for the arithmetic instruction in the example
above, which can be handled by the processor
are limited by the number of registers that exist
in the particular processor
A register is (in general) a place, where
variables are kept and can be accessed by the
programmers when the computer is ready for
work
Computer functioning
In addition to arithmetic, the
computers/processors also execute other type of
instructions:
Logical (logic operations AND, OR)
Control (jump, branch)
System (system calls for error, virtual
memory)
Data transfer (moving data between registers,
memory)
Floating point
On strings (comparison, concatenation)
Graphical, etc.
Computer functioning
Modern computers function on two main principles:
- the instructions are represented as numbers (eg. in
MIPS architecture, the instruction add Rd=Rs+Rt is
presented as: 20 (rs) (rt) (rd) (shamt) (funct) )
- programs are stored in digital form in the memory of
the computer and can be written and read, just like
numbers
These principles are the fundamentals of the memory
stored program the memory stores the program for
the compiler, the corresponding assembly language
program, the text used by the compiler and the
generated machine code
C program
Compiler
Assembly language program
Assembler
Linker
Executable: Machine language program
Loader
Memory
temp = v[k];
v[k] = v[k+1];
v[k+1] = temp
}
compiler
swap:
muli $2, $5, 4
add $2, $4, $2
lw $15, 0($2)
lw $16, 4($2)
sw $16, 0($2)
sw $15, 4($2)
jr $31
assembler
00000000101000010000000000011000
00000000000110000001100000100001
10001100011000100000000000000000
10001100111100100000000000000100
10101100111100100000000000000000
10101100011000100000000000000100
00000011111000000000000000001000
Memory
Accounting program
(machine code)
editor (machine code)
Processor
C compiler
(machine code)
Data salaries
Text book
C program code
Numeral systems
In general, if p is the base, one writes a number in
the numeral system of base p as:
N = an p n + an 1 p n 1 + ... + a1 p1 + a1 p p 1 + ... + a( k 1) p ( k 1) + a k p k
a n a n 1 ... a1 a 0 a 1 ... a k
Digital presentation
Presentation in binary system
number 1521310 is 111011011011012
number 1.2010 is 1.0011001100110011[0011]2
number 1.5213 X 104 is 1.110110111011012 X 213
Electronic presentation
Easy to implement elements with two stable states
Reliable transmission on lines with noise or low reliability
0
3.3V
2.8V
0.5V
0.0V
task
What are the digits that are used by a
base p number system ( 2 positive
integer), :
) 0, 1, 2, 3, , - 1, ;
b) 0, 1, 2, 3, , - 1;
c) 0, 1, 2, 3, , - 1, , + 1;
d) 1, 2, 3, 4, , 1;
e) none of the above.
task
If 2 is a positive integer every positive number can be
represented of the form:
N = anpn + an-1pn-1 + + a1p1 + a0p0,
where ai is an integer and :
) 0 ai p-1; i = 0, , n; an 0,
and this is the only representation;
b) 0 ai p; i = 0, , n; an 0,
and this is the only representation;
c) 0 ai p-1; i = 0, , n; an 0,
and this is not the only representation.
no
quotient = 0
yes
All
reminders
are
recorded in reverse
order. The result is the
number in base system
End
Example: Convert the decimal number 53 into base 2 system and base 8
system.
Applying the algorithm above:
53 : 2 = 26 and reminder 1
25 : 2 = 13 and reminder 0
13 : 2 = 6 and reminder 1
6 : 2 = 3 and reminder 0
3 : 2 = 1 and reminder 1
1 : 2 = 0 and reminder 1
53 : 8 = 6 and reminder 5
6 : 8 = 0 and reminder 6
53 = 65(8)*
Check:
65 (8) = 6 . 81 + 5 . 80 = 48 + 5 = 53(10)
Check:
53 = 110101(2) = 1 . 25 + 1 . 24 + 0 . 23 + 1 . 22 + 0 . 21 + 1 . 20 =
= 32 + 16 + 4 + 1 = 53
The reverse conversion from -base into decimal system is done by
multiplying the digits at each position to the power of , corresponding to the
position in the number (see the examples for the check for correctness
above).
Task
Convert the decimal number 127 into base
2 system
Check by the reverse conversion (from
base to into decimal)
Reverse conversion
binary -> decimal
I approach
Example : Let the number 101011 is in binary system. To convert it
in decimal, we must sum the weights of those positions, that have
logical 1. Each digit of the binary number is multiplied by the power
of 2, that corresponds to its position of the place of the 1. The one at
the most right position has the power of 0.
101011 = 1 * 25 + 0 * 24 + 1 * 23 + 0 * 22 + 1 * 21 + 1 * 20 = 43
II approach
Example : Let the number 101011 is in binary system. To convert it
in decimal, we must sum several numbers. Each number is 2 on the
power of n, n being the consecutive number of the digit 1 in the
binary number, the one at the most right position is 0.
101011 = 20 + 21 + 23 + 25 = 1 + 2 + 8 + 32 = 43
Binary number
Octal digit
Binary number
0
1
2
3
000
001
010
011
4
5
6
7
100
101
110
111
Convert the following hexadecimal and binary numbers into the other base:
eca86420(hex)
0001
0011
0101
1001
1101
1111(two)
eca86420(hex)
1110
1100
1010
1000
0110
0100
0010
0000(two)
0111
1001
1011
1101
1111(two)
0011
0101
1011
0111
13579bdf(hex)
Convert
12610= ? 16
12610= ? 8
12610= ? 2
3016= ? 10
308= ? 10
10000000010= ? 2
Tasks (now)
What do you use the high level programming languages
for?
Under which control is the coordination and
synchronization of the various components of the
computer?
Name at least 3 basic hardware computer components
and 2 important software products give 1-2 examples..
Describe the work (main functions, principles) of the
linker (link editor) - 1 page (home)
Write down how many lines of code are 3 of the
programs which you are using (home)