Question

In quartus prime Implement a 4-bit adder/subtractor using structural VHDL. The circuit will have two 4-bit...

In quartus prime

  1. Implement a 4-bit adder/subtractor using structural VHDL. The circuit will have two 4-bit data inputs (A and B), a control line (add /sub), a 4-bit sum output (S), a carry-out bit (Cout), and an overflow flag. You need two VHDL files (fulladd.vhd) and (hybrid.vhd) to implement the design. VHDL code, fulladd.vhd, will implement a single-bit full adder. The VHDL file, hybrid.vhd, will create four instances of the single-bit full adder. Four XOR gates will be needed to create the adder/subtractor. You also need another XOR gate to generate the overflow.

Devise a set of test input vectors (values) that will be used to verify that the circuit is working properly.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

solution:

-- This is the XOR gate

library ieee;

use ieee.std_logic_1164.all;

--

entity xorGate is     

   port( A, B : in std_logic;

            F : out std_logic);

end xorGate;

--

architecture func of xorGate is

begin

   F <= A xor B;

end func;

--*============================

-- This is the NOT gate

library ieee;

use ieee.std_logic_1164.all;

--

entity NOTGATE is     

   port( A: in std_logic;

        F : out std_logic);

end NOTGATE;

--

architecture func of NOTGATE is

begin

   F <= not A;

end func;

--*============================

-- This is the FULL ADDER

library ieee;

use ieee.std_logic_1164.all;

--

entity fulladd is

   port( X, Y, Cin : in std_logic;

         sum, Cout : out std_logic);

end fulladd;

--Dataflow architecture.

--See Full Adder on Teahlab.com for structural version

architecture func of fulladd is

begin

   sum <= (X xor Y) xor Cin;

   Cout <= (X and (Y or Cin)) or (Cin and Y);

end func;

--*============================*============================

--Now we build the four bit Adder Subtractor

library ieee;

use ieee.std_logic_1164.all;

entity adderSubtractor is

   port( mode             : in std_logic;

          A3, A2, A1, A0 : in std_logic;

          B3, B2, B1, B0 : in std_logic;

          S3, S2, S1, S0 : out std_logic;

                  Cout, V : out std_logic);

end adderSubtractor;

--Structural architecture

architecture struct of adderSubtractor is

   component NOTGATE is             --NOT component

       port( A: in std_logic;

             F : out std_logic);

   end component;

   component xorGate is             --XOR component

       port( A, B : in std_logic;

                F : out std_logic);

   end component;

   component fulladd is                 --FULL ADDER component

      port( X, Y, Cin : in std_logic;

            sum, Cout : out std_logic);

   end component;

   --interconnecting wires

   signal C1, C2, C3, C4: std_logic; --intermediate carries

   signal n0, n1, n2, n3 : std_logic; --not outputs

begin

   GN0: NOTGATE port map(B0, n0);

   GN1: NOTGATE port map(B1, n1);

   GN2: NOTGATE port map(B2, n2);

   GN3: NOTGATE port map(B3, n3);

   FA0: fulladd port map(A0, n0, ‘1’, S0, C1); -- S0

   FA1: fulladd port map(A1, n1, C1, S1, C2); -- S1

   FA2: fulladd port map(A2, n2, C2, S2, C3); -- S2

   FA3: fulladd port map(A3, n3, C3, S3, C4); -- S3

   Vout: xorGate port map(C3, C4, V);                -- V

   Cout <= C4;                                       -- Cout

end struct;

----------------------------------------------------------END

----------------------------------------------------------END

please give me like..its help me to write more questions,,thank you,,

Add a comment
Know the answer?
Add Answer to:
In quartus prime Implement a 4-bit adder/subtractor using structural VHDL. The circuit will have two 4-bit...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Introduction: This experiment studies the design of an 8-bit adder/subtractor circuit using VHDL capture. The experiment...

    Introduction: This experiment studies the design of an 8-bit adder/subtractor circuit using VHDL capture. The experiment investigates the implementation of addition and subtraction operations with circuits. This lab uses the virtual simulation environment to validate the design practically in the FPGA board. Equipment: • This experiment requires Quartus Prime and the Intel's DE2-115 FPGA board. • All students should have the Intel QP and ModelSim-Intel-Starter-Edition softwares installed in personal computers. • VPN connection to UNB Network and remote desktop software...

  • 4. Design a 4-bit Adder / Subtractor. Follow the steps given below. (a) Write the VHDL...

    4. Design a 4-bit Adder / Subtractor. Follow the steps given below. (a) Write the VHDL code for a 1-bit Full Adder. The VHDL code must include an entity and an architecture. (b) Draw the circuit diagram for a 4-bit Adder / Subtractor. The circuit diagram may include the following logic elements: 1-bit Full Adders (shown as a block with inputs and outputs) Any 2-input logic gates Multiplexers Do not draw the logic circuit for the 1-bit Full Adder.

  • Implement the 8-bit Gate level ALU shown in the figure below in VHDL (Full adder & subtractor & all logical oper...

    Implement the 8-bit Gate level ALU shown in the figure below in VHDL (Full adder & subtractor & all logical operations & flags implementations) 31 ALUControlo Sum31 ALUContro out Sum 10 0 00 ALUControl 、ノ Resullgi Negative Zero Result ALUFlags o Verflow Figure 1 N-bit ALU with output flags 31 ALUControlo Sum31 ALUContro out Sum 10 0 00 ALUControl 、ノ Resullgi Negative Zero Result ALUFlags o Verflow Figure 1 N-bit ALU with output flags

  • Building and testing basic combinational circuits using Verilog HDL Description: Build and test the following circuits using gate-level modeling in Verilog HDL 1.3-input majority function 2.Condition...

    Building and testing basic combinational circuits using Verilog HDL Description: Build and test the following circuits using gate-level modeling in Verilog HDL 1.3-input majority function 2.Conditional inverter (see the table below: x - control input, y -data input). Do NOT use XOR gates for the implementation. Output 3. Two-input multiplexer (see the table below: x.y -data inputs, z- control input) Output 4. 1-bit half adder. 5. 1-bit full adder by cascading two half adders 6.1-bit full adder directly (as in...

  • 5) Following is a NAND only 1-bit full adder circuit diagram. Using this 1-bit full adder...

    5) Following is a NAND only 1-bit full adder circuit diagram. Using this 1-bit full adder a 128-bit combined addition / subtraction circuit (ripple carry implementation) with overflow detection has been implemented using only 2-input NAND logic gate. What is the minimum number of NAND gates required for this circuit? [4pts) CI- Toyota

  • Building and testing basic combinational circuits using Verilog HDL Description: Build and test t...

    Building and testing basic combinational circuits using Verilog HDL Description: Build and test the following circuits using gate-level modeling in Verilog HDL. 1. 3-input majority function. 2. Conditional inverter (see the table below: x - control input, y - data input). Do NOT use XOR gates for the implementation.    x y Output 0   y 1   y' 3. Two-input multiplexer (see the table below: x,y - data inputs, z - control input).     z Output 0 x 1 y 4. 1-bit half...

  • (32 pts) Adder/ Subtractor 11. (8 pts) Given a l-bit full adder (you can use the...

    (32 pts) Adder/ Subtractor 11. (8 pts) Given a l-bit full adder (you can use the box representation as below) show the circuitry required to make it into a 4-bit full adder and subtractor. 12. (12 pts) Show the hardware required to compute the 4 primary flags for your 4-bit add sub unit carry (C), zero (Z), overflow (V), and sign (N). 13.(12 pts) Show the results for the addition below. Also show the equivalent decimal numbers for each Ain...

  • Implement the following bit sequential Adder-Subtractor design. X and Y are two operand inputs and Z...

    Implement the following bit sequential Adder-Subtractor design. X and Y are two operand inputs and Z is for the control signal i.e. Z is the selection bit. When Z has value 0, the circuit is an adder, meanwhile, the D flip-flop should be initialized to 0 for each addition. When Z has value 1, it performs subtraction, meanwhile, the D flip-flop should be initialized to 1 for each subtraction. Test your Adder-Subtractor circuit on the following operations and use the...

  • FPGA (Interconnected Adder Modules) In this lab you will implement adder circuits using data flow modelling....

    FPGA (Interconnected Adder Modules) In this lab you will implement adder circuits using data flow modelling. You will also create 3-bit adder by employing interconnected 1-bit full adders. Data flow modelling of a 1-bit full adder circuit. Data flow modelling of a 3-bit adder circuit. There will be 7 inputs (X2, X1, X0, Y2, Y1, YO, Cin) - please put them in that order - Switch 6 will represent X2 and Switch 0 will be the Cin. There should be...

  • DOING NUMBER 7 of VHDL lab "write your own full-adder in VHDL " is my only...

    DOING NUMBER 7 of VHDL lab "write your own full-adder in VHDL " is my only request. Do the rest, if you have time. To verify and apply techniques to build half adders and full adder to perform additions using gates. For each part of the procedure, show the number of that section and include a logic diagram of the circuit, truth table for the circuit, and any other necessary information. Adder Implementation 1. Construct a binary half-adder and record...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT