Calendar subsystem
4 – Combinational Logic Design Examples
Determine number of days in a month (to control watch display)
- used in controlling the display of a wrist-watch LCD screen
- inputs: month, leap year flag
- outputs: number of days
Use software implementationto help understand the problem
integer number_of_days ( month, leap_year_flag) {
switch (month) {
case 1: return (31);
case 2: if (leap_year_flag == 1) then return (29) else return (28);
case 3: return (31);
case 4: return (30);
case 5: return (31);
case 6: return (30);
case 7: return (31);
case 8: return (31);
case 9: return (30);
case 10: return (31);
case 11: return (30);
case 12: return (31);
default: return (0);
}