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

Subversion Repositories altor32

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

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
    // Memory interface (slave)
58
    output reg [31:0]           mem_addr_o /*verilator public*/,
59
    input [31:0]                mem_data_i /*verilator public*/,
60
    output reg                  mem_burst_o /*verilator public*/,
61
    output reg                  mem_rd_o /*verilator public*/,
62
    input                       mem_accept_i/*verilator public*/,
63
    input                       mem_ack_i/*verilator public*/
64
);
65
 
66
//-----------------------------------------------------------------
67
// Registers / Wires
68
//-----------------------------------------------------------------
69
 
70
// Current state
71
parameter STATE_CHECK       = 0;
72
parameter STATE_FETCH       = 1;
73
reg [1:0]                   state;
74
 
75
assign valid_o              = mem_ack_i;
76
assign instruction_o        = mem_data_i;
77
 
78
//-----------------------------------------------------------------
79
// Control logic
80
//-----------------------------------------------------------------
81
always @ (posedge rst_i or posedge clk_i )
82
begin
83
   if (rst_i == 1'b1)
84
   begin
85
        mem_addr_o      <= 32'h00000000;
86
        mem_rd_o        <= 1'b0;
87
        mem_burst_o     <= 1'b0;
88
        state           <= STATE_CHECK;
89
   end
90
   else
91
   begin
92
 
93
        if (mem_accept_i)
94
            mem_rd_o    <= 1'b0;
95
 
96
        case (state)
97
 
98
            //-----------------------------------------
99
            // CHECK - check cache for hit or miss
100
            //-----------------------------------------
101
            STATE_CHECK :
102
            begin
103
                // Start fetch from memory
104
                mem_addr_o  <= pc_i;
105
                mem_rd_o    <= 1'b1;
106
                mem_burst_o <= 1'b0;
107
                state       <= STATE_FETCH;
108
            end
109
            //-----------------------------------------
110
            // FETCH - Fetch row from memory
111
            //-----------------------------------------
112
            STATE_FETCH :
113
            begin
114
                // Data ready from memory?
115
                if (mem_ack_i)
116
                    state   <= STATE_CHECK;
117
            end
118
 
119
            default:
120
                ;
121
           endcase
122
   end
123
end
124
 
125
endmodule
126
 

powered by: WebSVN 2.1.0

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