0% found this document useful (0 votes)
25 views

Oware Calculus Primer

Oware, SimpleAfrican Calculator

Uploaded by

Philip Gadugah
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
25 views

Oware Calculus Primer

Oware, SimpleAfrican Calculator

Uploaded by

Philip Gadugah
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 26

Foundations of

Computing: case of
Oware/Awale
Number representation
(1 bit)
Binary Number

0 0
1 -1
Number representation
(3 bits)
Binary Number

011 3
010 2
001 1 2s complement ie
000 0 complement number
111 -1 add 1
110 -2 to get negative
101 -3
100 -4
2s complement
(3 bits)
(-3): -(-3):

111 111
~-011 ~-101
——— ———
100 010
+1 +1
——— ———
101 011
===== =====
Oware number
representation
Oware Number
4 4
3 3
2 2
1 1
0 0 10s complement
9 -1
8 -2
7 -3
6 -4
5 -5
10s complement
(-1957): -(-1957):

999999 999999
~-1957 ~-998043
——— ———
998042 1956
+1 +1
——— ———
998043 1957
===== =====
Description of Oware board
Source

d(6,s) d(5,s) d(1,s)

d(6,r) d(5,r) d(1,r)

Results
W is work area, the left hole and P, is pool of stones on right
Read only input Oware
Source
<S6,S5,S4,S3,S2,S1> Architecture

Pool
Function Work
LC Of
Code Area
Stones

Read/Write input/output
Results
<R6,R5,R4,R3,R2,R1>
Conventions

• Results are by convention in second row

• Can cascade operations, follow one operation with


another
OWARE PRIMITIVES

d(6,*),..,d(1,*)<-n Constant

W</- d(i,s) Copy

W<-d(i,r) Move

d(i,r)<- excess_10(W) If W>=10

W<-1

P<-9

d(i,r)<-W Else
Oware Instruction hierarchy
DIV MUL

SUB Counter

NEG

ADD DIFF

Primitives
ADD (S,R)
W=0
P=large
For i= 1 to 6 {
W</- d(i,s)
W<-d(i,r)
If |W|>=10 {
d(i,r)<- excess_10(W)
W<-1
P<-9}
else {
d(i,r)<-W}
}
DIFF (n6,n5,..,n1) ~ complement
W=0
P=large

d(6,s),..,d(1,s)= 999 999

d(6,r),..,d(1,r)= n6,n5,..,n2,n1

for i=1 to 6 {
d(i,r)= (d(i,s)-d(i,r))
}
NEGATE (n6,n5,..,n1) ~ negative
W=0
P=large

DIFF(n6,n5,..,n2,n1)

d(6,s),..,d(1,s)<-1

ADD (S,R)
SUBTRACT (A,B) ~ A-B

W=0
P=large

NEGATE(B)

d(6,s),..,d(1,s)<-A

ADD (S,R)
Sign (R) ie when negative

If d(6,r) in {5,6,7,8,9} then {


sign=1
}
Else {
sign=0
}
MULTIPLY (A,B)
Down counter Summation
Board1 Board2
S=999 999 S=A
R=B R=0
Do forever {
With Board1 {
If r==0 then terminate
Else ADD (S,R)
}
With Board2 {
ADD (S,R)
}
}
DIVIDE (A,B) ie A/B
Up counter Summation
Board1 Board2
S=1 S=-B
R=0 R=A
Do forever {
With Board2 {
ADD(S,R)
If sign (R) then terminate
}
With Board1 {
ADD (S,R)
}
}
Conditionals
A>B (A-B) => +ve

A>=B (A-B) => 0, +ve

A<B (A-B) => -ve

A<=B (A-B) => -ve,0

A=B A-B) => 0


Stored Program model

PC->

Code

Operand

A6 A1
W P CPU
B6 B1

Result
Oware instruction format

Opcode <6:5> Operand <4:1>


Opcode Operation Result
00 NOP Nothing
01 LOADR n r<-n, pc<-pc+1
02 LOADS n s<-n, pc<-pc+1
03 STORER n (n)<-r, pc<-pc+1
04 STORES n (n)<-s, pc<-pc+1
05 ADD r<-s+r, pc<-pc+1
06 NEG r<- -s, pc<-pc+1
07 SUB r<- r-s, pc<-pc+1
08 MUL r<- r*s, pc<-pc+1
09 DIV r<- s/r, pc<-pc+1
10 BR n pc<-pc+n
11 BP n If r +ve then pc<-pc+n
12 BN n If r -ve then pc<-pc+n
13 BZ n If r ==0 then pc<-pc+n
XX Reserved
99 HALT
Example program (a+b*c)

LOADS b
LOADR. c
MUL
LOADS a
ADD
Conclusion
• Scientific Cultural heritage study

• Why don’t Africans use Oware as a calculator

• We teach this to first year computer science


students

• Effective means of introducing numbers and


operations

You might also like