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

Subversion Repositories aemb

[/] [aemb/] [trunk/] [rtl/] [verilog/] [aeMB2_pipe.v] - Blame information for rev 191

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

Line No. Rev Author Line
1 157 sybreon
/* $Id: aeMB2_pipe.v,v 1.4 2008-05-01 08:32:58 sybreon Exp $
2 118 sybreon
**
3
** AEMB2 EDK 6.2 COMPATIBLE CORE
4
** Copyright (C) 2004-2008 Shawn Tan <shawn.tan@aeste.net>
5
**
6
** This file is part of AEMB.
7
**
8
** AEMB is free software: you can redistribute it and/or modify it
9
** under the terms of the GNU Lesser General Public License as
10
** published by the Free Software Foundation, either version 3 of the
11
** License, or (at your option) any later version.
12
**
13
** AEMB is distributed in the hope that it will be useful, but WITHOUT
14
** ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
15
** or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General
16
** Public License for more details.
17
**
18
** You should have received a copy of the GNU Lesser General Public
19
** License along with AEMB. If not, see <http:**www.gnu.org/licenses/>.
20
*/
21
/**
22
 * System signal controller
23
 * @file aeMB2_pipe.v
24
 
25
 * Generates clock, reset, and enable signals. Hardware clock/reset
26
   managers can be instantiated here.
27
 
28
 */
29
 
30
module aeMB2_pipe (/*AUTOARG*/
31
   // Outputs
32 157 sybreon
   brk_if, gpha, gclk, grst, dena, iena,
33 118 sybreon
   // Inputs
34 157 sybreon
   bra_ex, dwb_fb, xwb_fb, ich_fb, fet_fb, msr_ex, sys_clk_i,
35
   sys_int_i, sys_rst_i, sys_ena_i
36 118 sybreon
   );
37
   parameter AEMB_HTX = 1;
38
 
39 157 sybreon
   output [1:0] brk_if;
40
   input [1:0]   bra_ex;
41
   input        dwb_fb;
42
   input        xwb_fb;
43
   input        ich_fb;
44
   input        fet_fb;
45
   input [3:0]   msr_ex;
46 120 sybreon
 
47 157 sybreon
   output       gpha,
48
                gclk,
49
                grst,
50
                dena,
51
                iena;
52 118 sybreon
 
53 157 sybreon
   input        sys_clk_i,
54
                sys_int_i,
55
                sys_rst_i,
56
                sys_ena_i;
57
 
58 118 sybreon
   /*AUTOREG*/
59
   // Beginning of automatic regs (for this module's undeclared outputs)
60 157 sybreon
   reg [1:0]             brk_if;
61 118 sybreon
   reg                  gpha;
62
   // End of automatics
63
   reg [1:0]             rst;
64 120 sybreon
   reg                  por;
65
   reg                  fet;
66
   reg                  hit;
67
 
68 118 sybreon
   // Instantiate clock/reset managers
69
   assign               gclk = sys_clk_i;
70
   assign               grst = !rst[1];
71
 
72
   // run instruction side pipeline
73 120 sybreon
   assign               iena = ich_fb &
74
                               xwb_fb &
75
                               dwb_fb &
76
                               sys_ena_i;
77 118 sybreon
   // run data side pipeline
78 157 sybreon
   assign               dena = iena;
79 120 sybreon
 
80 157 sybreon
   // interrupt process
81
   reg                  int_lat; ///< interrupt latch
82
 
83
   always @(posedge sys_clk_i)
84
     if (sys_rst_i) begin
85
        /*AUTORESET*/
86
        // Beginning of autoreset for uninitialized flops
87
        int_lat <= 1'h0;
88
        // End of automatics
89
     end else begin
90
        int_lat <= #1 msr_ex[1] & (int_lat | sys_int_i);
91
     end
92
 
93
   always @(posedge gclk)
94
     if (grst) begin
95
        /*AUTORESET*/
96
        // Beginning of autoreset for uninitialized flops
97
        brk_if <= 2'h0;
98
        // End of automatics
99
     end else if (dena) begin
100
        brk_if[0] <= #1 !msr_ex[3] & int_lat; // interrupt & not BIP     
101
     end
102
 
103 118 sybreon
   // RESET DELAY
104
   always @(posedge sys_clk_i)
105
     if (sys_rst_i) begin
106
        /*AUTORESET*/
107
        // Beginning of autoreset for uninitialized flops
108
        rst <= 2'h0;
109
        // End of automatics
110
     end else begin
111
        rst <= #1 {rst[0], !sys_rst_i};
112
     end
113
 
114
   // PHASE TOGGLE
115
   always @(posedge sys_clk_i)
116
     if (sys_rst_i) begin
117
        /*AUTORESET*/
118
        // Beginning of autoreset for uninitialized flops
119
        gpha <= 1'h0;
120
        // End of automatics
121
     end else if (dena | grst) begin
122 120 sybreon
        gpha <= #1 !gpha;
123 118 sybreon
     end
124
 
125
endmodule // aeMB2_pipe
126
 
127 131 sybreon
/*
128
 $Log: not supported by cvs2svn $
129 157 sybreon
 Revision 1.3  2008/04/26 01:09:06  sybreon
130
 Passes basic tests. Minor documentation changes to make it compatible with iverilog pre-processor.
131
 
132 131 sybreon
 Revision 1.2  2008/04/20 16:34:32  sybreon
133
 Basic version with some features left out.
134
 
135
 Revision 1.1  2008/04/18 00:21:52  sybreon
136
 Initial import.
137
*/

powered by: WebSVN 2.1.0

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