Guest
#6274433
Hello everyone! Is it possible to create stopwatch in VHDL with 4 times memory? Start and stop on the one button, memory set on the second button. One second accuracy
Stopwatch in VHDL
Guest
#6274433
Hello everyone! Is it possible to create stopwatch in VHDL with 4 times memory? Start and stop on the one button, memory set on the second button. One second accuracy
Guest
#6274594
Offcourse, Sure, freilich, if you can draw a state diagram at least in your mind. With the right hardware this precision is also possible. But a cheap microcontroller would also fit the task.
Guest
#6274854
How to start with code?
Guest
#6274927
If you don't have a Städte concept in your mind then draw one first. What are the inputs and outputs? And then write the neccessary logic.
Guest
#6275012
Sorry meant state concept like here: https://bennthomsen.files.wordpress.com/2011/12/stop-watch-state-diagram.png?w=584 https://www.researchgate.net/profile/Timothy_Fossum/publication/234780032/figure/fig5/AS:323378541023234@1454110860075/The-state-diagram-for-the-three-button-stopwatch.png https://www.researchgate.net/profile/Dr_Praveen_Srivastava/publication/215584753/figure/fig2/AS:305716725338120@1449899955646/Stopwatch-behavior-all-state-coverage.png It is called finite state machine (fsm). if you have decided how your fsm should look and which states it should have, you can write it in hdl.
Guest
#6299462
I wrote this... What do you think?
Guest
#6299951
Andrew wrote: > What do you think? > library IEEE; > use IEEE.STD_LOGIC_1164.ALL; > use IEEE.STD_LOGIC_UNSIGNED.ALL; Doing calculations with std_logic_unsigned or std_logic_signed is very bad style. Just use only the numeric_std library (which is really a IEEE standard) for calculations and do correct casting/convertion: https://www.doulos.com/knowhow/vhdl_designers_guide/numeric_std/ Duke Andrew wrote: > process(onOFF) > begin > if (onOFF'event and onOFF = '1') then > stan <= not stan; > end if; > end process; Is this code only for simulation? You will have troubles synthesizing this part. Andrew wrote: > if(stan = '1') then > if (clk'event and clk = '1') then > S <= S + 1; > end if; Are you really sure that you want to have a gated clock? What device are you targeting, does it support gated clocks? Some FPGAs support it but not all. Christoph Z. wrote: > Are you really sure that you want to have a gated clock? Luckily it's not leading to a gated clock, but it is a very strange and obfuscating way to write a clock enable. See sel3 there: http://www.lothar-miller.de/s9y/categories/6-Clock-Enable Andrew wrote: > What do you think? Way to much clocks in that design. Each 'event acts like a clock source for flipflops. Thats no good design practice. The proper way to generate clocks inside an FPGA is by using the clock managers. And a usual beginners design has only and exactly one clock all over. Very, very strange coding style in those lines of the "process(memPUSH, reset)". Where did you find this? To react to a button the usual way is: 1. sync it in 2. debounce it 3. set an edge detection on it 4. use it > if (S = "111011") then Why don't you use integers for the counters? Then this line would look much better readable for humans: if S=59 then Finally it will be very tricky to display your binary H:M:S values on e.g. 7 segment displays. Because therfore you will have to spit it up into h10, h1, m10, m1, s10 and s1. So the most easy way would be to count each segment for itself like id did it there: http://www.lothar-miller.de/s9y/archives/88-VHDL-vs.-Verilog-am-Beispiel-einer-Stoppuhr.html BTW: Pls use the [vhdl] tags to wrap your code ReplyPlease log in before posting. |