Active

dejo, to science Serbian

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

dejo,

@T4V0 Thanks for the answer, but I think I didn't understand you very well, can you send me the code with the modifications so that I know what exactly you mean?
Thank you very much, in advance

T4V0,
@T4V0@kbin.social avatar

@dejo

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.

Chozo, to fediverse

I feel like the reason #Mastodon, and the #Fediverse at large, aren't taking off has to do with the fact that they're actually social networks. People don't seem to want a social network, they want content platforms. People aren't using #Twitter or #Threads or #TikTok to keep up with their friends these days, they're using these apps to entertain themselves. And since #Facebook and every other platform that used to be a social network began pivoting toward content promotion, I think society has forgotten what a social network is supposed to actually be anymore.

(E: Grammar.)

Sam_uk,
@Sam_uk@kbin.social avatar

@Chozo I wonder if this bodes well for Kbin/Lemmy? Arguably their model is more about content than social relationships.

FlockOfCats, to random
@FlockOfCats@famichiki.jp avatar

I feel a lot more comfortable with the developer of kbin (@ernest) than the Lemmy devs.

Here, he messed up by not giving attribution for some code, but the transparency and remedy of the error are appreciated.

It’s nice to see something that builds trust as opposed to burning it down like at #Reddit

#fediverse #kbin

ada, to random
@ada@blahaj.zone avatar

The more I use different #fediverse apps, the more I feel that we are on the edge of a different future, in the early stages of something that we haven't seen before.

In the last few months, I've used #Mastodon, #Misskey, #Calckey, #Funkwhale, #lemmy, #Peertube, #Bookwyrm and #Pixelfed. Soon, I'm going to try an install of #kbin. In the not too distant future, we will see #GreatApe bringing more options for video chat to the Fediverse. There are countless more platforms that I haven't had a chance to try.

The network formed by the interconnections between those apps is the Fediverse; a Federated Universe. Federated, because everything out there is connected with everything else, in one giant network. What I am truly beginning to appreciate is just how real that vision is, and just how disruptive to our future it's going to be. More than a truism, these the fediverse platforms really will allow us to see and interact with nearly anything else out there.

The platform we use no longer determines the information we can access; it doesn't build walls around us. Instead, what out choice of platform determines, is how we interact with information, rather than determining what information we are able interact with in the first place. The walls in the walled garden haven't so much been torn down, as simply never built.

I can write a blog post, and someone on Mastodon can reply to it. I can make a group post on lemmy, and someone from Calckey can reply to it. I can see an awesome photo on Pixelfed, bring it in to #Akkoma and boost it for everyone else to see. And then anyone who sees it can interact with it.

The cross platform interactions are still imperfect. Standards are still being developed, code is still being written and features are still being defined, but the future is right here, we are on the cusp of something new and amazing.

Of course, this is all old news to someone who has been part of the fediverse for years now, but it feels different now. The momentum is here, we are seeing a shift and I think once we cross that precipice, once we have normalised the cross channel interactions we are starting to develop, it's going to be very hard to go back.

Honestly, I can't wait.

feditips, to random
@feditips@mstdn.social avatar

The Fediverse is more than just Mastodon! :fediverse:

If you like to share photos you might want to check out @pixelfed, an Instagram-style photo sharing network on the Fediverse.

You can find out more and sign up at:

https://pixelfed.org

PixelFed uses the same federation protocol as Mastodon, which means Mastodon users can follow people on PixelFed and vice versa. You can try following a PixelFed account right now such as @Iancylkowski or @JoseMel or @connyduck

You can use PixelFed through a web browser, and there are also free open Android apps like @PixelDroid and FediLab (@apps).

feditips,
@feditips@mstdn.social avatar

If you love books, the best part of the Fediverse is probably @bookwyrm, a GoodReads-style social reading network.

More info and sites to sign up on are at:

https://joinbookwyrm.com

Because it uses the same ActivityPub protocol that powers the rest of the Fediverse, you can follow BookWyrm accounts from Mastodon etc.

For example, the lead developer of BookWyrm has an account at @mouse

dansup, to random
@dansup@mastodon.social avatar

Seems like October will be an exciting month for the fediverse! #activityPub

  • All
  • Subscribed
  • Moderated
  • Favorites
  • random
  • meta
  • Macbeth
  • All magazines