1 / 5

Ranjit S. Mann Exam 1 CSE-670 Day OF Week

Ranjit S. Mann Exam 1 CSE-670 Day OF Week. Day OF Week. int dayofweek (int year, int month, int day) { int a = (14 - month)/12; int y = year - a; int m = month + 12*a -2; return (day + y + y/4 - y/100 + y/400 + (31*m)/12) % 7; }

necia
Download Presentation

Ranjit S. Mann Exam 1 CSE-670 Day OF Week

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Ranjit S. MannExam 1CSE-670Day OF Week

  2. Day OF Week int dayofweek (int year, int month, int day) { int a = (14 - month)/12; int y = year - a; int m = month + 12*a -2; return (day + y + y/4 - y/100 + y/400 + (31*m)/12) % 7; } /* 0 = Sunday, 1 = Monday, 2 = Tuesday, 3 = Wednesday, 4 = Thursday, 5 = Friday, 6 = Saturday */ Ranjit S. Mann

  3. DATA PATH SW(1 to 8) 8 d1msel yearin demux4g monthin 8 8 dayin 8 cload regc year bload regb day rega month aload eload rege y fload regf day gload regg mout hload regh month y 8 d a = (14 - month)/12 mout (day + y/4 - y/100 + y/400 + m) % 7 m a monthcalc day 8 m= month+12*a-2 year 8 8 month 8 dayOFweek m 3 2 1 0 m1sel (31*m)/12 mux4g 16 r mout binbcd Note: century value is fixed at 2000 x7seg

  4. Controller Sw1… Sw8 aload bload cload controller eload datapath fload gload hload d1msel month binbcd year day dayOFweek mux4g x7seg

  5. State Machine 0/1 0 1 sA sF Wait for BTN4 up Wait for BTN4 down year<= SW display year s3 0 1 0 1 sB Wait for BTN4 down month <= 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 <= SW display day display dayOFweek a = (14 - month)/12 s1 m= month+12*a-2 1 mout =(31*m)/12 1 sE s2 Wait for BTN4 up (day + y/4 - y/100 + y/400 + mout) % 7 0

More Related