Write the source code for a 16-bit adder using the ‘+’ operator. Use the following information as a guide:
a. Use the names in the Adder Symbol/diagram above to name your
block and its ports (all lower-case). For example dataa[15:0]
signal name in VHDL would be dataa : in unsiged (15 downto
0);
b. All inputs and outputs should be declared as type UNSIGNED vs
STD_LOGIC_VECTOR. c. Do not worry about rollover with this adder.
This adder is already wide enough to account for all the values it
will be adding together.
d. Make sure to include the library and package declarations at the beginning of the file. You will need the IEEE.NUMERIC_STD package. e. If you would prefer using a different text editor, please feel free to do so. Just make sure you save your VHDL file in the project directory.
bleow is the code
====================================
LIBRARY IEEE;
USE IEEE.STD_LOGIC_1164.ALL;
USE IEEE.NUMERIC_STD.ALL;
ENTITY adder_tb IS
END ENTITY adder_tb;
ARCHITECTURE stimulus OF adder_tb IS
-- Component declaration for adder block
COMPONENT adder
PORT(
dataa, datab: IN
UNSIGNED(15 DOWNTO 0);
sum: OUT
UNSIGNED(15 DOWNTO 0)
);
END COMPONENT;
-- Signals to connect to DUT
SIGNAL dataa, datab, sum : UNSIGNED (15 DOWNTO 0);
BEGIN -- beginning of architecture body
-- instantiate unit under test (adder)
adder1 : adder PORT MAP
(dataa => dataa, datab =>
datab, sum => sum);
-- Assign values to "dataa" and "datab" to test
adder block
dataa <= x"0008", x"0000" AFTER 20 NS, x"000A"
AFTER 30 NS;
datab <= x"0005", x"0001" AFTER 20 NS, x"0005"
AFTER 30 NS;
END ARCHITECTURE stimulus;
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
entity adder is
PORT(
dataa, datab: IN UNSIGNED(15 DOWNTO 0);
sum: OUT UNSIGNED(15 DOWNTO 0)
);
end adder;
architecture arch of adder is
begin
sum <= dataa + datab;
end arch;
----------------------------------------------------
--Simulation on ModelSim

Write the source code for a 16-bit adder using the ‘+’ operator. Use the following information...
QUESTION 1 Complete the following peice of VHDL code with the necessary VHDL statements for a counter that counts through this sequence(0,9,17,15,4,26) repeatedly. library IEEE use IEEE.STD_LOGIC_1164 ALL entity GCC is Port ( systemClock, reset in STD_LOGIC end GCC architecture Behavioral of GCC is stateOutput out STD LOGIC_ VECTOR (4 downto 0)) component FreqDivider is Port (systemClock in STD_LOGIC; slowClock: out STD LOGIC); end component, signal nextState, presentState: std_logic_vector(5 downto 0) := "00000"; signal slowClock: std_logic begin FD0: FreqDivider port...
Write a test bench for the following VHDL code -------------------------------------------------------------------------------------------------------------------------------- LIBRARY ieee ; USE ieee.std_logic_1164.all ; ENTITY registern IS GENERIC (N: INTEGER :=4); -- INTEGER=32, 16, ….. PORT (D : IN STD_LOGIC_VECTOR (N-1 downto 0); clk, reset, Load : IN STD_LOGIC ; Q : OUT STD_LOGIC_VECTOR (N-1 downto 0 )) ; END registern; ARCHITECTURE behavior OF registern IS BEGIN PROCESS (clk) BEGIN IF clk' EVENT AND clk='1' THEN IF (reset ='0') THEN --synchronous reset Q<=(OTHERS=>’0’); ELSIF (L ='0') THEN Q<=D;...
8.(5 points).There is an error in following VHDL code. Find the error and correct (only that line of code). LIBRARY ieee; USE ieee.std_logic_1164.all; ENTITY dec2to4 IS PORT (i IN STD LOGIC VECTOR (1 DOWNTO 0); : En IN STD_LOGIC; d OUT STD LOGIC); END dec2to4; ARCHITECTURE dataflow OF dec2to4 IS BEGIN SIGNAL Eni: STD_LOGIC_VECTOR(2 DOWNTO 0); Eni <= En & i; -concatenate signals WITH Eni SELECT d <"0001" WHEN "100" "0010" WHEN "101", "0100" WHEN "110", "1000" WHEN "111", 0000"...
3. Study the VHDL code below for the multiplexer: -mux.vhd library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; use jeee.std logic.arith.all; entity mux is port DIFF1, DIFF2: n std_logic_vector(4 downto O); ABSLT: out std_logic_vector(4 downto 0); CO: in std logic ); end mux; architecture behv of mux is begin with CO select ABSLT DIFF1 when o, a CO-0 selects B-A DIFF2 when 1',a Co-1 selects A-B "ZZZZZ" when others·.. high impedance otherwise end behy
I'm having a hard time writing code for vhdl. Trying to get a 4 bit multipiler with full adder, however I keep getting errors. Was wondering if you can help me with my code. The question is to design a 4-bit multiplier in VHDL by using component statements. library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_arith.all; use ieee.std_logic_unsigned.all; --entity declaration entity multi is port( A: in std_logic_vector (3 downto 0); B: in std_logic_vector (3 downto 0); P: out std_logic_vector (7 downto 0)...
VHDL QUESTION: How can i make a FULL ADDER instantiating a HALF ADDER} THIS IS MY HA CODE: library IEEE; use IEEE.std_logic_1164.ALL; entity HA is port(A, B: in bit; SUM, CARRY: out bit); end HA; architecture RTL of HA is begin SUM <= A xor B; CARRY <= A and B; end RTL; CAN SOMEONE EXPLAIN ME HOW IT WORKS TO INSTANCIATE COMPONENTS IN VHDL AND HOW TO MAKE THE...
Need help with VDHL code. THis is a random number generator. Want to be able so that a number is generated when a button is pushed, not when the clock is high. library IEEE; use IEEE.STD_LOGIC_1164.ALL; -- Uncomment the following library declaration if using -- arithmetic functions with Signed or Unsigned values --use IEEE.NUMERIC_STD.ALL; -- Uncomment the following library declaration if instantiating -- any Xilinx leaf cells in this code. --library UNISIM; --use UNISIM.VComponents.all; library IEEE; use IEEE.STD_LOGIC_1164.ALL; entity RanNum...
b. Suppose you are provided with a 4-bit ripple carry adder. It has the following entity declaration and schematic representation А(3:0] B[3: entity fourbit FA is portA, B in std logic_vector (3 downto 0); 4-bit RCA Cin in std_logic; S out stdlogic_vector (3 downto 0) Cout out std logic: Cin Cout S3:0] end fourbitFA Create a VHDL architecture for the following circuit (15 Marks) C3:0] D[3:0] A[3:0] B[3:0] Е[3:0] F[3:0] 4-bit RCA 4-bit RCA inA 4-bit RCA CinB CinC Coutl...
Problem 5 (8 pts) Write a VHDL code (including an entity definition and an architecture definition) to describe a 8:1 multiplexer in which each input port is of type STD_LOGIC_VECTOR and each input port has 4 bits, and the output Y is also a STD_LOGIC_VECTOR with 4 bits. Your code's architecture definition should use "with...select..." structure. The code to include header files is already given below. library IEEE; use IEEE.STD_LOGIC_1164.all;
Please fully answer BOTH parts of the question (a) and (b). a) Draw the high level synthesized diagram of the following VHDL code. What does the following circuit do? Write the sequence of output generated by this circuit. library ieee; use ieee.std_logic_1164.all; entity sequence is port ( cout :out std_logic_vector (3 downto 0); clk :in std_logic; reset :in std_logic ); end entity; architecture rtl of sequence is signal count :std_logic_vector (3 downto 0); begin process (clk) begin if (rising_edge(clk)) then...