Problem 3:
Northeastern University
Department of Electrical and Computer Engineering
ECE U530: HDL and Synthesis
Professor: Miriam Leeser
Alarm Clock VHDL Project
Digilent Spartan- 3
Designed by:
Paul Aaron Bohn
Semester: Fall 2006
Date: 12/14/06
Content Page
Introduction / Objective 4
Design Description 5
Testing Methodology 9
a. Design Simulation
i. Results
ii. Analysis
b. Hardware Testing
i. Results
ii. Analysis
Discussion 10
Conclusions and Future Work 12
References 13
Appendices 14
Introduction / Objectives
This design is a time keeping digital alarm clock that displays time in hours and minutes. The goal of this design is to implement all of the basic features that one would normally expect to find on a standard digital alarm clock. Features such as standard twelve-hour time, clock/alarm setting functionality, an alarm snooze feature, and an alarm alert indicator.
List of features to be implemented:
1. A.M. P.M. time (12 hour roll over)
2. Clock setting functionality
3. Alarm time setting functionality
4. Alarm indicating LED/Sound output
5. figure out how to save design to on board prom
6. special alarm clock feature making use of a random number generator
The design has been implemented on a Spartan-3 FPGA development board. The following diagram shows the physical alarm clock interface.
[pic]
( Figure 1 )
How to use:
A user should be able to set the clock by holding down the clock set button and incrementing the appropriate hour/minute buttons.
Design Description
This design is implemented on a Digilent Spartan-3 development board. The development board contains many inputs and outputs that aid an engineer in learning how to use the Spartan-3 FPGA. The following I/O were used for this design: a onboard 50 MHz crystal oscillator clock, three slide switches, four momentary-contact push button switches, two individual LED’s, and a four-character, seven-segment display. The pin locations of the I/O that an engineer wants to implement must be defined in a constraint file. These pin location values are listed in the Spartan-3 Starter Kit Board User Guide. This user guide can be accessed online at the manufactures website. See the references section for more details. The constraint file for this design is located at the end of the report. See p.10 in the Appendices.
Below is the VHDL entity that describes the same design I/O that is in the constraint file.
entity clock is port (
clk50in: in std_logic; -- 50 Mhz XTAL
btn_in: in std_logic_vector(3 downto 0); -- 4 pushbutton inputs
sw_in: in std_logic_vector(7 downto 0); -- 8 switch inputs
digit_out: out std_logic_vector(3 downto 0); -- digit drivers
led_out: out std_logic_vector(7 downto 0); -- 8 board mounted LEDs
seg_out: out std_logic_vector(7 downto 0)); -- segment drivers
end clock;
A full list of the inputs and output and their purpose is displayed below. This list corresponds with the entity above, the design constraint file located on p.10 in the Appendices and Figure 1.
Inputs:
1. Momentary Push Buttons:
a. Alarm Set { btn(3) }
b. Time Set { btn(2) }
c. Hours { btn(1) }
d. Minutes { btn(0) }
2. Slide Switch:
a. Alarm on/off
b. Snooze
c. Reset
Outputs:
1. Seven-Segment Display
2. AM/PM indicator LED led(7)
3. Alarm on/off indicator led(0)
4. Blinking LED second indicating decimal point
5. Blinking Board mounted second indicated LED’s
6. Alarm Alert ( LED / Sound)
Design Details - How the Clock was Designed:
The original code for this design project was written by Xilinx and can be found on the internet (see the reference section for more details). This design is broken up behaviorally in a series of processes.
For clarity, I have put meaningful comments above each “process” and throughout the VHDL program code (see p.1-p.12 in the Appendices).
The first task in the design process was to divide down the board mounted clock oscillator to get a clock signal that occurs once every minute. Next, I wrote a 12 hour am/pm time counter algorithm. This counter process is driven by the signal that occurs every sixty seconds. Latter, I rewrote portions of the seven-segment display code so that it would not display a leading zero. I also removed some code that created chasing LED lights on the board. The next design stage was the development of a time setting state machine. I had to figure out how to control this state using the board mounted momentary push buttons. A diagram of the state machine directly follows this page. After the previous step was completed, I created the enable signals to control each process using the state machine. At that time, I developed a minutes counting process that increments the minutes. I made some additional modifications to the code, changing the constraint file and signal naming. After this point, I began to have problems moving the project forward. I tried a myriad of solution paths to none of which worked as intended.
Synthesis:
The design’s synthesis report accurately displays the hardware I wanted to infer (see p.16-p.18 in the Appendices).
State Machines:
[pic]
[pic]
Testing Methodology
Hardware Testing:
The primary means of testing for this design was using hardware. The design was implemented by synthesizing the VHDL code, then generating a bit file using Xilinx ISE tools. This bit file was downloaded to the Spartin-3 development using Xilinx iMPACT. To complete the program download, I had to power the FPGA board by plugging it into an electrical outlet and hooking it up on end of the JTAG cable to the FPGA board and the other end to the computer’s parallel port.
Results
The design performs as to be expected. The clock’s display is fully functional. It is capable of using all four digits of the seven-segment display and the board mounted am/pm LED indicator. The reset switch works and the state machine does change state when the user presses the push buttons (btn2 btn1 and btn0). This is indicated by LED0, LED1, and LED2.
Analysis
Overall, the design performs the basic clock functions well. Sometimes the clock freezes while the user presses the momentary pushbuttons. This might be caused by unintentional signals generated by a noisy digital contact as the switch is pressed. To eliminate this problem, one would have to de-bounce the push buttons in the software.
Design Simulation:
The VHDL test bench simulated by using the ModelSim by Xilinx. Software test vectors for the state machine were not required because I did not get far enough in the design process, and the results were already seen in previous hardware tests.
Results
This simulation confirmed what the hardware tests were showing. Page 13 in the Appendix is a zoomed out view of the clock wave forms. From this view, the repetitive patterns of each waveform can be observed. Page 14 and 15 offer more detail by displaying the binary values of the signals in different states. One can observe the signals h2,h1,m2,m1 at the expected initial starting value of 12:01, the board mounted LED will be powered by the led_out signal, the digit of seven-segment display is controlled by the digit_out signal, and the corresponding seven-segment decoder output signal seg_out for each digit. One can also observer the alternating decimal point signal dp.
Analysis
The simulation results did not prove to be as useful as I would have liked. Since the clock device operates in real time, it makes the simulations very long. The more interesting events happen every 60 seconds, which is an extremely long time to run a simulation. This simulation provided waveform data that is located at the end of the report. (see p.13-p.15 in the Appendices).
Discussion
Lessons Learned:
Much was learned while developing this project. I learned how to implement hardware using VHDL code. This includes learning about implementation of constraint file, input buffers, and output buffers. I learned how to use the development board’s display by multiplexing the digit signal to the 7-segment decoder. I learned how to divide down the board’s internal clock so I could use it in my design.
For the first time, I learned about and used some programming constructs that I was unfamiliar with such as “generate” and “shared variables”.
While working on this design, I referenced many VHDL sources including websites, course notes, course book, and the Spartan-3 Starter Kit Board User Guide.
What was Difficult:
Unfortunately, the design is incomplete. My goal was to use the “clock set” state machine to activate and deactivate the time_counter, minute_counter, and hour_counter processes using enable signals. (time_en, min_en, hour_en) Each of these processes should be able to modify the hour/minute data depending on whether or not they are enabled. I would like to save and modify this data using the following signals h2, h1, m2, m1. This functionality was never achieved.
I had much difficultly implementing the design using this approach. I have been considering many approaches to solve this problem, but most of these solution paths seem to be overly complex. That is why this project is not fully functional.
Some of the possible solution paths that I tried are listed below.
1. shared variables
2. Memory (RAM)
3. state Machine
4. registers
5. multiplexers
6. structural description
7. latch flag scheme
What I Would Have Liked to Learn in Class:
I would have liked to gain more hardware implementation knowledge. I would find it incredibly fascinating to spend some time on every input and output that the Digilent Spartan-3 development board offers. I am most interested in learning how to use the VGA port, RS-232, and PS2. I would also like to learn how to use the FPGA to emulate various types of hardware an old game console, arcade game, microprocessor, etc. I know where I would like to go with the knowledge I have learned thus far, but this certainly goes beyond the scope of an intro VHDL course.
Design Status:
Current Questions:
1. Will a 50MHz divided clock give a true 1 Hz signal that is equivalent to one second? If not, can I improve the performance?
2. Should I create multiple VHDL files and link them with a structural description?
a. State machine
b. Counters
3. I do not know why my state machine stops working after pushing repetitively on the push buttons. The buttons might need to be de-bounced.
4. How do you store and pass values between processes?
5. The clock sometimes randomly freezes
Conclusions and Future Work
Again, the clock’s display is fully functional. It is capable of using the all four digits of the seven-segment display and the board mounted am/pm LED indicator.
Design Steps:
Completed:
1. Extensive internet research of alarm clock design
2. Obtain a thorough understanding of the Xilinx clock code (Digital Clock using Multiplexed 7-Segment Display) obtained at:
3. Begin to adding useful comments into the clock.vhdl code.
4. Generate a 60 Hertz minutes signal from clock
5. Generate a 100 Hertz test signal from clock
6. Change clock to display hh::mm format
7. Change rollover for hours and minutes to 24 hour time
8. Develop a more complete input/output list
9. Develop a state machine ideas for clock
10. Successful FPGA board implementation
11. Remove board mounted LED light chasing code
12. Keep LED decimal point flashing code
13. Write a time counter algorithm
14. Implement a 12 hour am/pm mode with “am” LED indicator (rewrote clock counter)
15. Change the most significant LED digit (7seg) to be non-active when the number one or two are not being displayed.
16. Change the numeric order of the push buttons to match what is labeled on the Xilinx Spartan-3 board
17. Change the push button signal assignment from “pb” to “btn” to match the Spartan-3 board labels.
18. Develop a set-time FSM
19. Create a up_minutes process to increment the minutes
20. Write a VHDL testbench
If I had more time to work on this project, I would consider doing the following tasks.
To Do:
1. Figure out how to store and pass time data between processes.
2. Create an up_hour process
3. Figure out how to set the clocks minutes and hours by storing them in a register
4. Fix am/pm problem ( could use led(7) as a control signal for time counter)
5. Write processes for each state. (i.e. set_time, up_minutes, up_hours )
6. Make use of newly freed up board mounted LED’s to display alarm on/off indicator.
7. Continue to refine code comments
8. Develop alarm FSM and functionality
9. Might rewrite the time algorithms
10. Confirm the clock is keeping accurate time.
11. Debounce the board mounted push buttons
My lack of time and knowledge has prevented me from completing this design. I have a suspicion that there exists much simpler design approaches. I think an FPGA microprocessor based emulation might offer a better solution path. If I were to continue this project, I would re-evaluate the entire design method by increasing my knowledge of VHDL, logic design techniques, clock designs, and computer architecture. These tools would give me the ability to create a logical design.
Although the project is incomplete, it has afforded me with much more knowledge about this particular problem. My knowledge of the VHDL language has improved vastly.
References
Digilent Inc.
Digital Clock using Multiplexed 7-Segment Display:
The original code for this project was written by Xilinx and can be found at the following website:
Appendices
Equipment
1. IBM PC compatible unit: computer box, monitor, mouse, keyboard, running Windows XP Professional.
2. Hardware Device:
a) Device Family: Spartan3
b) Device: xc3s200
c) Package: pq208
3. Software: Xilinx Foundation Series F6.2i.
................
................
In order to avoid copyright disputes, this page is only a partial summary.
To fulfill the demand for quickly locating and searching documents.
It is intelligent file search solution for home and business.
Related download
- section 25 10 10 advanced utility metering system
- guideline study start up to siv and site activation
- common errors in kronos and how to fix them
- time clock mts great employee time clock software
- rockwell automation
- place title here using all upper case
- redcort software time tracking timesheets timecards
- guide specification for smartvfd hvac vfds english
Related searches
- different approaches to problem solving
- 3rd grade word problem worksheets
- research problem examples
- math word problem worksheets pdf
- word problem practice worksheets
- online shopping problem and solution
- identifying a research problem examples
- research problem example pdf
- identifying problem statements in research
- significance of the problem example
- lesson 3 problem solving practice answers
- ces lesson 3 problem solving