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

Subversion Repositories embedded_risc

[/] [embedded_risc/] [trunk/] [Verilog/] [fsm.v] - Blame information for rev 27

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 26 hosseinami
/*********************************************************
2
 MODULE:                Sub Level SDRAM Controller FSM Block
3
 
4
 FILE NAME:     fsm.v
5
 VERSION:       1.0
6
 DATE:          April 8nd, 2002
7
 AUTHOR:                Hossein Amidi
8
 COMPANY:
9
 CODE TYPE:     Register Transfer Level
10
 
11
 DESCRIPTION:   This module is the sub level RTL code of SDRAM Controller ASIC verilog
12
 code. It is the signal generator Finite State Machine for SDRAM Controller
13
 
14
 It will instantiate the following blocks in the ASIC:
15
 
16
 1)     Ras-to-CAS Delay counter
17
 2)     Refresh Acknowledge
18
 3)     Output Enbable generator
19
 4)     Command generator
20
 5)   Command detector
21
 
22
 
23
 Hossein Amidi
24
 (C) April 2002
25
 
26
*********************************************************/
27
 
28
// DEFINES
29
`timescale 1ns / 10ps
30
 
31
 
32
module fsm(//Input
33
                                reset,
34
                                clk0,
35
                                nop,
36
                                reada,
37
                                writea,
38
                                refresh,
39
                                preacharge,
40
                                load_mod,
41
                                caddr,
42
                                cas_lat,
43
                                ras_cas,
44
                                ref_dur,
45
                                page_mod,
46
                                bur_len,
47
                                ref_req,
48
                                // Output
49
                                sadd,
50
                                cs,
51
                                ras,
52
                                cas,
53
                                we,
54
                                cke,
55
                                ba,
56
                                oe,
57
                                ref_ack,
58
                                cmack
59
                                );
60
 
61
 
62
// Parameter
63
`include        "parameter.v"
64
 
65
// Input
66
input reset;
67
input clk0;
68
input nop;
69
input reada;
70
input writea;
71
input refresh;
72
input preacharge;
73
input load_mod;
74
input [padd_size - 1 : 0]caddr;
75
input [cas_size - 1 : 0]cas_lat;
76
input [rc_size - 1 : 0]ras_cas;
77
input [ref_dur_size - 1 : 0]ref_dur;
78
input page_mod;
79
input [burst_size - 1 : 0]bur_len;
80
input ref_req;
81
 
82
// Output
83
output [add_size - 1 : 0]sadd;
84
output [cs_size - 1 : 0]cs;
85
output ras;
86
output cas;
87
output we;
88
output cke;
89
output [ba_size - 1 : 0]ba;
90
output oe;
91
output ref_ack;
92
output cmack;
93
 
94
// Wires and Reg signals
95
wire                             oe;
96
wire                                    do_nop;
97
wire                             do_reada;
98
wire                             do_writea;
99
wire                             do_writea1;
100
wire                             do_refresh;
101
wire                             do_preacharge;
102
wire                             do_load_mod;
103
 
104
wire                             command_done;
105
wire     [7:0]                   command_delay;
106
wire                             do_act;
107
wire                             rw_flag;
108
wire     [3:0]                   rp_shift;
109
wire                             rp_done;
110
 
111
wire    [row_size - 1:0]        rowaddr;
112
wire    [col_size - 1:0]        coladdr;
113
wire    [bank_size - 1:0]       bankaddr;
114
 
115
 
116
wire reset;
117
wire clk0;
118
wire [rc_size - 1 : 0]ras_cas;
119
wire do_rw;
120
 
121
wire ref_req;
122
wire cmack;
123
wire ref_ack;
124
 
125
 
126
wire page_mod;
127
 
128
wire [burst_size - 1 : 0]bur_len;
129
wire [cas_size - 1 : 0]cas_lat;
130
 
131
wire oe4;
132
 
133
 
134
// Assignments
135
assign   rowaddr   = caddr[rowstart + row_size - 1 : rowstart];         // assignment of the row address bits from sadd
136
assign   coladdr   = caddr[colstart + col_size - 1 : colstart];        // assignment of the column address bits
137
assign   bankaddr  = caddr[bankstart + bank_size - 1 : bankstart];    // assignment of the bank address bits
138
 
139
 
140
 
141
/*********************************** Sub Level Instantiation *****************************/
142
 
143
ras_cas_delay ras_cas_delay0(   // Input
144
                                                                                .reset(reset),
145
                                                                                .clk0(clk0),
146
                                                                                .do_reada(do_reada),
147
                                                                                .do_writea(do_writea),
148
                                                                                .ras_cas(ras_cas),
149
                                                                                // Output
150
                                                                                .do_rw(do_rw)
151
                                                                                );
152
 
153
 
154
ref_ack ref_ack0(// Input
155
                                                .reset(reset),
156
                                                .clk0(clk0),
157
                                                .do_refresh(do_refresh),
158
                                                .do_reada(do_reada),
159
                                                .do_writea(do_writea),
160
                                                .do_preacharge(do_preacharge),
161
                                                .do_load_mod(do_load_mod),
162
                                                .ref_req(ref_req),
163
                                                // Output
164
                                                .cmack(cmack),
165
                                                .ref_ack(ref_ack)
166
                                                );
167
 
168
oe_generator oe_gen0(// Input
169
                                                        .reset(reset),
170
                                                        .clk0(clk0),
171
                                                        .page_mod(page_mod),
172
                                                        .do_writea1(do_writea1),
173
                                                        .bur_len(bur_len),
174
                                                        .cas_lat(cas_lat),
175
                                                        .do_preacharge(do_preacharge),
176
                                                        .do_reada(do_reada),
177
                                                        .do_refresh(do_refresh),
178
                                                        // Output
179
                                                        .oe(oe),
180
                                                        .oe4(oe4)
181
                                                        );
182
 
183
cmd_generator cmd_generator0(   // Input
184
                                                                                .reset(reset),
185
                                                                                .clk0(clk0),
186
                                                                                .do_reada(do_reada),
187
                                                                                .do_writea(do_writea),
188
                                                                                .do_preacharge(do_preacharge),
189
                                                                                .do_rw(do_rw),
190
                                                                                .rowaddr(rowaddr),
191
                                                                                .coladdr(coladdr),
192
                                                                                .bankaddr(bankaddr),
193
                                                                                .page_mod(page_mod),
194
                                                                                .do_load_mod(do_load_mod),
195
                                                                                .do_refresh(do_refresh),
196
                                                                                .caddr(caddr),
197
                                                                                .do_nop(do_nop),
198
                                                                                .rw_flag(rw_flag),
199
                                                                                .oe4(oe4),
200
                                                                                // Output
201
                                                                                .sadd(sadd),
202
                                                                                .ba(ba),
203
                                                                                .cs(cs),
204
                                                                                .ras(ras),
205
                                                                                .cas(cas),
206
                                                                                .we(we),
207
                                                                                .cke(cke)
208
                                                                                );
209
 
210
 
211
cmd_detector cmd_detector0(// Input
212
                                                                        .reset(reset),
213
                                                                        .clk0(clk0),
214
                                                                        .nop(nop),
215
                                                                        .ref_req(ref_req),
216
                                                                        .refresh(refresh),
217
                                                                        .reada(reada),
218
                                                                        .writea(writea),
219
                                                                        .preacharge(preacharge),
220
                                                                        .load_mod(load_mod),
221
                                                                        .ref_dur(ref_dur),
222
                                                                        // Output
223
                                                                        .do_nop(do_nop),
224
                                                                        .do_reada(do_reada),
225
                                                                        .do_writea(do_writea),
226
                                                                        .do_writea1(do_writea1),
227
                                                                        .do_refresh(do_refresh),
228
                                                                        .do_preacharge(do_preacharge),
229
                                                                        .do_load_mod(do_load_mod),
230
                                                                        .rw_flag(rw_flag)
231
                                                                        );
232
 
233
 
234
endmodule

powered by: WebSVN 2.1.0

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