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

Subversion Repositories aemb

[/] [aemb/] [trunk/] [rtl/] [verilog/] [aeMB_ibuf.v] - Blame information for rev 55

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

Line No. Rev Author Line
1 55 sybreon
// $Id: aeMB_ibuf.v,v 1.4 2007-11-10 16:39:38 sybreon Exp $
2 41 sybreon
//
3
// AEMB INSTRUCTION BUFFER
4
// 
5
// Copyright (C) 2004-2007 Shawn Tan Ser Ngiap <shawn.tan@aeste.net>
6
//  
7 55 sybreon
// This file is part of AEMB.
8 41 sybreon
//
9 55 sybreon
// AEMB is free software: you can redistribute it and/or modify it
10
// under the terms of the GNU Lesser General Public License as
11
// published by the Free Software Foundation, either version 3 of the
12
// License, or (at your option) any later version.
13
//
14
// AEMB is distributed in the hope that it will be useful, but WITHOUT
15
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
16
// or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General
17
// Public License for more details.
18
//
19 41 sybreon
// You should have received a copy of the GNU Lesser General Public
20 55 sybreon
// License along with AEMB. If not, see <http://www.gnu.org/licenses/>.
21 41 sybreon
//
22
// $Log: not supported by cvs2svn $
23 55 sybreon
// Revision 1.3  2007/11/03 08:34:55  sybreon
24
// Minor code cleanup.
25
//
26 45 sybreon
// Revision 1.2  2007/11/02 19:20:58  sybreon
27
// Added better (beta) interrupt support.
28
// Changed MSR_IE to disabled at reset as per MB docs.
29
//
30 44 sybreon
// Revision 1.1  2007/11/02 03:25:40  sybreon
31
// New EDK 3.2 compatible design with optional barrel-shifter and multiplier.
32
// Fixed various minor data hazard bugs.
33
// Code compatible with -O0/1/2/3/s generated code.
34
//
35 41 sybreon
 
36
module aeMB_ibuf (/*AUTOARG*/
37
   // Outputs
38
   rIMM, rRA, rRD, rRB, rALT, rOPC, rSIMM, iwb_stb_o,
39
   // Inputs
40
   rBRA, rXCE, iwb_dat_i, iwb_ack_i, gclk, grst, gena
41
   );
42
   // INTERNAL
43
   output [15:0] rIMM;
44
   output [4:0]  rRA, rRD, rRB;
45
   output [10:0] rALT;
46
   output [5:0]  rOPC;
47
   output [31:0] rSIMM;
48
   input         rBRA;
49
   input [1:0]    rXCE;
50
 
51
   // INST WISHBONE
52
   output        iwb_stb_o;
53
   input [31:0]  iwb_dat_i;
54
   input         iwb_ack_i;
55
 
56
   // SYSTEM
57
   input         gclk, grst, gena;
58
 
59
   reg [15:0]     rIMM;
60
   reg [4:0]      rRA, rRD;
61
   reg [5:0]      rOPC;
62
 
63
   // FIXME: Endian
64
   wire [31:0]    wIDAT = iwb_dat_i;
65
   assign        {rRB, rALT} = rIMM;
66
 
67
   // TODO: Assign to FIFO not full.
68
   assign       iwb_stb_o = 1'b1;
69
 
70
   reg [31:0]    rSIMM, xSIMM;
71
   wire         fIMM = (rOPC == 6'o54);
72
 
73
   reg [31:0]    xIREG;
74
 
75
   // DELAY SLOT
76 44 sybreon
   always @(/*AUTOSENSE*/fIMM or rBRA or rIMM or rXCE or wIDAT) begin
77
      xIREG <= (rBRA | |rXCE) ? 32'h88000000 : wIDAT;
78 45 sybreon
      xSIMM <= (!fIMM | rBRA | |rXCE) ? { {(16){wIDAT[15]}}, wIDAT[15:0]} : {rIMM, wIDAT[15:0]};
79 44 sybreon
   end
80 41 sybreon
 
81
   // Synchronous
82
   always @(posedge gclk)
83
     if (grst) begin
84
        /*AUTORESET*/
85
        // Beginning of autoreset for uninitialized flops
86
        rIMM <= 16'h0;
87
        rOPC <= 6'h0;
88
        rRA <= 5'h0;
89
        rRD <= 5'h0;
90
        rSIMM <= 32'h0;
91
        // End of automatics
92
     end else if (gena) begin
93
        {rOPC, rRD, rRA, rIMM} <= #1 xIREG;
94
        rSIMM <= #1 xSIMM;
95
     end
96
 
97
 
98
endmodule // aeMB_ibuf

powered by: WebSVN 2.1.0

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