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

Subversion Repositories rtf65002

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

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 23 robfinch
                if (isMove)
52
                        state <= MVN3;
53
                else
54
                        state <= IFETCH;
55 20 robfinch
                lock_o <= 1'b0;
56
                cyc_o <= 1'b0;
57
                stb_o <= 1'b0;
58
                we_o <= 1'b0;
59
                sel_o <= 4'h0;
60
                adr_o <= 34'h0;
61
                dat_o <= 32'h0;
62
                if (dhit) begin
63
                        wrsel <= sel_o;
64
                        wr <= 1'b1;
65
                end
66
                else if (write_allocate) begin
67
                        dmiss <= `TRUE;
68
                        state <= WAIT_DHIT;
69 23 robfinch
                        if (isMove)
70
                                retstate <= MVN3;
71
                        else
72
                                retstate <= IFETCH;
73 20 robfinch
                end
74
        end
75 21 robfinch
        else if (err_i) begin
76
                lock_o <= 1'b0;
77
                cyc_o <= 1'b0;
78
                stb_o <= 1'b0;
79
                we_o <= 1'b0;
80
                sel_o <= 4'h0;
81
                dat_o <= 32'h0;
82
                state <= BUS_ERROR;
83
        end
84
 
85 20 robfinch
 

powered by: WebSVN 2.1.0

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