Ecco il mio codice:
- Codice: Seleziona tutto
entity MSFresto is
Port ( monete : in STD_LOGIC_VECTOR (2 downto 0);
clk : in STD_LOGIC;
reset : in STD_LOGIC;
resto : out STD_LOGIC_vector(2 downto 0);
lattina : out STD_LOGIC);
end MSFresto;
architecture behavioral of MSFresto is
type stato is (s0,s10,s20,s30,s40,s50,s60,s70,s80,s90);
signal SC, SF : stato;
begin
process(clk,reset)
begin
if reset='1' then SC<=s0;
elsif clk'event and clk='1' then SC<=SF;
else null;
end if;
end process;
process(SC)
begin
case SC is
when s0 => lattina<='0',
=> resto<='000';
when s10 => lattina<='0',
=> resto<='000';
when s20 => lattina<='0',
=> resto<='000';
when s30 => lattina<='0',
=> resto<='000';
when s40 => lattina<='0',
=> resto<='000';
when s50 => lattina<='1',
=> resto<='000';
when s60 => lattina<='1',
=> resto<='001';
when s70 => lattina<='1',
=> resto<='010';
when s80 => lattina<='1',
=> resto<='011';
when s90 => lattina<='1',
=> resto<='100';
when others => null;
end case;
end process;
process(SC, monete)
begin
case SC is
when s0 => if monete="000" then SF<=S0;
elsif monete="001" then SF<=s10;
elsif monete="010" then SF<=s20;
elsif monete="100" then SF<=s50;
else null;
end if;
when s10 => if monete="000" then SF<=S10;
elsif monete="001" then SF<=s20;
elsif monete="010" then SF<=s30;
elsif monete="100" then SF<=s60;
else null;
end if;
when s20 => if monete="000" then SF<=S20;
elsif monete="001" then SF<=s30;
elsif monete="010" then SF<=s40;
elsif monete="100" then SF<=s70;
else null;
end if;
when s30 => if monete="000" then SF<=S30;
elsif monete="001" then SF<=s40;
elsif monete="010" then SF<=s50;
elsif monete="100" then SF<=s80;
else null;
end if;
when s40 => if monete="000" then SF<=S40;
elsif monete="001" then SF<=s50;
elsif monete="010" then SF<=s60;
elsif monete="100" then SF<=s90;
else null;
end if;
when s50 => if monete="000" then SF<=s0;
elsif monete="001" then SF<=s10;
elsif monete="010" then SF<=s20;
elsif monete="100" then SF<=s50;
else null;
end if;
when s60 => if monete="000" then SF<=s0;
elsif monete="001" then SF<=s10;
elsif monete="010" then SF<=s20;
elsif monete="100" then SF<=s50;
else null;
end if;
when s70 => if monete="000" then SF<=S0;
elsif monete="001" then SF<=s10;
elsif monete="010" then SF<=s20;
elsif monete="100" then SF<=s50;
else null;
end if;
when s80 => if monete="000" then SF<=S0;
elsif monete="001" then SF<=s10;
elsif monete="010" then SF<=s20;
elsif monete="100" then SF<=s50;
else null;
end if;
when s90 => if monete="000" then SF<=s0;
elsif monete="001" then SF<=s10;
elsif monete="010" then SF<=s20;
elsif monete="100" then SF<=s50;
else null;
end if;
when others => null;
end case;
end process;
end behavioral;
non posto anche il test bench perché dovrebbe essere certamente corretto.
In questa parte invece il ghdl mi rileva degli errori:
- Codice: Seleziona tutto
MSFresto.vhdl:30:18: unexpected token '=>' in a primary
MSFresto.vhdl:30:18: ';' is expected instead of '=>'
/usr/lib/ghdl/bin/ghdl: compilation error
error: cannot find entity or configuration msfresto
/usr/lib/ghdl/bin/ghdl: compilation error
error: cannot find entity or configuration tb_msfresto
/usr/lib/ghdl/bin/ghdl: compilation error
/usr/lib/ghdl/bin/ghdl: file 'tb_msfresto' does not exists
/usr/lib/ghdl/bin/ghdl: Please elaborate your design.
GTKWave Analyzer v3.3.24 (w)1999-2011 BSI
Error opening .vcd file 'out.vcd'.

Elettrotecnica e non solo (admin)
Un gatto tra gli elettroni (IsidoroKZ)
Esperienza e simulazioni (g.schgor)
Moleskine di un idraulico (RenzoDF)
Il Blog di ElectroYou (webmaster)
Idee microcontrollate (TardoFreak)
PICcoli grandi PICMicro (Paolino)
Il blog elettrico di carloc (carloc)
DirtEYblooog (dirtydeeds)
Di tutto... un po' (jordan20)
AK47 (lillo)
Esperienze elettroniche (marco438)
Telecomunicazioni musicali (clavicordo)
Automazione ed Elettronica (gustavo)
Direttive per la sicurezza (ErnestoCappelletti)
EYnfo dall'Alaska (mir)
Apriamo il quadro! (attilio)
H7-25 (asdf)
Passione Elettrica (massimob)
Elettroni a spasso (guidob)
Bloguerra (guerra)
lectroYou
