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

Subversion Repositories altor32

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

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
//                            V2.0
5
//                     Ultra-Embedded.com
6
//                   Copyright 2011 - 2013
7
//
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
 
57 32 ultra_embe
    // Memory interface
58
    output reg [31:0]           wbm_addr_o /*verilator public*/,
59
    input [31:0]                wbm_dat_i /*verilator public*/,
60
    output [2:0]                wbm_cti_o /*verilator public*/,
61
    output reg                  wbm_cyc_o /*verilator public*/,
62
    output reg                  wbm_stb_o /*verilator public*/,
63
    input                       wbm_stall_i/*verilator public*/,
64
    input                       wbm_ack_i/*verilator public*/
65 27 ultra_embe
);
66
 
67
//-----------------------------------------------------------------
68
// Registers / Wires
69
//-----------------------------------------------------------------
70
 
71
// Current state
72
parameter STATE_CHECK       = 0;
73
parameter STATE_FETCH       = 1;
74 32 ultra_embe
reg                        state;
75 27 ultra_embe
 
76 32 ultra_embe
reg                        ignore_resp;
77 27 ultra_embe
 
78 32 ultra_embe
assign valid_o              = wbm_ack_i & ~ignore_resp & ~rd_i;
79
assign instruction_o        = wbm_dat_i;
80
 
81 27 ultra_embe
//-----------------------------------------------------------------
82
// Control logic
83
//-----------------------------------------------------------------
84
always @ (posedge rst_i or posedge clk_i )
85
begin
86
   if (rst_i == 1'b1)
87
   begin
88 32 ultra_embe
        wbm_addr_o      <= 32'h00000000;
89
        wbm_stb_o       <= 1'b0;
90
        wbm_cyc_o       <= 1'b0;
91
        ignore_resp     <= 1'b0;
92 27 ultra_embe
        state           <= STATE_CHECK;
93
   end
94
   else
95
   begin
96
 
97 32 ultra_embe
        if (~wbm_stall_i)
98
            wbm_stb_o    <= 1'b0;
99 27 ultra_embe
 
100
        case (state)
101
 
102
            //-----------------------------------------
103
            // CHECK - check cache for hit or miss
104
            //-----------------------------------------
105
            STATE_CHECK :
106
            begin
107
                // Start fetch from memory
108 32 ultra_embe
                wbm_addr_o  <= pc_i;
109
                wbm_stb_o   <= 1'b1;
110
                wbm_cyc_o   <= 1'b1;
111
                ignore_resp <= 1'b0;
112 27 ultra_embe
                state       <= STATE_FETCH;
113
            end
114
            //-----------------------------------------
115
            // FETCH - Fetch row from memory
116
            //-----------------------------------------
117
            STATE_FETCH :
118
            begin
119 32 ultra_embe
                // Read whilst waiting for previous response?        
120
                if (rd_i)
121
                    ignore_resp <= 1'b1;
122
 
123 27 ultra_embe
                // Data ready from memory?
124 32 ultra_embe
                if (wbm_ack_i)
125
                begin
126
                    wbm_cyc_o   <= 1'b0;
127
                    state       <= STATE_CHECK;
128
                end
129 27 ultra_embe
            end
130
 
131
            default:
132
                ;
133
           endcase
134
   end
135
end
136
 
137 32 ultra_embe
assign wbm_cti_o        = 3'b111;
138
 
139 27 ultra_embe
endmodule
140
 

powered by: WebSVN 2.1.0

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