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

Subversion Repositories altor32

[/] [altor32/] [trunk/] [rtl/] [cpu/] [altor32_noicache.v] - Blame information for rev 36

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

Line No. Rev Author Line
1 27 ultra_embe
//-----------------------------------------------------------------
2
//                           AltOR32 
3
//                Alternative Lightweight OpenRisc 
4 36 ultra_embe
//                            V2.1
5 27 ultra_embe
//                     Ultra-Embedded.com
6 36 ultra_embe
//                   Copyright 2011 - 2014
7 27 ultra_embe
//
8
//               Email: admin@ultra-embedded.com
9
//
10
//                       License: LGPL
11
//-----------------------------------------------------------------
12
//
13
// Copyright (C) 2011 - 2013 Ultra-Embedded.com
14
//
15
// This source file may be used and distributed without         
16
// restriction provided that this copyright statement is not    
17
// removed from the file and that any derivative work contains  
18
// the original copyright notice and the associated disclaimer. 
19
//
20
// This source file is free software; you can redistribute it   
21
// and/or modify it under the terms of the GNU Lesser General   
22
// Public License as published by the Free Software Foundation; 
23
// either version 2.1 of the License, or (at your option) any   
24
// later version.
25
//
26
// This source is distributed in the hope that it will be       
27
// useful, but WITHOUT ANY WARRANTY; without even the implied   
28
// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR      
29
// PURPOSE.  See the GNU Lesser General Public License for more 
30
// details.
31
//
32
// You should have received a copy of the GNU Lesser General    
33
// Public License along with this source; if not, write to the 
34
// Free Software Foundation, Inc., 59 Temple Place, Suite 330, 
35
// Boston, MA  02111-1307  USA
36
//-----------------------------------------------------------------
37
 
38
//-----------------------------------------------------------------
39
// Includes
40
//-----------------------------------------------------------------
41
`include "altor32_defs.v"
42
 
43
//-----------------------------------------------------------------
44
// Module - Cache substitute (used when ICache disabled)
45
//-----------------------------------------------------------------
46
module altor32_noicache
47
(
48
    input                       clk_i /*verilator public*/,
49
    input                       rst_i /*verilator public*/,
50
 
51
    // Processor interface
52
    input                       rd_i /*verilator public*/,
53
    input [31:0]                pc_i /*verilator public*/,
54
    output [31:0]               instruction_o /*verilator public*/,
55
    output                      valid_o /*verilator public*/,
56 36 ultra_embe
 
57
    // Invalidate (not used)
58
    input                       invalidate_i /*verilator public*/,
59 27 ultra_embe
 
60 32 ultra_embe
    // Memory interface
61
    output reg [31:0]           wbm_addr_o /*verilator public*/,
62
    input [31:0]                wbm_dat_i /*verilator public*/,
63
    output [2:0]                wbm_cti_o /*verilator public*/,
64
    output reg                  wbm_cyc_o /*verilator public*/,
65
    output reg                  wbm_stb_o /*verilator public*/,
66
    input                       wbm_stall_i/*verilator public*/,
67
    input                       wbm_ack_i/*verilator public*/
68 27 ultra_embe
);
69
 
70
//-----------------------------------------------------------------
71
// Registers / Wires
72
//-----------------------------------------------------------------
73
 
74
// Current state
75
parameter STATE_CHECK       = 0;
76
parameter STATE_FETCH       = 1;
77 32 ultra_embe
reg                        state;
78 27 ultra_embe
 
79 32 ultra_embe
reg                        ignore_resp;
80 27 ultra_embe
 
81 32 ultra_embe
assign valid_o              = wbm_ack_i & ~ignore_resp & ~rd_i;
82
assign instruction_o        = wbm_dat_i;
83
 
84 27 ultra_embe
//-----------------------------------------------------------------
85
// Control logic
86
//-----------------------------------------------------------------
87
always @ (posedge rst_i or posedge clk_i )
88
begin
89
   if (rst_i == 1'b1)
90
   begin
91 32 ultra_embe
        wbm_addr_o      <= 32'h00000000;
92
        wbm_stb_o       <= 1'b0;
93
        wbm_cyc_o       <= 1'b0;
94
        ignore_resp     <= 1'b0;
95 27 ultra_embe
        state           <= STATE_CHECK;
96
   end
97
   else
98
   begin
99
 
100 32 ultra_embe
        if (~wbm_stall_i)
101
            wbm_stb_o    <= 1'b0;
102 27 ultra_embe
 
103
        case (state)
104
 
105
            //-----------------------------------------
106
            // CHECK - check cache for hit or miss
107
            //-----------------------------------------
108
            STATE_CHECK :
109
            begin
110
                // Start fetch from memory
111 32 ultra_embe
                wbm_addr_o  <= pc_i;
112
                wbm_stb_o   <= 1'b1;
113
                wbm_cyc_o   <= 1'b1;
114
                ignore_resp <= 1'b0;
115 27 ultra_embe
                state       <= STATE_FETCH;
116
            end
117
            //-----------------------------------------
118
            // FETCH - Fetch row from memory
119
            //-----------------------------------------
120
            STATE_FETCH :
121
            begin
122 32 ultra_embe
                // Read whilst waiting for previous response?        
123
                if (rd_i)
124
                    ignore_resp <= 1'b1;
125
 
126 27 ultra_embe
                // Data ready from memory?
127 32 ultra_embe
                if (wbm_ack_i)
128
                begin
129
                    wbm_cyc_o   <= 1'b0;
130
                    state       <= STATE_CHECK;
131
                end
132 27 ultra_embe
            end
133
 
134
            default:
135
                ;
136
           endcase
137
   end
138
end
139
 
140 32 ultra_embe
assign wbm_cti_o        = 3'b111;
141
 
142 27 ultra_embe
endmodule

powered by: WebSVN 2.1.0

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