//=============================================================================
|
//=============================================================================
|
// STOSB,STOSW
|
// STOSB,STOSW
|
// Store string data to memory.
|
// Store string data to memory.
|
//
|
//
|
//
|
//
|
// 2009-2012 Robert Finch
|
// 2009-2013 Robert Finch
|
// Stratford
|
// Stratford
|
// robfinch<remove>@opencores.org
|
// robfinch<remove>@finitron.ca
|
//
|
//
|
//
|
//
|
// This source file is free software: you can redistribute it and/or modify
|
// This source file is free software: you can redistribute it and/or modify
|
// it under the terms of the GNU Lesser General Public License as published
|
// it under the terms of the GNU Lesser General Public License as published
|
// by the Free Software Foundation, either version 3 of the License, or
|
// by the Free Software Foundation, either version 3 of the License, or
|
// (at your option) any later version.
|
// (at your option) any later version.
|
//
|
//
|
// This source file is distributed in the hope that it will be useful,
|
// This source file is distributed in the hope that it will be useful,
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
// GNU General Public License for more details.
|
// GNU General Public License for more details.
|
//
|
//
|
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
//
|
//
|
//=============================================================================
|
//=============================================================================
|
//
|
//
|
STOS:
|
STOS:
|
`include "check_for_ints.v"
|
if (pe_nmi) begin
|
|
rst_nmi <= 1'b1;
|
|
int_num <= 8'h02;
|
|
ir <= `NOP;
|
|
state <= INT2;
|
|
end
|
|
else if (irq_i & ie) begin
|
|
ir <= `NOP;
|
|
state <= INTA0;
|
|
end
|
else if (w && (di==16'hFFFF)) begin
|
else if (w && (di==16'hFFFF)) begin
|
ir <= `NOP;
|
ir <= `NOP;
|
int_num <= 8'd13;
|
int_num <= 8'd13;
|
state <= INT1;
|
state <= INT2;
|
end
|
end
|
else if (repdone)
|
else if (repdone)
|
state <= IFETCH;
|
state <= IFETCH;
|
else begin
|
else begin
|
if (!cyc_o) begin
|
if (!cyc_o) begin
|
cyc_type <= `CT_WRMEM;
|
cyc_type <= `CT_WRMEM;
|
lock_o <= w;
|
lock_o <= w;
|
cyc_o <= 1'b1;
|
cyc_o <= 1'b1;
|
stb_o <= 1'b1;
|
stb_o <= 1'b1;
|
we_o <= 1'b1;
|
we_o <= 1'b1;
|
adr_o <= esdi;
|
adr_o <= esdi;
|
dat_o <= (w & df) ? ah : al;
|
dat_o <= (w & df) ? ah : al;
|
end
|
end
|
else if (ack_i) begin
|
else if (ack_i) begin
|
cyc_type <= `CT_PASSIVE;
|
cyc_type <= `CT_PASSIVE;
|
if (repz|repnz) begin
|
if (repz|repnz) begin
|
state <= w ? STOS1 : STOS;
|
state <= w ? STOS1 : STOS;
|
cx <= cx_dec;
|
cx <= cx_dec;
|
end
|
end
|
else
|
else
|
state <= w ? STOS1 : IFETCH;
|
state <= w ? STOS1 : IFETCH;
|
lock_o <= w;
|
lock_o <= w;
|
cyc_o <= w;
|
cyc_o <= w;
|
stb_o <= 1'b0;
|
stb_o <= 1'b0;
|
we_o <= 1'b0;
|
we_o <= 1'b0;
|
if (df)
|
if (df)
|
di <= di_dec;
|
di <= di_dec;
|
else
|
else
|
di <= di_inc;
|
di <= di_inc;
|
end
|
end
|
end
|
end
|
STOS1:
|
STOS1:
|
begin
|
begin
|
cyc_type <= `CT_WRMEM;
|
cyc_type <= `CT_WRMEM;
|
cyc_o <= 1'b1;
|
cyc_o <= 1'b1;
|
stb_o <= 1'b1;
|
stb_o <= 1'b1;
|
we_o <= 1'b1;
|
we_o <= 1'b1;
|
adr_o <= esdi;
|
adr_o <= esdi;
|
dat_o <= df ? al : ah;
|
dat_o <= df ? al : ah;
|
state <= STOS2;
|
state <= STOS2;
|
end
|
end
|
STOS2:
|
STOS2:
|
if (ack_i) begin
|
if (ack_i) begin
|
cyc_type <= `CT_PASSIVE;
|
cyc_type <= `CT_PASSIVE;
|
if (repz|repnz)
|
if (repz|repnz)
|
state <= STOS;
|
state <= STOS;
|
else
|
else
|
state <= IFETCH;
|
state <= IFETCH;
|
lock_o <= 1'b0;
|
lock_o <= 1'b0;
|
cyc_o <= 1'b0;
|
cyc_o <= 1'b0;
|
stb_o <= 1'b0;
|
stb_o <= 1'b0;
|
we_o <= 1'b0;
|
we_o <= 1'b0;
|
if (df)
|
if (df)
|
di <= di_dec;
|
di <= di_dec;
|
else
|
else
|
di <= di_inc;
|
di <= di_inc;
|
end
|
end
|
|
|