Mudanças entre as edições de "Circuito Somador - Guide"
Ir para navegação
Ir para pesquisar
(Limpou toda a página) |
|||
Linha 1: | Linha 1: | ||
+ | __NOTOC__ | ||
+ | ==Estrutura== | ||
+ | * | ||
+ | * | ||
+ | ==Código VHDL== | ||
+ | <syntaxhighlight lang=vhdl> | ||
+ | --Book: GUIDE/175 | ||
+ | --8 bits | ||
+ | ---------------------------------------------------------------------------- | ||
+ | -- two_s_comp_adder.vhd | ||
+ | -- | ||
+ | -- section 7.8 subtractor and adder subtractor | ||
+ | -- A two´s complement adder | ||
+ | -- | ||
+ | ---------------------------------------------------------------------------- | ||
+ | LIBRARY IEEE; | ||
+ | USE IEEE.STD_LOGIC_1164.ALL; | ||
+ | USE IEEE.STD_LOGIC_ARITH.ALL; | ||
+ | USE IEEE.STD_LOGIC_UNSIGNED.ALL; | ||
+ | ENTITY two_s_comp_adder IS | ||
+ | GENERIC(n: NATURAL := 8); | ||
+ | PORT( | ||
+ | x, y: IN STD_LOGIC_VECTOR(n DOWNTO 0); | ||
+ | c_in: IN STD_LOGIC; | ||
+ | z: OUT STD_LOGIC_VECTOR(n+1 DOWNTO 0) | ||
+ | ); | ||
+ | END two_s_comp_adder; | ||
+ | |||
+ | ARCHITECTURE behavior OF two_s_comp_adder IS | ||
+ | BEGIN | ||
+ | z <= (x(n)&x) + (y(n)&y) + c_in; | ||
+ | END behavior; | ||
+ | </syntaxhighlight> | ||
+ | |||
+ | ==Testbench== | ||
+ | *Código | ||
+ | *Resultado (print) | ||
+ | |||
+ | ==Simulações== | ||
+ | {| border="1" cellpadding="5" cellspacing="0" style="text-align: center;" | ||
+ | ! colspan="1" style="background: #efefef;" | Nº Bits | ||
+ | ! colspan="1" style="background: #efefef;" | ALMs | ||
+ | ! colspan="1" style="background: #efefef;" | Delay | ||
+ | ! colspan="1" style="background: #efefef;" | Potência (mW) | ||
+ | |- | ||
+ | | x || x || x || x | ||
+ | |- | ||
+ | | x || x || x || x | ||
+ | |- | ||
+ | | x || x || x || x | ||
+ | |- | ||
+ | | x || x || x || x | ||
+ | |- | ||
+ | |} |
Edição atual tal como às 22h35min de 5 de dezembro de 2015
Estrutura
Código VHDL
--Book: GUIDE/175
--8 bits
----------------------------------------------------------------------------
-- two_s_comp_adder.vhd
--
-- section 7.8 subtractor and adder subtractor
-- A two´s complement adder
--
----------------------------------------------------------------------------
LIBRARY IEEE;
USE IEEE.STD_LOGIC_1164.ALL;
USE IEEE.STD_LOGIC_ARITH.ALL;
USE IEEE.STD_LOGIC_UNSIGNED.ALL;
ENTITY two_s_comp_adder IS
GENERIC(n: NATURAL := 8);
PORT(
x, y: IN STD_LOGIC_VECTOR(n DOWNTO 0);
c_in: IN STD_LOGIC;
z: OUT STD_LOGIC_VECTOR(n+1 DOWNTO 0)
);
END two_s_comp_adder;
ARCHITECTURE behavior OF two_s_comp_adder IS
BEGIN
z <= (x(n)&x) + (y(n)&y) + c_in;
END behavior;
Testbench
- Código
- Resultado (print)
Simulações
Nº Bits | ALMs | Delay | Potência (mW) |
---|---|---|---|
x | x | x | x |
x | x | x | x |
x | x | x | x |
x | x | x | x |