Anda di halaman 1dari 6

Date Display Subsystem

Mohd Zulhilmi Bin Ramli


Universiti Teknologi Malaysia
Faculty of Electrical Engineering
displays will show 29. This imply that February is the leap
month. However in this project the leap month is swapped
with March. That mean when 0011 is entered, it will shows 29
if the year is leap year.

Abstract - In a standard calendar system, the number of


days in a month is either 28, 29, 30 or 31. For example, the
number of days for February is 28 for common year and
29 for leap year. In this project, a system which can
determine the number of days in a month and whether a
given year is a leap year is designed. Leap years are all the
years divisible by 4, except that years divisible by 100 are
not leap years. Years divisible by 400 are also leap years.
As an example, the year 1900 is not a leap year because it
is divisible by 100 but not divisible by 400.
1.

2.

MATERIALS AND METHOD

The very first step in designing this system is identify the


input and output of the system.

INTRODUCTION

LED

Year

Leap Years are needed to keep our calendar in alignment


with the Earth's revolutions around the sun. It takes the Earth
approximately 365.242199 days or 365 days, 5 hours, 48
minutes, and 46 seconds (a tropical year) to circle once
around the Sun. However, the Gregorian calendar has only
365 days in a year, so if we didn't add a day on February 29
nearly every 4 years, we would lose almost six hours off our
calendar every year. After only 100 years, our calendar would
be off by approximately 24 days [1].

Date
Display
Subsystem

Month

Days

Figure 1: Input Output Diagram of the System

The figure above show the IOBD of the system. From the
diagram there are 14 inputs of the system, 10 inputs for the
Year and 4 inputs for the Month. Since this is combinational
circuit, no clock is needed.

In this project, a calendar system is designed so that it


should be able to display the number of days using two 7segment displays and a red LED to show whether the given
year is leap year or not. The month number is set by four
toggle switches according to binary number system. The 4digit year is represented in BCD number format, and is set
using 14 toggle switches. The 14 toggle switches is called as
YM2YM1 (millennium digit - assume YM8 and YM4 are
tight to logic 0), YH8YH4YH2YH1 (hundredth digit),
YT8YT4YT2YT1 (tenth digit), YO8YO4YO2YO1 (ones
digit). After the month and year values have been set, the
system will display the number of days on two 7-segment
displays and a red LED if the year is a leap year.

Next, a truth table based on the condition for the leap to


occur is constructed. According to the condition, a leap year is
occurred if the year is divisible by 4. However, if the year is
divisible by 100 and not divisible by 400, that particular year
is not a leap year. Therefore, there is 3 set of rules need to be
designed for the condition to meet.
The first set of rule is need to detect numbers 0, 4, 8 for
LSB digit, and numbers 2, 6. Need to detect whether tens digit
(the next LSB digit) is even or odd.

In example if the 14 toggle switches is set to


01100110010010 which is represent 1992 in decimal, the red
LED will light on indicating the year is a leap year. If the
remaining 4 toggle switches is set to respective month in
binary, it will shows the number of days in the particular
month. If it was set to 0010 which is February, the 7-segment

Next, the truth table for the month entered producing


output of the number of the days is designed. For each month
entered, the 7-segment display will shows the number of day
at that particular month. In example, if the input for month is
entered as 0001, the output will be 31, indicating January has
31 days.

1
1
1
1
1
1

0
0
1
1
1
1

1
1
0
0
1
1

0
1
0
1
0
1

0
0
0
0
0
0

Y01
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1

F4
0
1
0
1
0
1
0
1
0
1
0
0
0
0
0
0

Table 3: 2, 6

From the first rule, the obtained logic gates is as follow:


Y08
0
0
0
0
0
0
0
0
1
1
1
1
1
1
1
1

Y04
0
0
0
0
1
1
1
1
0
0
0
0
1
1
1
1

Y02
0
0
1
1
0
0
1
1
0
0
1
1
0
0
1
1

Y01
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1

Y08
0
0
0
0
0
0
0
0
1
1
1
1
1
1
1
1

F1
1
0
0
0
1
0
0
0
1
0
0
0
0
0
0
0

Y04
0
0
0
0
1
1
1
1
0
0
0
0
1
1
1
1

Y02
0
0
1
1
0
0
1
1
0
0
1
1
0
0
1
1
nd

Table 4: Odd 2 LSB

Table 1: 0, 4, 8

Y08
0
0
0
0
0
0
0
0
1
1
1
1
1
1
1
1

Y04
0
0
0
0
1
1
1
1
0
0
0
0
1
1
1
1

Y02
0
0
1
1
0
0
1
1
0
0
1
1
0
0
1
1

Y01
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1

F2
1
0
1
0
1
0
1
0
1
0
0
0
0
0
0
0

Figure 2: Logic equivalent of first rule

The second rule is obtained as follow:


Y08
0
0
0
0
0
0
0
0
1
1
1
1

nd

Table 2: Even 2 LSB

Y08
0
0
0
0
0
0
0
0
1
1

Y04
0
0
0
0
1
1
1
1
0
0

Y02
0
0
1
1
0
0
1
1
0
0

Y01
0
1
0
1
0
1
0
1
0
1

F3
0
0
1
0
0
0
1
0
0
0

Y04
0
0
0
0
1
1
1
1
0
0
0
0

Y02
0
0
1
1
0
0
1
1
0
0
1
1

Y01
0
1
0
1
0
1
0
1
0
1
0
1

F5
1
0
0
0
0
0
0
0
0
0
0
0

1
1
1
1

1
1
1
1

0
0
1
1

0
1
0
1

0
0
0
0

0
0
0
0
0
0
0
0
1
1
1
1
1
1
1
1

Table 5: Divisible by 100

0
0
0
0
1
1
1
1
0
0
0
0
1
1
1
1

0
0
1
1
0
0
1
1
0
0
1
1
0
0
1
1

0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1

0
1
1
1
1
1
1
1
1
1
1
1
1
0
0
0

0
1
1
1
1
1
1
1
1
1
1
1
1
0
0
0

0
1
1
1
1
1
1
1
1
1
1
1
1
0
0
0

0
1
1
0
1
1
1
1
1
1
1
1
1
0
0
0

0
1
1
0 (1)
0
1
0
1
1
0
1
0
1
0
0
0

Table 6: Month and its respective number of days


Figure 3: Logic equivalent of second rule

The output with the bracket indicates that month is leap


month. The equivalent logic gates is as follow.

The third rule is obtained by using similar step as


Divisible by 4, but this time the output is AND with Divisible
by 100.

Figure 4: Logic equivalent of the third rule

According to the condition, a leap year is occurred if the


year is divisible by 4. However, if the year is divisible by 100
and not divisible by 400, that particular year is not a leap year.
Combining all these rules resulting the following output:

Figure 5: The leap logic

If the year is leap year, the Leap output will become 1,


turning the LED on. Else, the output is 0.
Next, the Leap output is combined with the input of the
Month. The truth table is constructed. For this project, we
swapped February with March.
A3

A2

A1

A0

D4

D3

D2

D1

Figure 6: Input for month

D0

The output D4 to D0 is represented in BCD. Before this


output is connected to 7-segment display, it first split into
single digit.
Leap
0
0
0
0
0
0
0
0
1
1
1
1
1
1
1
1

D2
0
0
0
0
1
1
1
1
0
0
0
0
1
1
1
1

D1
0
0
1
1
0
0
1
1
0
0
1
1
0
0
1
1

D0
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1

O3
0
0
0
0
1
1
0
0
0
0
0
0
0
0
0
0

O2
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0

O1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0

O0
0
0
0
0
0
1
0
1
0
0
0
0
0
0
0
0

Figure 8: Compilation result

After the compilation, the system is assigned with the pin


provided by the board. In this project, Altera DE2 FPGA
which is using Cyclone II chip is used [2].

Table 7: Splitting Month output to BCD for LSB

From the table, the desired output is only 28, 29, 30 and
31. However, for 29, it is interchanged during leap year,
separated by multiplexer.

Figure 7: BCD output

Figure above is the final output of the system. It is


attached to 7446 BCD to 7-segment display so the display can
show the correct numbers. The mux input is only attached to
IN0 and IN1 because the rest of the input is not needed.
After the system is successfully implemented, the system
is compiled in Quartus II.

Figure 9: Pin Assignment

After completed the pin assignment, the project is


recompiled. When compilation is completed, the project is

uploaded into the board using build in programmer. Final step


is the system is tested on the board.
3.

RESULT

The board is tested by set the year and the month. Both
leap and non-leap year is tested.

Figure 12: leap year and June days

From the figure above, the year is set to leap year and the
LED is light on indicates the year is leap. Figure 10 shows
February, showing 31 days. Figure 11 is March, has 29 days
because it is leap month and finally figure 12 is June, has 30
days.
Figure 10: Leap year and February days

Figure 13: Non-leap year and June days


Figure 11: Leap year and March days

For the number of day, referring to Table 6 and Figure 6,


the input is valid only from 1 to 12. Any than that will yield 0.
From figure 10, the input for month is 0010. Looking back at
the truth table in Table 6, it will give output of 11111, which is
31 in decimal. The rest of the month will give it respective
days, as in Table 6. Exception is during leap year, where the
output for last bit of number of day is interchanged if the year
is leap year. For example, during non-leap year, March last bit
is 0. However during leap year, the 0 is interchanged with 1,
using multiplexer.

5.

From the result, it can be concluded that the system


designed successfully emulate the Date Display Subsystem
with Leap Year Indicator. For any year is inserted, the system
will automatically detect whether the system is leap year or
not and for any month inserted, it also display the number of
month in that particular month.

Figure 14: Non-leap year and March days

6.

Figure 15: Non-leap year and January days

From the figure above, the year is set to non-leap year and
the LED is light off indicates the year is non-leap. Figure 13
shows June, showing 30 days. Figure 14 is March, has 28 days
because it is non-leap month and finally figure 15 is January,
has 31 days.
4.

DISCUSSION

Figure 10, 11, and 12 show a leap year indicator on


because it met the condition the system imposed which is

CONCLUSION

All year divisible by 4 is leap year, except for the year


that divisible by 100 but not divisible by 400.

The year in those figure is 2000. Comparing it to the


conditions, 2000 is divisible by 4. It also divisible by both 100
and 400. Therefore the year is a leap year.
For figure 13, 14 and 15, the leap year indicator is off
because the year set is not a leap year, which is 2001. This is
due to 2001 is not divisible by 4.

REFERENCE

[1]

http://www.timeanddate.com/date/leapyear.html

[2]

Dr. Rabia Bakhteri, VLSI System Design Lab,


Faculty of Electrical Engineering, Universiti
Teknologi Malaysia, 2014

Anda mungkin juga menyukai