OpenCores
URL https://opencores.org/ocsvn/rtf65002/rtf65002/trunk

Subversion Repositories rtf65002

[/] [rtf65002/] [trunk/] [rtl/] [verilog/] [store.v] - Diff between revs 23 and 25

Go to most recent revision | Only display areas with differences | Details | Blame | View Log

Rev 23 Rev 25
// ============================================================================
// ============================================================================
//        __
//        __
//   \\__/ o\    (C) 2013  Robert Finch, Stratford
//   \\__/ o\    (C) 2013  Robert Finch, Stratford
//    \  __ /    All rights reserved.
//    \  __ /    All rights reserved.
//     \/_//     robfinch<remove>@opencores.org
//     \/_//     robfinch<remove>@opencores.org
//       ||
//       ||
//
//
// 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/>.    
//                                                            
//                                                            
// Memory store states
// Memory store states
// The store states work for either eight bit or 32 bit mode              
// The store states work for either eight bit or 32 bit mode              
// ============================================================================
// ============================================================================
//
//
// Stores always write through to memory, then optionally update the cache if
// Stores always write through to memory, then optionally update the cache if
// there was a write hit.
// there was a write hit.
STORE1:
STORE1:
        begin
        begin
                cyc_o <= 1'b1;
                cyc_o <= 1'b1;
                stb_o <= 1'b1;
                stb_o <= 1'b1;
                we_o <= 1'b1;
                we_o <= 1'b1;
                if (em || isStb)
                if (em || isStb) begin
                        case(wadr2LSB)
                        case(wadr2LSB)
                        2'd0:   sel_o <= 4'b0001;
                        2'd0:   sel_o <= 4'b0001;
                        2'd1:   sel_o <= 4'b0010;
                        2'd1:   sel_o <= 4'b0010;
                        2'd2:   sel_o <= 4'b0100;
                        2'd2:   sel_o <= 4'b0100;
                        2'd3:   sel_o <= 4'b1000;
                        2'd3:   sel_o <= 4'b1000;
                        endcase
                        endcase
 
                end
                else
                else
                        sel_o <= 4'hf;
                        sel_o <= 4'hf;
                adr_o <= {wadr,2'b00};
                adr_o <= {wadr,2'b00};
                dat_o <= wdat;
                dat_o <= wdat;
                radr <= wadr;           // Do a cache read to test the hit
                radr <= wadr;           // Do a cache read to test the hit
                state <= STORE2;
                state <= STORE2;
        end
        end
 
 
// Terminal state for stores. Update the data cache if there was a cache hit.
// Terminal state for stores. Update the data cache if there was a cache hit.
// Clear any previously set lock status
// Clear any previously set lock status
STORE2:
STORE2:
        if (ack_i) begin
        if (ack_i) begin
                if (isMove)
                if (isMove)
                        state <= MVN3;
                        state <= MVN3;
                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;
                sel_o <= 4'h0;
                sel_o <= 4'h0;
                adr_o <= 34'h0;
                adr_o <= 34'h0;
                dat_o <= 32'h0;
                dat_o <= 32'h0;
                if (dhit) begin
                if (dhit) begin
                        wrsel <= sel_o;
                        wrsel <= sel_o;
                        wr <= 1'b1;
                        wr <= 1'b1;
                end
                end
                else if (write_allocate) begin
                else if (write_allocate) begin
                        dmiss <= `TRUE;
                        dmiss <= `TRUE;
                        state <= WAIT_DHIT;
                        state <= WAIT_DHIT;
                        if (isMove)
                        if (isMove)
                                retstate <= MVN3;
                                retstate <= MVN3;
                        else
                        else
                                retstate <= IFETCH;
                                retstate <= IFETCH;
                end
                end
        end
        end
        else if (err_i) begin
        else if (err_i) begin
                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;
                sel_o <= 4'h0;
                sel_o <= 4'h0;
                dat_o <= 32'h0;
                dat_o <= 32'h0;
                state <= BUS_ERROR;
                state <= BUS_ERROR;
        end
        end
 
 
 
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.