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

Subversion Repositories hive

[/] [hive/] [trunk/] [v04.05/] [dds_static.v] - Blame information for rev 8

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

Line No. Rev Author Line
1 4 ericw
/*
2
--------------------------------------------------------------------------------
3
 
4
Module: dds_static.v
5
 
6
Function:
7
- Forms a simple static DDS source.
8
 
9
Instantiates:
10
- Nothing.
11
 
12
Notes:
13
- Employs phase accumulation, phase increment is multiplication factor.
14
- clk_o = clk_i * INC_VAL * 2^-ACCUM_W
15
- Output is roughly square, long-term avg of duty cycle is generally 50/50.
16
- For correct operation, INC_VAL < 2^(ACCUM_W-1).
17
 
18
--------------------------------------------------------------------------------
19
*/
20
 
21
module dds_static
22
        #(
23
        parameter       integer                                                 ACCUM_W                 = 8,            // phase accumulator width (bits)
24
        parameter       [ACCUM_W-1:0]                                    INC_VAL                 = 8             // phase increment value
25
        )
26
        (
27
        // clocks & resets
28
        input                   wire                                                            clk_i,                                          // clock
29
        input                   wire                                                            rst_i,                                          // async reset, active high
30
        //
31
        output          wire                                                            clk_o                                                   // output clock
32
        );
33
 
34
 
35
        /*
36
        ----------------------
37
        -- internal signals --
38
        ----------------------
39
        */
40
        reg                                     [ACCUM_W-1:0]                    accum;
41
 
42
 
43
 
44
        /*
45
        ================
46
        == code start ==
47
        ================
48
        */
49
 
50
 
51
        // accumulate
52
        always @ ( posedge clk_i or posedge rst_i ) begin
53
                if ( rst_i ) begin
54
                        accum <= 'b0;
55
                end else begin
56
                        accum <= accum + INC_VAL;
57
                end
58
        end
59
 
60
        // assign output
61
        assign clk_o = accum[ACCUM_W-1];
62
 
63
 
64
endmodule

powered by: WebSVN 2.1.0

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