Mudanças entre as edições de "Circuito Deserializador - Pedroni VHDL"
Ir para navegação
Ir para pesquisar
Linha 1: | Linha 1: | ||
__NOTOC__ | __NOTOC__ | ||
==Estrutura== | ==Estrutura== | ||
− | * | + | *Circuito deserializador (Recebe logic, sai logic_vector) |
− | * | + | *Possui um contador de teste afim de depuração (Exemplo do Loop: conta até 3 e joga o bit que está na entrada ṕara a saída.) |
− | == | + | ==VHDL== |
+ | {{Collapse top | Código}} | ||
<syntaxhighlight lang=vhdl> | <syntaxhighlight lang=vhdl> | ||
− | + | library ieee; | |
− | + | use ieee.std_logic_1164.all; | |
+ | use ieee.numeric_std.all; | ||
− | + | entity fast_deserializer is | |
− | entity | + | generic (n: integer := 4; bits : integer :=2); |
+ | port( | ||
+ | clk: in std_logic; | ||
+ | din: in std_logic; | ||
+ | count_out: out std_logic_vector(bits-1 downto 0); -- so para depuracao | ||
+ | --sclk_teste: out std_logic; | ||
+ | dout: out std_logic_vector (n-1 downto 0)); | ||
+ | end entity; | ||
+ | |||
+ | architecture fast_deserializer of fast_deserializer is | ||
+ | |||
+ | begin | ||
− | + | process(clk) | |
− | + | variable count : integer range 0 to n := 0; | |
− | + | variable internal: std_logic_vector (n-1 downto 0); | |
− | + | begin | |
− | + | if(rising_edge(clk)) then | |
− | + | internal(count) := din; | |
− | + | count_out <= std_logic_vector(to_unsigned(count, bits)); | |
− | + | count := count +1; | |
− | + | if (count= n) then --enable to update "internal" | |
− | + | dout <= internal; | |
− | + | count := 0; | |
− | + | end if; | |
− | + | end if; | |
− | + | ||
− | + | end process; | |
− | + | end architecture; | |
− | + | ||
− | + | </syntaxhighlight> | |
− | + | {{Collapse bottom}} | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | -- | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
+ | ==Testbench== | ||
+ | {{Collapse top | Código}} | ||
+ | <syntaxhighlight lang=vhdl> | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
</syntaxhighlight> | </syntaxhighlight> | ||
+ | {{Collapse bottom}} | ||
− | + | *Resultado Funcional: | |
− | + | [[Arquivo: .png | 200px]] | |
− | *Resultado | + | *Resultado Temporal: |
+ | [[Arquivo: .png | 200px]] | ||
==Simulações== | ==Simulações== |
Edição das 11h00min de 29 de março de 2016
Estrutura
- Circuito deserializador (Recebe logic, sai logic_vector)
- Possui um contador de teste afim de depuração (Exemplo do Loop: conta até 3 e joga o bit que está na entrada ṕara a saída.)
VHDL
Código |
---|
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
entity fast_deserializer is
generic (n: integer := 4; bits : integer :=2);
port(
clk: in std_logic;
din: in std_logic;
count_out: out std_logic_vector(bits-1 downto 0); -- so para depuracao
--sclk_teste: out std_logic;
dout: out std_logic_vector (n-1 downto 0));
end entity;
architecture fast_deserializer of fast_deserializer is
begin
process(clk)
variable count : integer range 0 to n := 0;
variable internal: std_logic_vector (n-1 downto 0);
begin
if(rising_edge(clk)) then
internal(count) := din;
count_out <= std_logic_vector(to_unsigned(count, bits));
count := count +1;
if (count= n) then --enable to update "internal"
dout <= internal;
count := 0;
end if;
end if;
end process;
end architecture;
|
Testbench
Código |
---|
- Resultado Funcional:
- Resultado Temporal:
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 |