Digital Electronics: Please do not use C++ programming functions here because I
ID: 2083846 • Letter: D
Question
Digital Electronics:
Please do not use C++ programming functions here because I am not allow to use it.
please write the code and compile it to make sure that it is correct and working.
Many thanks!
Design of a modulus 10 Up/Down Johnson Counter you will design and implement a modulus 10 Up/Down Johnson Counter with enable. The counter has an asynchronous reset input which brings the outputs to 0 as soon as the rst signal is asserted The counter counts on the negative edge of the clock. Develop the logic for this counter to be self-correcting. e.: If it comes up with a wrong count-correct itself.) The Up/Down Johnson counter has a clock input, CLK, count enable input, CEN, and an up/down control input, ULD. (Develop the function table with the priority being 1) CEN, 2) ULD. The counter has a 5-bit output, count, which outputs the current count as a 5-bit Johnson count. The value of the count will then be decoded in hexadecimal and displayed on the seven segment display. The Even-Odd counter operates as follows: When rst 1', the count should be reset to "00000 Otherwise, if the cen 1', on every clock cycle the counter should count up when ud '1' and count down when ud '0'. If cen '0' the counter holds ad the current value. Block diagram for the counter: CEN U D bit Johnson 5-bit Johnson to seven- Counter Segment decoder RST CLK DExplanation / Answer
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity Counter_VHDL is
port( Number: in std_logic_vector(0 to 4);
Clk: in std_logic;
CEN: in std_logic;
Reset: in std_logic;
U_d: in std_logic;
Output: out std_logic_vector(0 to 4) );
end Counter_VHDL;
architecture Behavioral of Counter_VHDL is
signal temp: std_logic_vector(0 to 4);
begin
process(Clk,Reset)
begin
if Reset='1' then
temp <= "00000";
elsif (Clk='1') then
if CEN='0' then
temp<= Number;
elseif (CEN='1' and U_d='1' )then
temp <= temp + 1;
elsif (CEN='1' and U_d='0') then
temp <= temp-1;
end if;
end if;
end process;
Output <= temp;
end Behavioral;