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

Subversion Repositories aemb

[/] [aemb/] [branches/] [AEMB2_712/] [rtl/] [verilog/] [aeMB_ibuf.v] - Blame information for rev 45

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

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

powered by: WebSVN 2.1.0

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