Mudanças entre as edições de "Circuito Serializador - Pedroni VHDL"
Ir para navegação
Ir para pesquisar
(Criou página com '__NOTOC__ ==Estrutura== * * ==Código VHDL== <syntaxhighlight lang=vhdl> </syntaxhighlight> ==Testbench== *Código *Resultado (print) ==Simulações== {| border="1" cellpadding="5" cellspacing="0" s...') |
|||
Linha 1: | Linha 1: | ||
__NOTOC__ | __NOTOC__ | ||
==Estrutura== | ==Estrutura== | ||
− | * | + | *Circuito serializador (Recebe logic_vector, sai logic) |
− | * | + | *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_serializer is | ||
+ | |||
+ | generic (n: integer := 4 ; bits : integer :=2); | ||
+ | port( | ||
+ | clk: in std_logic; | ||
+ | din: in std_logic_vector(n-1 downto 0); | ||
+ | count_out: out std_logic_vector(bits-1 downto 0); | ||
+ | dout: out std_logic); | ||
+ | --sclk_teste: out std_logic); | ||
+ | end entity; | ||
+ | |||
+ | architecture fast_serializer of fast_serializer is | ||
+ | |||
+ | signal internal: std_logic_vector(n-1 downto 0); | ||
+ | |||
+ | |||
+ | begin | ||
+ | |||
+ | process(clk) | ||
+ | variable count : integer range 0 to n; | ||
+ | begin | ||
+ | if(rising_edge(clk)) then | ||
+ | count := count +1; | ||
+ | if (count= n-1) then --enable to update "internal" | ||
+ | internal <= din; | ||
+ | elsif (count=n) then --count is 0-to-(n-1) | ||
+ | count := 0; | ||
+ | end if; | ||
+ | dout <= internal(count); --continous serial output | ||
+ | end if; | ||
+ | count_out <= std_logic_vector(to_unsigned(count, bits)); | ||
+ | end process; | ||
+ | end architecture; | ||
</syntaxhighlight> | </syntaxhighlight> | ||
+ | {{Collapse bottom}} | ||
==Testbench== | ==Testbench== | ||
− | * | + | {{Collapse top | Código}} |
− | *Resultado | + | <syntaxhighlight lang=vhdl> |
+ | |||
+ | </syntaxhighlight> | ||
+ | {{Collapse bottom}} | ||
+ | |||
+ | *Resultado Funcional: | ||
+ | [[Arquivo: .png | 200px]] | ||
+ | *Resultado Temporal: | ||
+ | [[Arquivo: .png | 200px]] | ||
==Simulações== | ==Simulações== |
Edição das 11h01min de 29 de março de 2016
Estrutura
- Circuito serializador (Recebe logic_vector, sai logic)
- 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_serializer is
generic (n: integer := 4 ; bits : integer :=2);
port(
clk: in std_logic;
din: in std_logic_vector(n-1 downto 0);
count_out: out std_logic_vector(bits-1 downto 0);
dout: out std_logic);
--sclk_teste: out std_logic);
end entity;
architecture fast_serializer of fast_serializer is
signal internal: std_logic_vector(n-1 downto 0);
begin
process(clk)
variable count : integer range 0 to n;
begin
if(rising_edge(clk)) then
count := count +1;
if (count= n-1) then --enable to update "internal"
internal <= din;
elsif (count=n) then --count is 0-to-(n-1)
count := 0;
end if;
dout <= internal(count); --continous serial output
end if;
count_out <= std_logic_vector(to_unsigned(count, bits));
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 |