summaryrefslogtreecommitdiff
path: root/978/CH4/EX4.1/Example4_1.sce
blob: a055977361c88bf077c626567130c523941cbd8d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
//chapter-4,Example4_1,pg 488

//it is a half-adder circuit with the output 'a' and carry 'c' given by the boolean equations

b1=1//input-1

b2=1//input-2

a=bitand(b1,bitcmp(b2,1))+bitand(bitcmp(b1,1),b2)//sum

c=bitand(b1,b2)//carry

printf("sum\n")

printf("a=%.f\n",a)

printf("carry\n")

printf("c=%.f",c)