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

Subversion Repositories aemb

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

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 204 sybreon
   bra_ex, dwb_fb, xwb_fb, ich_fb, fet_fb, msr_ex, exc_dwb, exc_iwb,
35
   exc_ill, sys_clk_i, 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 204 sybreon
   input [9:0]   msr_ex;
46 120 sybreon
 
47 157 sybreon
   output       gpha,
48
                gclk,
49
                grst,
50
                dena,
51
                iena;
52 204 sybreon
 
53
   input [1:0]   exc_dwb;
54
   input        exc_iwb;
55
   input        exc_ill;
56 118 sybreon
 
57 157 sybreon
   input        sys_clk_i,
58
                sys_int_i,
59
                sys_rst_i,
60
                sys_ena_i;
61
 
62 118 sybreon
   /*AUTOREG*/
63
   // Beginning of automatic regs (for this module's undeclared outputs)
64 157 sybreon
   reg [1:0]             brk_if;
65 118 sybreon
   reg                  gpha;
66
   // End of automatics
67
   reg [1:0]             rst;
68 120 sybreon
   reg                  por;
69
   reg                  fet;
70
   reg                  hit;
71
 
72 118 sybreon
   // Instantiate clock/reset managers
73
   assign               gclk = sys_clk_i;
74
   assign               grst = !rst[1];
75
 
76
   // run instruction side pipeline
77 120 sybreon
   assign               iena = ich_fb &
78
                               xwb_fb &
79
                               dwb_fb &
80
                               sys_ena_i;
81 118 sybreon
   // run data side pipeline
82 157 sybreon
   assign               dena = iena;
83 120 sybreon
 
84 204 sybreon
   // interrupt process - latches onto any interrupt until it is handled
85 157 sybreon
   reg                  int_lat; ///< interrupt latch
86 204 sybreon
 
87 157 sybreon
   always @(posedge sys_clk_i)
88
     if (sys_rst_i) begin
89
        /*AUTORESET*/
90
        // Beginning of autoreset for uninitialized flops
91
        int_lat <= 1'h0;
92
        // End of automatics
93
     end else begin
94
        int_lat <= #1 msr_ex[1] & (int_lat | sys_int_i);
95
     end
96
 
97 204 sybreon
   // exception process - exceptions handled immediately
98
   wire                 exc_lat; ///< exception latch
99
   assign exc_lat = exc_ill | exc_dwb[1];
100
 
101 157 sybreon
   always @(posedge gclk)
102
     if (grst) begin
103
        /*AUTORESET*/
104
        // Beginning of autoreset for uninitialized flops
105
        brk_if <= 2'h0;
106
        // End of automatics
107
     end else if (dena) begin
108 204 sybreon
        // TODO: consider MSR[9:8]
109
        brk_if[1] <= #1 exc_lat; // HIGH PRIORITY - exception
110
        brk_if[0] <= #1 !exc_lat & !msr_ex[9] & !msr_ex[3] & int_lat; // LOW PRIORITY - interrupt (not BIP/EIP)
111 157 sybreon
     end
112
 
113 118 sybreon
   // RESET DELAY
114
   always @(posedge sys_clk_i)
115
     if (sys_rst_i) begin
116
        /*AUTORESET*/
117
        // Beginning of autoreset for uninitialized flops
118
        rst <= 2'h0;
119
        // End of automatics
120
     end else begin
121
        rst <= #1 {rst[0], !sys_rst_i};
122
     end
123
 
124
   // PHASE TOGGLE
125
   always @(posedge sys_clk_i)
126
     if (sys_rst_i) begin
127
        /*AUTORESET*/
128
        // Beginning of autoreset for uninitialized flops
129
        gpha <= 1'h0;
130
        // End of automatics
131
     end else if (dena | grst) begin
132 120 sybreon
        gpha <= #1 !gpha;
133 118 sybreon
     end
134
 
135
endmodule // aeMB2_pipe
136
 

powered by: WebSVN 2.1.0

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