Question

In: Electrical Engineering

How do you write a VHDL code for this The SecondGenerator block generates the second count...

How do you write a VHDL code for this

The SecondGenerator block generates the second count i.e; it increments an internal variable once every second from 0 to 59 and then rolls back to 0. That (std_logic_vector) variable can be assigned to a (std_logic_vector) signal second[5..0] which comes out of the block. Note that this is a 6-bit std_logic_vector value because counts up to 59 can be accommodated in 6 binary digits (26 = 64). As most clocks do not display second counts so this value is not utilized any further here. This block also generates a pulse every time the second counter rolls over i.e. every 1 minute. This comes out as the std_logic signal minute_out .

Solutions

Expert Solution

library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_arith.all;
use ieee.std_logic_unsigned.all;

entity digi_clk is
port (clk1 : in std_logic;--counting pulses
      seconds : out std_logic_vector(5 downto 0);--second key output
          );
end digi_clk;

architecture Behavioral of digi_clk is
signal sec : integer range 0 to 60 :=0;
signal count : integer :=1;
signal clk : std_logic :='0';

signal minute_out : std_logic;
begin
seconds <= conv_std_logic_vector(sec,6);

--clk generation.For 100 MHz clock this generates 1 Hz clock.
process(clk1)
begin
if(clk1'event and clk1='1') then
count <=count+1;
if(count = 50000000) then
clk <= not clk;
count <=1;
end if;
end if;
end process;

process(clk)   --period of clk is 1 second.
begin

if(clk'event and clk='1') then
sec <= sec+ 1;
if(sec = 59) then --after 59 it should be reset

begin
sec<=0; --for rolling the timer continuously
minute_out <=  ‘1’;--One minute count

end
end if;
end if;

end process;

end Behavioral;


Related Solutions

Using vhdl in a FSM , how could you write code to delay a state change...
Using vhdl in a FSM , how could you write code to delay a state change for one hour? For example, you have a fan running in the 'on' state , but after 1 hour you would like that fan to switch back to the 'off' state. What is the best way going about doing this?
How do I implement Image Processing using VHDL for FPGA? Please provide VHDL code
How do I implement Image Processing using VHDL for FPGA? Please provide VHDL code
Write VHDL code (behavior model) to implement a 4-bit modulo-9 counter and simulate your VHDL code...
Write VHDL code (behavior model) to implement a 4-bit modulo-9 counter and simulate your VHDL code of 4-bit modulo-9 counter in ModelSim, and capture the screenshot of your simulated waveform. Assume clock period Tclk=100ns, initially, the counter is reset to Q3Q2Q1Q0=0000 you need to simulate a complete counting cycle plus one more additional clock period after it is reset to “0000” state.
Write a VHDL code for a 8x8 bit multiplier. use structural approach. write the design code...
Write a VHDL code for a 8x8 bit multiplier. use structural approach. write the design code and testbench. Use for-generate if possible
Write VHDL code for ALU 32bit. ALU must perform addition and subtraction. You are not allowed...
Write VHDL code for ALU 32bit. ALU must perform addition and subtraction. You are not allowed to use other libraries. Only this libraries are allowed to use: use library ieee; use ieee.std_logic_1164.all; Please do it correctly and include the comments for me to fully understand. Thank you.
Write VHDL code for ALU 32bit. ALU must perform addition and subtraction. You are not allowed...
Write VHDL code for ALU 32bit. ALU must perform addition and subtraction. You are not allowed to use other libraries only this is allowed to use library ieee; use ieee.std_logic_1164.all; Please write the comments for me to fully understand. Thank you.
a) i) The following VHDL code contains erroneous syntax. Re write the code in its corrected...
a) i) The following VHDL code contains erroneous syntax. Re write the code in its corrected format onto your answer sheet. You may assume that din is a 16-bit vector and that the ld, lr and cl inputs are 1-bit wide. lp: process(clk) signal reg : std_logic_vector(15 downt begin if cl=’1’ then reg := (others:=’0’); else if clk=’1’ and clkevent then if ld=’1’ reg <= din; end if; if lr=’1’ then reg := reg(14 downto 0) & “0 else reg...
How would you do the following using Python code: For the second exercise determine the union,...
How would you do the following using Python code: For the second exercise determine the union, intersection and difference of the square and cube of integers ranging from 1 to 100. Sets are clearly the way to go here. You can use Math functions to generate the sets for the square and cube for the Integers. The following functionality should be available for the user via a simple interface: 1. Display the Square and Cube for Integers ranging from 1...
How would you do the following using Python code: For the second exercise determine the union,...
How would you do the following using Python code: For the second exercise determine the union, intersection and difference of the square and cube of integers ranging from 1 to 100. Sets are clearly the way to go here. You can use Math functions to generate the sets for the square and cube for the Integers. The following functionality should be available for the user via a simple interface: 1. Display the Square and Cube for Integers ranging from 1...
I am trying to write the code for an 8 bit adder in VHDL so that...
I am trying to write the code for an 8 bit adder in VHDL so that I can program it onto my Elbert V2 Spartan 3A FPGA Development Board, but I keep getting errors. Any ideas what I am doing wrong? library IEEE; use IEEE.STD_LOGIC_1164.ALL; entity adder8bit is Port ( a : in STD_LOGIC_VECTOR(7 downto 0); b : in STD_LOGIC_VECTOR(7 downto 0); cin : in STD_LOGIC; o : out STD_LOGIC_VECTOR(7 downto 0); cout : out STD_LOGIC); end adder8bit; architecture Behavioral...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT