31

Alaram Clock Dld

Embed Size (px)

Citation preview

Page 1: Alaram Clock Dld

DigitalLogicDesignandAnalysis

8.

A

DesignExample:

DigitalAlarm

Clock

PorasT.Balsara

and

Kamlesh

Rath

DepartmentofElectricalEngineering

TheUniversityofTexasatDallas

A

Design

Example:

DigitalAlarm

Clock

8.1

c

August1998

ptb,kr

Page 2: Alaram Clock Dld

DigitalAlarm

ClockDesign

GeneraldesignMethodology

Speci�cationsandusage

Overallarchitecture

Designdetails

Simulationresults

A

Design

Example:

DigitalAlarm

Clock

8.2

c

August1998

ptb,kr

Page 3: Alaram Clock Dld

GeneralDesignMethodology

Top-downvsBottom-updesignmethodology.

Proceedinatop-downfashionstartingwithahighlevelspeci�cationof

thesystemtobedesigned.

Developatoplevelarchitectureblockdiagram.

Determinespeci�cationsofbuildingblocksandinterfaceamongdi�erent

blocks.

Designbuildingblocksbygoingdownthehierarchytillyoureachthe

mostprimitiveblocks,i.e.,combinationallogicgatesand ip- opsinthis

designenvironment.

Designandthoroughlysimulatethemostbasicblocksusingthe

primitivecomponents.

Buildnext(higher)levelblocksusingtheabovebasicblocks,simulating

thoroughlyateachlevel{Bottom-updesignprocess.

A

Design

Example:

DigitalAlarm

Clock

8.3

c

August1998

ptb,kr

Page 4: Alaram Clock Dld

Speci�cations and Usage

� Digital clock with alarm.

� Displays hours and minutes in 12 hour mode with AM/PM and

Alarm ON LED indicators.

� Push button switches to set time of day and alarm time.

� Push button switches to set hours and minutes.

� Push button switch that toggles alarm on or o� and a speaker to provide

an audible tone when alarm goes o�.Set_Time

Set_AlarmSpeaker

Alarm on/offMinutes

Hours

AM/PM

Alarm on/off LED

A Design Example: Digital Alarm Clock 8.4 c August 1998 ptb,kr

Page 5: Alaram Clock Dld

Tosettimeofday:

{

PressSetTimepushbuttonswitchand

{

PushHoursswitchtomodifyHoursdisplayorMinutesswitchtomodify

Minutesdisplay.

{

ReleaseSetTimeswitchtocontinuenormaloperation.

{

EachpushofHoursorMinutesswitchwillincrementthecorresponding

displaybyone.

{

HoursandMinutesswitchesshouldnotbeoperatedatthesametime.

Tosetalarm

time:

{

PressSetAlarmandswitchanduseHoursandMinutesswitchesas

mentionedabovetosetalarmtime.

{

ReleaseSetAlarmswitch.

{

Inordertoturn-onthealarmpushtheAlarmon/o�switchonce.

Pushingitagainwillturn-o�thealarm.

{

Oncethealarmgoeso�itcanbeshutonlybypushingthe

Alarmon/o�switch.

A

Design

Example:

DigitalAlarm

Clock

8.5

c

August1998

ptb,kr

Page 6: Alaram Clock Dld

OverallArchitecture

Therearetwodistinctcomponentsinthisdesigna:

(a)clocktimecircuit,and(b)alarmtimecircuit.

Theseblocksgeneratedataforhours,minutesandAM/PMdisplays.

Thereisnoneedtodisplayalarmtimeallthetime.Itshouldbe

displayedonlywhenalarmtimeisbeingset.Atallothertimesclock

timeisdisplayed.Thisisachievedbymultiplexingthedataoutputsfrom

theclocktimeandalarmtimecircuitsusingSetAlarmascontrolinput.

Sincethedisplaydevicesare7-SegmentLEDdisplaysthereisaneedfor

eitherabinary-to-7-segmentoraBCD-to-7-segmentconverter.

Amagnitudecomparatorisneededtocomparetheclockandalarm

timesandtogenerateasignalwhichcanturnonanalarmringerifthe

alarmwasturnedonearlier.

a

Partsofthisdesignarefrom

theSynopsysVSSFamilyTutorials,ver3.3

A

Design

Example:

DigitalAlarm

Clock

8.6

c

August1998

ptb,kr

Page 7: Alaram Clock Dld

7 7 7

Alarm Time Block

Tone Generator & Ringer ControlComparator

2

AM/PM

2 7 7 7

Multiplexer

Hrs. Mins.

MH

Clock Time Block

=Speaker

Alarm_on

BCD-7 Segment Converter

5 7

1313Set Alarm Set Time Hrs. Mins.

CLK

Display Drivers

Alarm_on/off

A Design Example: Digital Alarm Clock 8.7 c August 1998 ptb,kr

Page 8: Alaram Clock Dld

Clock Time Block

7

5chrs

cam_pm

cmins

CLK

CLOCK TIME

BLOCKmins

hrs

set_time

TIMECOUNTER

inc_h

inc_m

inc_s

TIME

STATE MACHINE

hrsmins

set_time

CLK

chrscmins

cam_pm

5

7

A Design Example: Digital Alarm Clock 8.8 c August 1998 ptb,kr

Page 9: Alaram Clock Dld

Time State Machine:

� Based on the status of set time input it generates input signals for the

time counter. If set time is active it generates pulses on inc h or inc m

line each time hrs. or mins. switch is pushed.

� In the normal mode, it sets inc s high so that the time counter counts

the pulse on CLK input which has a frequency of 1 Hz.

set_time hrs mins inc_h inc_m inc_s

conditionsall other

SET_MINS

SET_HRS

110 10

COUNTTIME

101 010101 000

0110 000

001all other conditions 000

all other conditions 000

00

01

10

A Design Example: Digital Alarm Clock 8.9 c August 1998 ptb,kr

Page 10: Alaram Clock Dld

.

TIME-SM

clk

inc_s

inc_m

inc_h

Q1

Q0set_time

min

hrs

Schematic diagram of Time State Machine

A Design Example: Digital Alarm Clock 8.10 c August 1998 ptb,kr

Page 11: Alaram Clock Dld

Tim

e

Counter:

Inputtothecounterhasafrequencyof1Hz.

Togenerateminutesoutputthisinputhastobedividedby60.Thiscan

bedonebyusingamod-60counterorbyusingamod-10andamod-6

counterwitharipplecarrybetweenthem.

Togeneratehoursoutputtheminutesoutputhastobedividedby60.

Hourscounterisamod-13counterwhoseoutputcanbeusedtogenerate

theAM/PMsignal.

Themod-6andmod-10countersgenerateBCDoutput,whereasthe

mod-13countergeneratesbinaryoutputwhichisconvertedtotwoBCD

digits.

AM/PMsignalisturnedonoro�eachtimehourscountreaches12.

Duringthesettimemodetheminutesandhourscountersaredetached

fromtheirnormalripplecarryinputsandareincrementedbypulseson

theincmandinchinputs.

A

Design

Example:

DigitalAlarm

Clock

8.11

c

August1998

ptb,kr

Page 12: Alaram Clock Dld

.

.. 10.. 6 .. 10.. 6

MUXMUX

..

Minutes SecondsHoursam_pm(not displayed)

1 4 3 4 3 4

inc_h inc_m inc_s

CLK

set_time

1 pulse/hour 1 pulse/minute 1 pulse/second

13Block diagram of Time Counter

A Design Example: Digital Alarm Clock 8.12 c August 1998 ptb,kr

Page 13: Alaram Clock Dld

.

clkMOD-6

carry-out

Q2 Q1 Q0

Schematic diagram of Mod-6 Counter

A Design Example: Digital Alarm Clock 8.13 c August 1998 ptb,kr

Page 14: Alaram Clock Dld

.

MO

D-10

carry-outclk

Q3

Q2

Q1

Q0

Schematicdiagram

ofMod-10Counter

A

Design

Example:

DigitalAlarm

Clock

8.14

c

August1998

ptb,kr

Page 15: Alaram Clock Dld

.

MO

D-13 (B

CD

)

clk

carry-out

Qt0

Q3

Q2

Q1

Q0

Schematicdiagram

ofMod-13Counter

A

Design

Example:

DigitalAlarm

Clock

8.15

c

August1998

ptb,kr

Page 16: Alaram Clock Dld

.

mod-13 mod-6 mod-10 mod-6 mod-10

TIME-CTR

cam_pm

csecs

set_time

cminschrs

clk

inc_s

inc_m

inc_h

Schematic diagram of Time Counter

A Design Example: Digital Alarm Clock 8.16 c August 1998 ptb,kr

Page 17: Alaram Clock Dld

Alarm Time Block

mins

ALARM TIME

BLOCK

ahrs

amins

aam_pm

CLK

ahrsaminsaam_pmSTATE MACHINE

ALARM

COUNTER

ALARMinc_h

inc_m

mins

hrs

set_alarm5

7

5

7 hrs

set_alarm

CLK

A Design Example: Digital Alarm Clock 8.17 c August 1998 ptb,kr

Page 18: Alaram Clock Dld

Alarm State Machine:

� This state machine is similar to the time state machine described earlier,

except that it does not generate an inc s signal and that it is active only

during the set alarm mode.

IDLE

set_alarm hrs mins inc_h inc_m

101 01

110 10

conditionsall other

101 00SET_MINS

SET_HRS 110 00

all other conditions 00

all other conditions 0000

00

01

10

A Design Example: Digital Alarm Clock 8.18 c August 1998 ptb,kr

Page 19: Alaram Clock Dld

.

ALARM_SM

clk

inc_m

inc_h

Q1

Q0set_alarm

min

hrs

Schematic diagram of Alarm State Machine

A Design Example: Digital Alarm Clock 8.19 c August 1998 ptb,kr

Page 20: Alaram Clock Dld

Alarm Counter:

� Alarm time counter circuit is a subset of the time counter circuit

described earlier. It has a mod-60 minutes counter and a mod-13 hours

counter. These counters receive their counting pulses from inc m and

inc h inputs.

.. 10.. 6..

MinutesHoursam_pm

1 4 3 4

13

inc_h

inc_m

A Design Example: Digital Alarm Clock 8.20 c August 1998 ptb,kr

Page 21: Alaram Clock Dld

.

mod-13 mod-6 mod-10

ALARM_CTR

aam_pm aminsahrs

inc_m

inc_h

Schematic diagram of Alarm Counter

A Design Example: Digital Alarm Clock 8.21 c August 1998 ptb,kr

Page 22: Alaram Clock Dld

ClockandAlarm

TimeMultiplexer

AM

/PMM

inutesH

ours

MU

X

set_alarm

clock_time

alarm_tim

e

A

Design

Example:

DigitalAlarm

Clock

8.22

c

August1998

ptb,kr

Page 23: Alaram Clock Dld

BCD-to-7-SegmentConverterandDisplayDriver

DISPL

AY

DR

IVE

RS

BC

D-to-7-SE

GM

EN

T D

EC

OD

ER

gfe

d

c b

a

gf

ed

cb

a

D (1)

C (2)

B (4)

A (8)

A

Design

Example:

DigitalAlarm

Clock

8.23

c

August1998

ptb,kr

Page 24: Alaram Clock Dld

Alarm and Clock Time Comparator

clock timealarm time

COMPARATOR equal

A Design Example: Digital Alarm Clock 8.24 c August 1998 ptb,kr

Page 25: Alaram Clock Dld

Ringer State Machine

� This machine determines when the alarm ringer (audible output for the

speaker) turns on.

� Ringer turns on when alarm is turned on AND the clock time matches

the alarm time. Once the ringer is on, it can only be turned o� by

turning o� the alarm on/o� switch.IDLE WAKEUP

alarm_on equal ring

0

00,01,100

11 1

OSCILLATOR

ring

Speaker Output

0 1

0

1 1

A Design Example: Digital Alarm Clock 8.25 c August 1998 ptb,kr

Page 26: Alaram Clock Dld

.

RIN

GE

R-SM

alarm_on/off

clk

osc

equal

ring

speaker

Schematicdiagram

ofRingerStateMachine

A

Design

Example:

DigitalAlarm

Clock

8.26

c

August1998

ptb,kr

Page 27: Alaram Clock Dld

DigitalAlarm

ClockCircuit

.

alarm-sm

alarm-ctr

ringer-sm

time-ctr

time-sm

alarm_on/off

mins hrs

speaker

alarm_on/off

clk

set time

set alarm

cam_pm

"time-blk"

"alarm-blk"

osc_in alarm_on/off

equal

MU

X

set_alarm

clock_time

alarm_tim

e

A

Design

Example:

DigitalAlarm

Clock

8.27

c

August1998

ptb,kr

Page 28: Alaram Clock Dld

SomeSimulationResults

SimulationresultsoftheMod-6counter

A

Design

Example:

DigitalAlarm

Clock

8.28

c

August1998

ptb,kr

Page 29: Alaram Clock Dld

SimulationresultsoftheMod-13BCDcounter

A

Design

Example:

DigitalAlarm

Clock

8.29

c

August1998

ptb,kr

Page 30: Alaram Clock Dld

.

SimulationresultsoftheAlarm

StateMachine

A

Design

Example:

DigitalAlarm

Clock

8.30

c

August1998

ptb,kr

Page 31: Alaram Clock Dld

SimulationresultsoftheRingerStateMachine

A

Design

Example:

DigitalAlarm

Clock

8.31

c

August1998

ptb,kr