Question

In: Electrical Engineering

HI can I please know whats wrong in this 2to1 mux code in VHDL code also...

HI can I please know whats wrong in this 2to1 mux code in VHDL code

also please type it out so theres no confusion thank you

-- Code your design here
library IEEE;
use IEEE.std_logic_1164.all;
-- entity declaration for testbench
entity test mux2 is
end test;
--architecture Body declaration for 2to1 mux
-- component declaration of source entity 2to1 mux
component test mux2 is
port (
sel : in std_logic ; --select input,
A : in std_logic ; --data input
B : in std_logic ;--data input
y : out std_logic ); -- mux output
end component;

--internal Signal declarations
singal sel: std_logic;
singal A,B: std_logic;
singal y: std_logic;
begin

--Instantiate Device under test (out) of 2to1 mux
OUT: test mux2
port map (
sel => sel,
A => A,
B => B,
y => y);

--stimulus process
process
begin
sel <= '0'; A <= '0'; B <= '0';
wait for 10 ns;
sel <= '0'; A <= '0'; B <= '1';
wait for 10 ns;
sel <= '0'; A <= '1'; B <= '0';
wait for 10 ns;
sel <= '0'; A <= '1'; B <= '1';
wait for 10 ns;
sel <= '1'; A <= '0'; B <= '0';
wait for 10 ns;
sel <= '1'; A <= '0'; B <= '1';
wait for 10 ns;
sel <= '1'; A <= '1'; B <= '0';
wait for 10 ns;
sel <= '1'; A <= '1'; B <= '1';
wait;
end process;


DESIGN CODE
library IEEE;
use IEEE.std_logic_1164.all;
-- entity declaration for 2-to-1 mux
entity test mux2 is
port (
sel : in std_logic ; --select input,
A : in std_logic ; --data input
B : in std_logic ;--data input
y : out std_logic); -- mux output
end mux2;

--architecture Body declaration for 2to1 mux
architecture Behavioral of test mux2 is
begin
y <= (((not sel) and A) or (sel and B));
end Behavioral;

Solutions

Expert Solution

-- Modified design code for 2 to 1 mux in VHDL

library IEEE;

use IEEE.std_logic_1164.all;

-- entity declaration for 2-to-1 mux

entity mux2 is

port (

sel : in std_logic ; --select input,

A : in std_logic ; --data input

B : in std_logic ;--data input

y : out std_logic); -- mux output

end mux2;

--architecture Body declaration for 2to1 mux

architecture Behavioral of mux2 is

begin

y <= (((not sel) and A) or (sel and B));

end Behavioral;

-- Code your testbench here

library IEEE;

use IEEE.std_logic_1164.all;

-- entity declaration for testbench

entity test_mux2 is

end test_mux2;

--architecture Body declaration for 2to1 mux

architecture behavioral of test_mux2 is

-- component declaration of source entity 2to1 mux

component mux2 is

port (

sel : in std_logic ; --select input,

A : in std_logic ; --data input

B : in std_logic ;--data input

y : out std_logic ); -- mux output

end component;

--internal Signal declarations

signal sel: std_logic;

signal A,B: std_logic;

signal y: std_logic;

begin

--Instantiate Device under test (Dut) of 2to1 mux

DUT:mux2

port map (

sel => sel,

A => A,

B => B,

y => y);

--stimulus process

process

begin

sel <= '0'; A <= '0'; B <= '0';

wait for 10 ns;

sel <= '0'; A <= '0'; B <= '1';

wait for 10 ns;

sel <= '0'; A <= '1'; B <= '0';

wait for 10 ns;

sel <= '0'; A <= '1'; B <= '1';

wait for 10 ns;

sel <= '1'; A <= '0'; B <= '0';

wait for 10 ns;

sel <= '1'; A <= '0'; B <= '1';

wait for 10 ns;

sel <= '1'; A <= '1'; B <= '0';

wait for 10 ns;

sel <= '1'; A <= '1'; B <= '1';

wait;

end process;

END;

-- I verified mux operation with simulation also and simulation waveforms are attached below;


Related Solutions

hi i do not know what is wrong with my python code. this is the class:...
hi i do not know what is wrong with my python code. this is the class: class Cuboid: def __init__(self, width, length, height, colour): self.__width = width self.__length = length self.__height = height self.__colour = colour self.surface_area = (2 * (width * length) + 2 * (width * height) + 2 * (length * height)) self.volume = height * length * width def get_width(self): return self.__width def get_length(self): return self.__length def get_height(self): return self.__height def get_colour(self): return self.__colour def set_width(self,...
I have an unexpected indent with my python code. please find out whats wrong with my...
I have an unexpected indent with my python code. please find out whats wrong with my code and run it to show that it works here is the code : def main(): lis = inputData() customerType = convertAcct2String(lis[0]) bushCost = getBushCost(lis[0],int(lis[1],10)) flowerCost = getFlowerBedCost(int(lis[2],10),int(lis[3],10)) fertiCost = getFertilCost(int(lis[4],10)) totalCost = calculateBill(bushCost,fertiCost,flowerCost) printReciept(customerType,totalCost,bushCost,fertiCost,flowerCost) def inputData(): account, number_of_bushes,flower_bed_length,flower_bed_width,lawn_square_footage = input("Please enter values").split() return [account, number_of_bushes,flower_bed_length,flower_bed_width,lawn_square_footage] def convertAcct2String(accountType): if accountType== "P": return "Preferred" elif accountType == "R": return "Regular" elif accountType == "N": return...
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
Okay, can someone please tell me what I am doing wrong?? I will show the code...
Okay, can someone please tell me what I am doing wrong?? I will show the code I submitted for the assignment. However, according to my instructor I did it incorrectly but I am not understanding why. I will show the instructor's comment after providing my original code for the assignment. Thank you in advance. * * * * * HourlyTest Class * * * * * import java.util.Scanner; public class HourlyTest {    public static void main(String[] args)     {        ...
I have this mystery code. I dont know what the code does. Can somone please explain...
I have this mystery code. I dont know what the code does. Can somone please explain with examples. (python 3.xx) from typing import Dict, TextIO, Tuple, List def exam(d1: Dict[str, List[int]], d2: Dict[int, int]) -> None: """ *Mystery code* """ for key in d1: value = d1[key] for i in range(len(value)): value[i] = d2[value[i]]   
Can you please see what I have done wrong with my program code and explain, This...
Can you please see what I have done wrong with my program code and explain, This python program is a guess my number program. I can not figure out what I have done wrong. When you enter a letter into the program, its supposed to say "Numbers Only" as a response. I can not seem to figure it out.. instead of an error message. import random def menu(): print("\n\n1. You guess the number\n2. You type a number and see if...
I know the code isn't here nut please answer as much as you can thanks! it...
I know the code isn't here nut please answer as much as you can thanks! it is qt creator c++ Question 1 Which of the following is a correct description of ItemList ? It is a QMap and thus an ItemList object is a QMap itself It has a QMap, which cannot be accessed outside this class ItemList uses a heap QMap object QMap used by ItemList uses Item pointers as keys Question 2 Which of the following is true...
Hi, the person who answered this before did it wrong. Can you please show me the...
Hi, the person who answered this before did it wrong. Can you please show me the formulas of how to answer this. Hi-Tek Manufacturing Inc. makes two types of industrial component parts—the B300 and the T500. An absorption costing income statement for the most recent period is shown below: Hi-Tek Manufacturing Inc. Income Statement Sales $ 1,718,000 Cost of goods sold 1,220,369 Gross margin 497,631 Selling and administrative expenses 650,000 Net operating loss $ (152,369) Hi-Tek produced and sold 60,300...
4 of these questions are wrong. I need to know which question I got wrong because...
4 of these questions are wrong. I need to know which question I got wrong because I am not sure. During the early and middle twentieth century, there was a sharp increase in human birth rate. a sharp decrease in human death rate. (both) (neither) True/False: If you ask a population ecologist, all the individuals in a population belong to the same species. : True A single population might exist in multiple territories that do not overlap, with no migration...
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...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT