Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (3 votes)
4K views

Half Subtractor VHDL Code Using Structrucral Modeling

The document describes a VHDL code for a half subtractor using structural modeling. It includes library and package declarations, an entity declaration for the half subtractor with input and output ports, a signal declaration, component declarations for XOR, AND and NOT gates, and an architecture body that port maps the components to perform subtraction. The code structurally describes and implements a half subtractor circuit in VHDL.

Uploaded by

OP2R
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (3 votes)
4K views

Half Subtractor VHDL Code Using Structrucral Modeling

The document describes a VHDL code for a half subtractor using structural modeling. It includes library and package declarations, an entity declaration for the half subtractor with input and output ports, a signal declaration, component declarations for XOR, AND and NOT gates, and an architecture body that port maps the components to perform subtraction. The code structurally describes and implements a half subtractor circuit in VHDL.

Uploaded by

OP2R
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

INFOOP2R.WIX.

COM/OP2R

HALF SUBTRACTOR VHDL CODE USING STRUCTURAL MODELING

Library declaration library IEEE; use IEEE.STD_LOGIC_1164.ALL; --------------------------------------------

Std_logic_1164; package for std_logic (predefined data types).

entity half_subtractor is Port ( a, b: in STD_LOGIC; diff ,borrow: out STD_LOGIC); end half_subtractor; --------------------------------------------architecture Behavioral of half_subtractor is ---------------------------------------------Signal s1: in std_logic; component xor_1 is Port ( o,p : in STD_LOGIC; q : out STD_LOGIC); end component; component and_1 is Port ( x,y : in STD_LOGIC; z : out STD_LOGIC); end component; component not_1 is port (u: in std_logic; v: out std_logic); end component; ----------------------------------------------begin X1: xor_1 port map (a, b, diff); X2: not_1 port map (a, s1); x2: and_1 port map (s1, b, borrow); ----------------------------------------------end Behavioral;

Entity declaration. a, b: - input port bits (bits to be added) diff, borrow: - output port bits.

Signal declaration. Signal s1 will act as inout port. Component (Ex-or, And, Not) declaration These components are describing the structure view of half adder.

Architecture statements part (Architecture body). Components are port mapped to perform the circuit (subtract) operation.

INFOOP2R.WIX.COM/OP2R

INFOOP2R.WIX.COM/OP2R RTL VIEW:OUT PUT WAVEFORMS:-

INFOOP2R.WIX.COM/OP2R

You might also like