Title: Ranjit%20S.%20Mann%20Exam%201%20CSE-670%20Day%20OF%20Week
1Ranjit S. MannExam 1CSE-670Day OF Week
2Day OF Week
int dayofweek (int year, int month, int day)
int a (14 - month)/12 int y
year - a int m month 12a -2
return (day y y/4 - y/100 y/400
(31m)/12) 7 / 0 Sunday, 1
Monday, 2 Tuesday, 3 Wednesday, 4
Thursday, 5 Friday, 6 Saturday /
Ranjit S. Mann
3DATA PATH
SW(1 to 8)
8
d1msel
yearin
demux4g
monthin
8
8
dayin
8
regb day
rega month
regc year
aload
bload
cload
rege y
regf day
fload
eload
regg mout
gload
regh month
hload
8
y
d
a (14 - month)/12
mout
(day y/4 - y/100 y/400 m) 7
a monthcalc
m
m month12a-2
8
day
8
year
8
8
month
m
dayOFweek
(31m)/12
m1sel
3 2 1 0
mux4g
mout
r
16
binbcd
Note century value is fixed at 2000
x7seg
4Controller
Sw1 Sw8
aload
bload
cload
controller
datapath
eload
fload
gload
hload
d1msel
month
binbcd
year
day
dayOFweek
mux4g
x7seg
5State Machine
0/1
1
0
sA
sF
Wait for BTN4 up
s3
Wait for BTN4 down yearlt SW display year
0
1
0
1
sB
Wait for BTN4 down month lt SW display month
sG
Wait for BTN4 up
1
0
1
sC
s0
Wait for BTN4 up
0
0
sD
Wait for BTN4 down day lt SW display day
display dayOFweek
a (14 - month)/12
s1
m month12a-2
1
mout (31m)/12
1
sE
s2
Wait for BTN4 up
(day y/4 - y/100 y/400 mout) 7
0