Write a verilog/system verilog of a normally open momentary switch toggle with delays

Status
Not open for further replies.

cesarxhc

Newbie level 1
Joined
Jan 10, 2018
Messages
1
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
10
How to write in verilog and/or system verilog a normally open switch with delays with the following functionality: when pressed once it outputs 1 and stays 1 when depressed, when pressed a second time it outputs 0 and stays 0 when depressed. The 1 output is instantaneous upon pressing, the 0 output only occurs if the button is pressed for a determined time. This is essentially how the power button in desktops work: if computer is off pressing the button starts the computer but, if the computer is on, the button requires to be pressed for several seconds.
 

Is it a Verilog software exercise or a hardware design? In the latter case, you need a clock to implement the delay timer and key debouncing.

A PC realizes the respective function in the BIOS firmware. You probably noticed that the off-delay becomes effective after the operation system has booted, you have a fast turn-off function during initial boot phase.
 

    V

    Points: 2
    Helpful Answer Positive Rating

Hello,

as more experienced colleague has written you need: clok, counter (timer), debouncer (for button/switch) and very simple "state machine"( the state machine is for remember the actual state of switch) components. Just find out how to implement these components in Verilog (Google) and then interconnect them all in your project.

Regards
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…