Day Of Week
In this lab you will implement an algorithm to compute the day of the week
given a date, month and year. Your vhdl entity will take as input integers
for year, month and date and output an integer in the range of 0 to 6 for the
corresponding day of the week. A start signal will initiate the computation
and a done signal will signal the end of the computation. You may implement
this processor using an FSMD.
Algorithm
Here is the algorithm:
1. Clear a variable named total.
2. Divide the last two digits of the year by 4, drop the remainder, store
in total.
3. Add the last two digits of the year to total.
4. Add the date of the month to total.
5. Add the "Magic Number" for this month to total.
6. If it is a leap year and it is January/February, subtract 1 from total.
7. Find the remainder when total is divided by 7. The remainder indicates
the day of week as follows:
1 - Sunday
2 - Monday
3 - Tuesday
4 - Wednesday
5 - Thursday
6 - Friday
0 - Saturday
The magic numbers are: 1, 4, 4, 0, 2, 5, 0, 3, 6, 1, 4, 6.
Demo Output
You should write a testbench to test your entity. To verify that your
algorithm works, try it on today's date. Then, try it on your birth date.
Did you know what day of the week you were born? When ready, demonstrate your
design (code and simulation waves) to your TA.
Solution
Here is the complete solution. It will be availabe after the due date for this
assignment.
Turnin
After your demo, turnin your VHDL files. The TA (or grader) will check these
files for quality and assign you a grade. Please do not turnin the work
directory generated by Synopsys synthesis tools.
Last updated: 2/9/99