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

Subversion Repositories rtf65002

[/] [rtf65002/] [trunk/] [rtl/] [verilog/] [store.v] - Blame information for rev 21

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 20 robfinch
// ============================================================================
2
//        __
3
//   \\__/ o\    (C) 2013  Robert Finch, Stratford
4
//    \  __ /    All rights reserved.
5
//     \/_//     robfinch<remove>@opencores.org
6
//       ||
7
//
8
// This source file is free software: you can redistribute it and/or modify 
9
// it under the terms of the GNU Lesser General Public License as published 
10
// by the Free Software Foundation, either version 3 of the License, or     
11
// (at your option) any later version.                                      
12
//                                                                          
13
// This source file is distributed in the hope that it will be useful,      
14
// but WITHOUT ANY WARRANTY; without even the implied warranty of           
15
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the            
16
// GNU General Public License for more details.                             
17
//                                                                          
18
// You should have received a copy of the GNU General Public License        
19
// along with this program.  If not, see <http://www.gnu.org/licenses/>.    
20
//                                                            
21
// Memory store states
22
// The store states work for either eight bit or 32 bit mode              
23
// ============================================================================
24
//
25
// Stores always write through to memory, then optionally update the cache if
26
// there was a write hit.
27
STORE1:
28
        begin
29
                cyc_o <= 1'b1;
30
                stb_o <= 1'b1;
31
                we_o <= 1'b1;
32
                if (em || isStb)
33
                        case(wadr2LSB)
34
                        2'd0:   sel_o <= 4'b0001;
35
                        2'd1:   sel_o <= 4'b0010;
36
                        2'd2:   sel_o <= 4'b0100;
37
                        2'd3:   sel_o <= 4'b1000;
38
                        endcase
39
                else
40
                        sel_o <= 4'hf;
41
                adr_o <= {wadr,2'b00};
42
                dat_o <= wdat;
43
                radr <= wadr;           // Do a cache read to test the hit
44
                state <= STORE2;
45
        end
46
 
47
// Terminal state for stores. Update the data cache if there was a cache hit.
48
// Clear any previously set lock status
49
STORE2:
50
        if (ack_i) begin
51
                state <= IFETCH;
52
                lock_o <= 1'b0;
53
                cyc_o <= 1'b0;
54
                stb_o <= 1'b0;
55
                we_o <= 1'b0;
56
                sel_o <= 4'h0;
57
                adr_o <= 34'h0;
58
                dat_o <= 32'h0;
59
                if (dhit) begin
60
                        wrsel <= sel_o;
61
                        wr <= 1'b1;
62
                end
63
                else if (write_allocate) begin
64
                        dmiss <= `TRUE;
65
                        state <= WAIT_DHIT;
66
                        retstate <= IFETCH;
67
                end
68
        end
69 21 robfinch
        else if (err_i) begin
70
                lock_o <= 1'b0;
71
                cyc_o <= 1'b0;
72
                stb_o <= 1'b0;
73
                we_o <= 1'b0;
74
                sel_o <= 4'h0;
75
                adr_o <= 34'h0;
76
                dat_o <= 32'h0;
77
                state <= BUS_ERROR;
78
        end
79
 
80 20 robfinch
 

powered by: WebSVN 2.1.0

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