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

Subversion Repositories aemb

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

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

Line No. Rev Author Line
1 44 sybreon
// $Id: aeMB_ibuf.v,v 1.2 2007-11-02 19:20:58 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 44 sybreon
// Revision 1.1  2007/11/02 03:25:40  sybreon
24
// New EDK 3.2 compatible design with optional barrel-shifter and multiplier.
25
// Fixed various minor data hazard bugs.
26
// Code compatible with -O0/1/2/3/s generated code.
27
//
28 41 sybreon
 
29
module aeMB_ibuf (/*AUTOARG*/
30
   // Outputs
31
   rIMM, rRA, rRD, rRB, rALT, rOPC, rSIMM, iwb_stb_o,
32
   // Inputs
33
   rBRA, rXCE, iwb_dat_i, iwb_ack_i, gclk, grst, gena
34
   );
35
   // INTERNAL
36
   output [15:0] rIMM;
37
   output [4:0]  rRA, rRD, rRB;
38
   output [10:0] rALT;
39
   output [5:0]  rOPC;
40
   output [31:0] rSIMM;
41
   input         rBRA;
42
   input [1:0]    rXCE;
43
 
44
   // INST WISHBONE
45
   output        iwb_stb_o;
46
   input [31:0]  iwb_dat_i;
47
   input         iwb_ack_i;
48
 
49
   // SYSTEM
50
   input         gclk, grst, gena;
51
 
52
   reg [15:0]     rIMM;
53
   reg [4:0]      rRA, rRD;
54
   reg [5:0]      rOPC;
55
 
56
   // FIXME: Endian
57
   wire [31:0]    wIDAT = iwb_dat_i;
58
   assign        {rRB, rALT} = rIMM;
59
 
60
   // TODO: Assign to FIFO not full.
61
   assign       iwb_stb_o = 1'b1;
62
 
63
   reg [31:0]    rSIMM, xSIMM;
64
   wire         fIMM = (rOPC == 6'o54);
65
 
66
   reg [31:0]    xIREG;
67
 
68
   // DELAY SLOT
69 44 sybreon
   always @(/*AUTOSENSE*/fIMM or rBRA or rIMM or rXCE or wIDAT) begin
70
      xIREG <= (rBRA | |rXCE) ? 32'h88000000 : wIDAT;
71
      xSIMM <= (fIMM) ? {rIMM, wIDAT[15:0]} : { {(16){wIDAT[15]}}, wIDAT[15:0]};
72
   end
73 41 sybreon
 
74
   // Synchronous
75
   always @(posedge gclk)
76
     if (grst) begin
77
        /*AUTORESET*/
78
        // Beginning of autoreset for uninitialized flops
79
        rIMM <= 16'h0;
80
        rOPC <= 6'h0;
81
        rRA <= 5'h0;
82
        rRD <= 5'h0;
83
        rSIMM <= 32'h0;
84
        // End of automatics
85
     end else if (gena) begin
86
        {rOPC, rRD, rRA, rIMM} <= #1 xIREG;
87
        rSIMM <= #1 xSIMM;
88
     end
89
 
90
 
91
endmodule // aeMB_ibuf

powered by: WebSVN 2.1.0

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