Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Name Question: Referring the following diagram, implement the VHDL code for the

ID: 2291702 • Letter: N

Question

Name Question: Referring the following diagram, implement the VHDL code for the design of decoder circuit based on the behavioral modeling Bin3 downto Dout(7 downto O) Decoder ck Reset Set The behavioral of the Decoder can be described as follows When the 'Reset' input is high, the decoder output Dout' will become "0000" after 10 ns When the 'Set' input is high, the decoder output Dout' will become "1111" after 10 ns Otherwise, when the rising edge of the clock signal 'Clk arrives, the value of the Decoder output 'Dout will be dependent on the value of the 4-bit binary input 'Bin' as given by the following table: Bin (3 downto 0) Dout (7 downto 0) 0001 0010 0011 0100 0101 0000 0110 0110 1101 0111 1001 0011 0011 0101 1011

Explanation / Answer

There is logical error in the question provided. The decoder main purpose is to decode the uniquely encoded signal. In the question provided for two inputs 1000 and 1010 output is same. The vhdl code for above logic will be

library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;

entity decoder is
Port ( clk :in STD_LOGIC;
rst : in STD_LOGIC;
set : in STD_LOGIC;
s : in STD_LOGIC_VECTOR (3 downto 0);
y : out STD_LOGIC_VECTOR (7 downto 0));
end decoder;

    process (clk_50mhz)
    begin
        if clk_50mhz'event and clk_50mhz = '1' then
            if rst = '1' then
                y <= '00000000' ;
            elsif(set = '1') then
                y <= '00000000';                   
             elsif(s = '0000') then
                y <= '01111110';
                  elsif(s = '0001') then
                y <= '00000110';
                  elsif(s = '0010') then
                y <= '01101101';
                  elsif(s = '0011') then
                y <= '01111001';
                  elsif(s = '0100') then
                y <= '00110011';
                  elsif(s = '0101') then
                y <= '01011011';
                  elsif(s = '0110') then
                y <= '01011111';
                  elsif(s = '0111') then
                y <= '01110000';
                  elsif(s = '1000') then
                y <= '01111111';
                elsif(s = '1001') then
                y <= '01110111;
                  elsif(s = '1010') then
                y <= '01111111;
                  elsif(s = '1011') then
                y <= '11111000';
                  elsif(s = '1100') then
                y <= '11110100';
                  elsif(s = '1101') then
                y <= '11110110';
                  elsif(s = '1110') then
                y <= '11110111';
                  elsif(s = '1011') then
                y <= '11110001';
              end if ;
        end if ;
    end process ;

The test setup will be