29-11-2012, 11:19
16-12-2012, 18:05
Dejo el VHDL del ejercicio 4, si alguien me lo corrige estarí[/code]a genial
--vhdl de maquina de estados conversion natural->complementoa2
library ieee;
use ieee.std_logic_1164.all;
--
entity maqestados is
port (y: in std_logic; z: out std_logic);
end maqestados;
--
architecture logica of maqestados is
type tipo_estado is (a,b,c,d,e,f,g);
signal estado: tipo_estado:=a;
signal est_prox: tipo_estado;
begin
process (estado)
begin
case estado is
when a=>if y='0' then z='0'; est_prox<=b; elsif y='1' then z='1'; est_prox<=c;
when b=>if y='0' then z='0'; est_prox<=d; elsif y='1' then z='1'; est_prox<=e;
when c=>if y='0' the z='1'; est_prox<=e; elsif y='1' then z='0'; est_prox<=e;
when d=>if y='0' the z='0'; est_prox<=f; elsif y='1' then z='1'; est_prox<=g;
when e=>if y='0' the z='1'; est_prox<=g; elsif y='1' then z='0'; est_prox<=g;
when f=>if y='0' the z='0'; est_prox<=a; elsif y='1' then z='1'; est_prox<=a;
when g=>if y='0' the z='1'; est_prox<=a; elsif y='1' then z='0'; est_prox<=a;
end case;
end process;
end logica;
--vhdl de maquina de estados conversion natural->complementoa2
library ieee;
use ieee.std_logic_1164.all;
--
entity maqestados is
port (y: in std_logic; z: out std_logic);
end maqestados;
--
architecture logica of maqestados is
type tipo_estado is (a,b,c,d,e,f,g);
signal estado: tipo_estado:=a;
signal est_prox: tipo_estado;
begin
process (estado)
begin
case estado is
when a=>if y='0' then z='0'; est_prox<=b; elsif y='1' then z='1'; est_prox<=c;
when b=>if y='0' then z='0'; est_prox<=d; elsif y='1' then z='1'; est_prox<=e;
when c=>if y='0' the z='1'; est_prox<=e; elsif y='1' then z='0'; est_prox<=e;
when d=>if y='0' the z='0'; est_prox<=f; elsif y='1' then z='1'; est_prox<=g;
when e=>if y='0' the z='1'; est_prox<=g; elsif y='1' then z='0'; est_prox<=g;
when f=>if y='0' the z='0'; est_prox<=a; elsif y='1' then z='1'; est_prox<=a;
when g=>if y='0' the z='1'; est_prox<=a; elsif y='1' then z='0'; est_prox<=a;
end case;
end process;
end logica;
- Off-topic:
- Falta agregar VHDL a la barra de código del editor de mensaje brunodiaz ... no sé si tiene sentido, se usa en TDI y no sé si alguna otra materia también.
22-12-2012, 12:33
--vhdl de maquina de estados conversion natural->complementoa2
library ieee;
use ieee.std_logic_1164.all;
--
entity maqestados is
port (y: in std_logic; z: out std_logic);
end maqestados;
--
architecture logica of maqestados is
type tipo_estado is (a,b,c,d,e,f,g);
signal estado: tipo_estado:=a;
signal est_prox: tipo_estado;
begin
process (estado)
begin
case estado is
when a=>if y='0' then z='0'; est_prox<=b; elsif y='1' then z='1'; est_prox<=c;
when b=>if y='0' then z='0'; est_prox<=d; elsif y='1' then z='1'; est_prox<=e;
when c=>if y='0' the z='1'; est_prox<=e; elsif y='1' then z='0'; est_prox<=e;
when d=>if y='0' the z='0'; est_prox<=f; elsif y='1' then z='1'; est_prox<=g;
when e=>if y='0' the z='1'; est_prox<=g; elsif y='1' then z='0'; est_prox<=g;
when f=>if y='0' the z='0'; est_prox<=a; elsif y='1' then z='1'; est_prox<=a;
when g=>if y='0' the z='1'; est_prox<=a; elsif y='1' then z='0'; est_prox<=a;
end case;
end process;
end logica;
matyary. Listo
22-12-2012, 15:21
Buenísimo, quedó 10pts.
--vhdl de maquina de estados conversion natural->complementoa2
library ieee;
use ieee.std_logic_1164.all;
--
entity maqestados is
port (y: in std_logic; z: out std_logic);
end maqestados;
--
architecture logica of maqestados is
type tipo_estado is (a,b,c,d,e,f,g);
signal estado: tipo_estado:=a;
signal est_prox: tipo_estado;
begin
process (estado)
begin
case estado is
when a=>if y='0' then z='0'; est_prox<=b; elsif y='1' then z='1'; est_prox<=c;
when b=>if y='0' then z='0'; est_prox<=d; elsif y='1' then z='1'; est_prox<=e;
when c=>if y='0' then z='1'; est_prox<=e; elsif y='1' then z='0'; est_prox<=e;
when d=>if y='0' then z='0'; est_prox<=f; elsif y='1' then z='1'; est_prox<=g;
when e=>if y='0' then z='1'; est_prox<=g; elsif y='1' then z='0'; est_prox<=g;
when f=>if y='0' then z='0'; est_prox<=a; elsif y='1' then z='1'; est_prox<=a;
when g=>if y='0' then z='1'; est_prox<=a; elsif y='1' then z='0'; est_prox<=a;
end case;
end process;
end logica;