Hi, I'm not quite sure if this vhdl code and testbench is correct for the given task. Can you take a look?
Design a one-hour kitchen timer. The device should have buttons/switches to start and stop the timer, as well as to set the desired time interval for the alarm. Realize the task using the software package Quartus or in GHDL, confirm the correctness of the project task by simulation.
This is VHDL code:
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
entity Kitchen_Timer is
port (
clk : in std_logic; -- Clock input
reset : in std_logic; -- Reset input
start : in std_logic; -- Start button input
stop : in std_logic; -- Stop button input
alarm : out std_logic -- Alarm output
);
end entity Kitchen_Timer;
-- Declare the architecture for the kitchen timer
architecture Behavioral of Kitchen_Timer is
signal count : integer range 0 to 3600 := 0; -- Counter for timer
signal alarming : std_logic := '0'; -- Signal to indicate alarming interval
signal alarm_en : std_logic := '0'; -- Signal to enable alarming interval
signal alarm_cnt : integer range 0 to 600 := 0; -- Counter for alarming interval
begin
-- Process to control the kitchen timer and alarming interval
process (clk, reset)
begin
if (reset = '1') then
count <= 0;
alarming <= '0';
alarm_en <= '0';
alarm_cnt <= 0;
elsif (rising_edge(clk)) then
if (stop = '1') then
count <= 0;
alarming <= '0';
alarm_en <= '0';
alarm_cnt <= 0;
elsif (start = '1' and count < 3600) then
count <= count + 1;
if (count = 3600) then
count <= 0;
alarming <= '0';
alarm_en <= '0';
alarm_cnt <= 0;
elsif (count > 0) then
alarm_en <= '1';
end if;
end if;
if (alarm_en = '1') then
if (alarm_cnt < 600) then
alarm_cnt <= alarm_cnt + 1;
else
alarm_cnt <= 0;
alarming <= '1';
end if;
end if;
end if;
end process;
-- Assign the alarm output
alarm <= alarming;
end architecture Behavioral; ```
This is Testbench:
```library ieee;
use ieee.std_logic_1164.all;
entity tb_Kitchen_Timer is
end tb_Kitchen_Timer;
architecture tb of tb_Kitchen_Timer is
component Kitchen_Timer
port (clk : in std_logic;
reset : in std_logic;
start : in std_logic;
stop : in std_logic;
alarm : out std_logic);
end component;
signal clk : std_logic;
signal reset : std_logic;
signal start : std_logic;
signal stop : std_logic;
signal alarm : std_logic;
constant TbPeriod : time := 1000 ns; -- EDIT Put right period here
signal TbClock : std_logic := '0';
signal TbSimEnded : std_logic := '0';
begin
dut : Kitchen_Timer
port map (clk => clk,
reset => reset,
start => start,
stop => stop,
alarm => alarm);
-- Clock generation
TbClock <= not TbClock after TbPeriod/2 when TbSimEnded /= '1' else '0';
-- EDIT: Check that clk is really your main clock signal
clk <= TbClock;
stimuli : process
begin
-- EDIT Adapt initialization as needed
start <= '0';
stop <= '0';
-- Reset generation
-- EDIT: Check that reset is really your reset signal
reset <= '1';
wait for 100 ns;
reset <= '0';
wait for 100 ns;
-- EDIT Add stimuli here
wait for 100 * TbPeriod;
-- Stop the clock and hence terminate the simulation
TbSimEnded <= '1';
wait;
end process;
end tb;
-- Configuration block below is required by some simulators. Usually no need to edit.
configuration cfg_tb_Kitchen_Timer of tb_Kitchen_Timer is
for tb
end for;
end cfg_tb_Kitchen_Timer;```
#science
can you send me the code with the modifications so that I know what exactly you mean?
I would rather not, as it isn't a good learning experience for you, and would require some time for me to write the code.
Though if you have any questions about my previous answer, feel free to ask me about it.
As a freebie for you, pay attention to the alarming signal, and the condition that has been set: "The device should have buttons/switches to start and stop the timer, as well as to set the desired time interval for the alarm.". If I wanted the alarm to ring after 50 minutes, how would I do that? And what happens when the timer starts?
From the code I see here, the alarm is going to ring 10 minutes after being started, and it won't stop until an hour passes. And it has no way to set a time for it to ring, it always rings after 10 minutes.
And, not only that, the start signal is never set in the testbench, so the timer is never going to begin.
What do you think about the specifications that the project requires, should I stick to your code or should I add something from my own code?
I would stick to my code, your alarm isn't going to work properly due to its comparisons as I mentioned in my previous comments. But if you want to improve the code I modified, you can change the adjust_interval_up and adjust_interval_down buttons to be synchronized to their own states rather than the clock (make their own process with their signals added to the signal sensitivity list and add an extra asynchronous condition to zero the counter on the original process). If you don't make a change like this your alarm is going to take up to an hour to adjust its timer range.
Does your simulation correspond to a time of 1 hour and should there be alarming on the simulation?
Yes, if you have a 1/60 Hertz clock signal. And you must have alarming on the simulation as it is crucial to show that it works.
8 healthy habits linked to living decades longer: A study of more than 700,000 people found that adopting eight healthy habits by age 40 could extend life expectancy by more than two decades. https://archive.is/nxwDC
There are those who believe they can bring into existence what they imagine.
On the other hand, there are those who don't even believe other people exist: they think their mind is the one forming images and that others are part of their mind.
As for me, I am intelligent and I believe in God.
Water did not create itself.
Let me hear from atheists who think water created itself.
I have a friend, who is a carpenter. I swear he can imagine a beautiful wooden cabinet, and with some hours of work with right tools and materials, honest, he can bring it into existence. It’s amazing!
However, it’s still unclear what underlying mechanisms may allow antibiotic resistance to spread in air pollution. It will be important for future studies to investigate this.
Wat.
Increased air pollution -> More respiratory illnesses - > More over-prescribing of antibiotics -> More antibiotic resistance
@JWBananas Or maybe the antibiotic resistant genes are taking a hitch ride on larger particles? I don't know, that is probably unlikely, but we've seen they can hitchhike into the atmosphere.
Sun 'umbrella' tethered to asteroid might help mitigate climate change: An astronomer has proposed a novel approach -- a solar shield to reduce the amount of sunlight hitting Earth, combined with a tethered, captured asteroid as a counterweight. https://www.sciencedaily.com/releases/2023/07/230731151552.htm
Sick of hearing about record heat? Scientists say those numbers paint the story of a warming world: With a summer of extreme weather records dominating the news, meteorologists and scientists say records like these give a glimpse of the big picture: a warming planet caused by climate change. https://phys.org/news/2023-07-sick-scientists-story-world.html
My instinct, as a non-expert, is that what we should really be looking at is rolling-average trends rather than records, to minimise cherry-picking. Stories about records, rightly or wrongly, come across as sensationalist and potentially misleading. Am I wrong?
The climate records that are being broken regionally are a direct consequence of the trends shown above. If you read the article @readbeanicecream was kind enough to share, then you would have read that. "Records go back to the late 19th century, and we can see that there has been a decade-on-decade increase in temperatures," said Gavin Schmidt, director of NASA's Goddard Institute for Space Studies, keeper of the agency's climate records."
So no, I don't think this is sensationalist or misleading at all. You just need to dig past the headline a little bit. A headline that accurately reflects what scientists are saying is a direct consequence of the general trend that's going to continue to get worse and break more records into the future.
Conspiracy theories are the new pandemic infecting public life: Millions of people, from all walks of life, have come to believe aspects of the QAnon conspiracy theory. Prevention is our only hope, says James Ball. James Ball is the author of The Other Pandemic: How QAnon contaminated the world https://archive.is/DGKiV
Are there any experts out there in the fediverse studying Quantum Gravity, and the reconciliation between General Relativity and Quantum Mechanics in general?
I want to see such a scientific breakthrough in my lifetime.
Don't let watermarks spoil your visual masterpiece. Pixbim Animate Photos AI is here to help you remove watermarks without a hint of blur. With unmatched precision, this cutting-edge tool effortlessly erases those pesky logos and imprints, leaving your images crystal clear. Bid farewell to distracting watermarks and welcome a new era of spotless visuals. Whether you're a professional photographer or a content creator, Pixbim Animate Photos AI ensures your work remains untainted. Transform your images with precision, unleash their true potential, and make your mark in the world of visuals.
Stevia, a zero-calorie sugar substitute, is recognized as safe by the Food and Drug Administration (FDA) and the European Food Safety Authority (EFSA). In vitro and in vivo studies showed that stevia has antiglycemic action and antioxidant effects in adipose tissue and the vascular wall, reduces blood pressure levels and hepatic steatosis, stabilizes the atherosclerotic plaque, and ameliorates liver and kidney damage. The metabolism of steviol glycosides is dependent upon gut microbiota, which breaks down glycosides into steviol that can be absorbed by the host. In this review, we elucidated the effects of stevia’s consumption on the host’s gut microbiota. #Stevia#kombucha#ikombucha_ro#ikombucha https://www.mdpi.com/2076-2607/10/4/744/htm
I have IBS and sugar makes it act up. I use stevia extract as a substitute in products, and I AM constantly working on improving my gut biome health. This was a dense but good read.
Teens engaged in activism become better critical thinkers, study finds: Youth involved in community-based activism over time become better critical thinkers and more politically active, according to a new University of Michigan study. https://phys.org/news/2023-08-teens-engaged-critical-thinkers.html
Sending this to my teenage daughter. I love her but I wish she thought as much about social issues that affect her generation as she does about her hair color…
Why Do Cats Land on Their Feet? Physics Explains: As it turns out, felines can survive a fall from any height—at least in theory https://archive.is/j55HE
tl;dr: nothing specific to cats. It’s just an exercise of calculating “air friction” and terminal velocity. Same calculation would let a dog survive the fall no different.