Computer Systems Flashcards
convert 100110 to decimal
convert 25 to binary
38 base10
11001 base 2
convert 11010111 to hexadecimal and explain
convert B4 to deciaml
look in groups of 4 so 1101 = 13 = D and 0111 = 7 so D7base16
B = 1011 4 = 0100 so 10110100 base 2
multiply these two binary numbers, v=11010 and w =1011
in v, bits d1,d3 and d4 are equal to 1. SO add that number of 0’s to the other number and then add them together.(usually pick the number with less 1s)
vxw = 10110 + 1011000 + 10110000
1s complement and problem with it
flip the bits for 1s complement.
problem with this is thier is 2 represetnations of 0
this is solved using 2’s complement where you flip bits and add 1
Von neuman architecture
Input –> memory –> output
Control Unit ALU
Normalised representation for r = 12.25
for base 2,base 10 and base 16
for b =2
12.25 = 1100.01 to normalise it more decimal point 4 spaces left so the answer is 0.110001 x 2^4
for b = 10
12.25 = 12.25. normalise it move decimal place 2 to left so
0.1225 x 10^2
for b =16
12 = C
0.25–> 0.25 x 16 = 4 so C.4 move decimal one to left so
0.C4 x 16^1
what is decimal number 0,-1 and -16 for an exponent e of 5 bits with bias 16
0base10 = 10000 this is as 16 is bias so it = 0
-1 = 01111
-16 = 00000
Endianness
Big - endian
little-endian
ways to represent data where a single value needs more than one byte to be stored
Most significant byte first
Least significant byte first
Hamming distance
minimum number of symbols that need to be changed when transforming sequence 1 into 2.
Even partiy
odd parity
if sum of seven meaningful bits is odd than the parity bit equals 1 so that sum of the bits become even.
If sum of the seven meaningful bits is even than parity bit = 1 so that sum of all bits is odd
hamming distance of v = 11011000 and w = 01011100
2
General rule for minimum hamming distance
d(c)-1 bits can be detected
(d(c)-1)/2 bits can be corrected.
How would you check for error when transferring message a 1010 to b 1011
Use extra parity bit with even parity so
A-10100 and B-10110
We see in b there’s an odd number of 1s so we know something’s wrong
How to decode a message
Look at book
Lossless compression
Frequently occurring symbols are mapped onto shortest possible encodings and rare symbols mapped onto longer encodings
Repeated occurrence of symbols are replaced by a pointer to their first occurrence
Run length encoding
Replace each sequence of a single symbol in the file by just a single occurrence of a symbol and number representing repitions
Use rle on 1111111 000000
1[7] 0[6]
Useful for long sequence of repeated symbols
However it needs minimum number of repitions before sequence encoded
Xor gate
0110
What do all gates look like
XOR —> box with =1 in it
And —>box with & in it
Or —> box with >=1 in it (other greater = sign )
Not—> box with 1 in it and open circle to go out
NAND —> box with & in it and open circle to go out
Half adder, full adder
Half adder carries out sum of two inputs and full adder three inputs
output i0 = 10110
i1 = 11100
i2 = 00011
i3 = 10001
selector uses two bits to represent i0 to i3
if selector = 10 whats output
ez 00011
Flip flops
Devices for storage of 1 bit data
How does SR flip flops work S = set R = reset
S= 1 and R = 0 Then output = 1
S= 0 and R = 1 Then output = 0
S = 0 and R = 0 Then output does not change
if s = 1 and R = 1 is illegal state
How to draw it
S—>|1 |o ——-|&|o ——- Q
Input of Q’ becomes second input in above nand gate
input of Q becomes second input in below nand gate
R—>|1 |o ——-|&|o ——- Q’
Register
Number of flip flops bundled together that can be accessed in parallel.
can contain input output for an adder
can store memory address of current instructions.
shift register
value after shift right and left
shifts content left or right. Each step one bit is lost and 0 bit is inserted.
n/2 if right
n x2 if left shift
race condition
how to deal with race condition
gate delays to react on a changed input
use a clock as it sets pc to sleep and wake them up again.
AIDJ operations
xi = c : assignment c is any natural number
xi = x +1
xi = x-1
if xi != 0 then goto Mn ( marker n) example 02
make add function with AIDJ
00 x1 = c
01 x2 = d
02 x2 = x2+1
x1 = x1 -1
if x1 != 0 then goto 02