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

Subversion Repositories embedded_risc

[/] [embedded_risc/] [trunk/] [Verilog/] [ras_cas_delay.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 Ras-to-Cas Delay Counter
3
 
4
 FILE NAME:     ras_cas_delay.v
5
 VERSION:       1.0
6
 DATE:          April 28th, 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 RAS-to-CAS Delay Counter block.
13
 
14
 
15
 Hossein Amidi
16
 (C) April 2002
17
 
18
*********************************************************/
19
 
20
// DEFINES
21
`timescale 1ns / 10ps
22
 
23
module ras_cas_delay(// Input
24
                                                        reset,
25
                                                        clk0,
26
                                                        do_reada,
27
                                                        do_writea,
28
                                                        ras_cas,
29
                                                        // Output
30
                                                        do_rw
31
                                                        );
32
 
33
// Parameter
34
`include        "parameter.v"
35
 
36
// Input
37
input reset;
38
input clk0;
39
input do_reada;
40
input do_writea;
41
input [rc_size - 1 : 0]ras_cas;
42
 
43
// Output
44
output do_rw;
45
 
46
// Internal wire and reg signals
47
wire reset;
48
wire clk0;
49
wire do_reada;
50
wire do_writea;
51
wire [rc_size - 1 : 0]ras_cas;
52
 
53
reg     do_rw;
54
reg   [3:0]rw_shift;
55
 
56
 
57
// Assignment
58
 
59
 
60
 
61
// This always block tracks the time between the activate command and the
62
// subsequent writea or reada command, RC.  The shift register is set using
63
// the configuration register setting ras_cas. The shift register is loaded with
64
// a single '1' with the position within the register dependent on ras_cas.
65
// When the '1' is shifted out of the register it sets so_rw which triggers
66
// a writea or reada command
67
//
68
always @(posedge reset or posedge clk0)
69
begin
70
        if (reset == 1'b1)
71
        begin
72
                rw_shift <= 0;
73
                do_rw    <= 0;
74
        end
75
 
76
        else
77
        begin
78
 
79
                if ((do_reada == 1) | (do_writea == 1))
80
                begin
81
                        if (ras_cas == 1)                          // Set the shift register
82
                                do_rw <= 1;
83
                        else if (ras_cas == 2)
84
                                rw_shift <= 1;
85
                        else if (ras_cas == 3)
86
                                rw_shift <= 2;
87
                end
88
                else
89
                begin
90
                        rw_shift[2:0] <= rw_shift[3:1];          // perform the shift operation
91
                        rw_shift[3]   <= 0;
92
                        do_rw         <= rw_shift[0];
93
                end
94
        end
95
end
96
 
97
 
98
endmodule

powered by: WebSVN 2.1.0

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