M1: Automat gefixt

This commit is contained in:
Matthias Biermann
2024-10-21 21:39:24 +02:00
parent e3ecf09c83
commit 05f27d2d47
3 changed files with 18 additions and 8 deletions
Binary file not shown.
+17 -8
View File
@@ -32,8 +32,8 @@ architecture rtl of spi_rom_control is
signal RegDataEn : std_logic;
-- Finite State Machine
type state_t is (S_ReadRom, S_ProvideData, S_DeadEnd, S_ERROR);
signal state : state_t := S_ReadRom;
type state_t is (S_CountAddress, S_ReadRom, S_ProvideData, S_DeadEnd, S_ERROR);
signal state : state_t := S_CountAddress;
signal state_next : state_t;
begin
@@ -71,16 +71,23 @@ begin
-- Berechnung des Folgezustands und der Mealy-Ausgaenge
case state is
when S_CountAddress =>
if reset = '1' then
state_next <= S_CountAddress;
CntAddrRst <= '1';
else
state_next <= S_ReadRom;
end if;
when S_ReadRom =>
if reset = '1' then
state_next <= S_ReadRom;
state_next <= S_CountAddress;
CntAddrRst <= '1';
else
state_next <= S_ProvideData;
end if;
when S_ProvideData =>
if reset = '1' then
state_next <= S_ReadRom;
state_next <= S_CountAddress;
CntAddrRst <= '1';
elsif m_ready = '0' then
state_next <= S_ProvideData;
@@ -88,23 +95,23 @@ begin
if CtrlBits = "10" then
state_next <= S_DeadEnd;
elsif CtrlBits = "00" then
state_next <= S_ReadRom;
state_next <= S_CountAddress;
CntAddrEn <= '1';
elsif CtrlBits = "01" or CtrlBits = "11" then
state_next <= S_ReadRom;
state_next <= S_CountAddress;
CntAddrRst <= '1';
end if;
end if;
when S_DeadEnd =>
if reset = '1' then
state_next <= S_ReadRom;
state_next <= S_CountAddress;
CntAddrRst <= '1';
else
state_next <= S_DeadEnd;
end if;
when S_ERROR =>
if reset = '1' then
state_next <= S_ReadRom;
state_next <= S_CountAddress;
CntAddrRst <= '1';
else
state_next <= S_ERROR;
@@ -128,6 +135,8 @@ begin
RegDataEn <= '0';
case state_next is
when S_CountAddress =>
null;
when S_ReadRom =>
RegDataEn <= '1';
when S_ProvideData =>
+1
View File
@@ -51,6 +51,7 @@ if {1} {
}
if {1} {
add wave -noupdate -divider "spi_transmitter"
add wave -noupdate -divider Steuerwerk
add wave -noupdate /spi2display_tb/dut/SPI_Transmitter_Inst/state
add wave -noupdate /spi2display_tb/dut/SPI_Transmitter_Inst/state_next