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

Subversion Repositories freq_div

[/] [freq_div/] [trunk/] [rtl/] [odd.v] - Diff between revs 4 and 5

Show entire file | Details | Blame | View Log

Rev 4 Rev 5
Line 34... Line 34...
                                counter <= N;
                                counter <= N;
                                out_counter <= ~out_counter;
                                out_counter <= ~out_counter;
                        end
                        end
                        else
                        else
                        begin
                        begin
                                counter <= counter-1;
                                counter <= counter - 1'b1;
                        end
                        end
                end
                end
        end
        end
 
 
        reg [`SIZE-1:0] initial_begin;           // this is used to offset the negative edge counter
        reg [`SIZE-1:0] initial_begin;           // this is used to offset the negative edge counter
        wire [`SIZE:0] interm_3;                 // from the positive edge counter in order to
        wire [`SIZE:0] interm_3;                 // from the positive edge counter in order to
        assign interm_3 = {1'b0,N} + 3;         // guarante 50% duty cycle.
        assign interm_3 = {1'b0,N} + 2'b11;             // guarante 50% duty cycle.
 
 
        // counter driven by negative edge of clock.
        // counter driven by negative edge of clock.
        always @(negedge clk)
        always @(negedge clk)
        begin
        begin
                if(reset | rst_pulse)                                           // reset the counter at system reset
                if(reset | rst_pulse)                                           // reset the counter at system reset
Line 61... Line 61...
                                counter2 <= N;
                                counter2 <= N;
                                out_counter2 <= ~out_counter2;
                                out_counter2 <= ~out_counter2;
                        end
                        end
                        else
                        else
                        begin
                        begin
                                counter2 <= counter2-1;
                                counter2 <= counter2 - 1'b1;
                        end
                        end
                end
                end
                else if(enable)
                else if(enable)
                begin
                begin
                        initial_begin <= initial_begin - 1;
                        initial_begin <= initial_begin - 1'b1;
                end
                end
        end
        end
 
 
        //
        //
        // reset pulse generator:
        // reset pulse generator:
Line 98... Line 98...
                        else
                        else
                        begin
                        begin
                                rst_pulse <= 0;
                                rst_pulse <= 0;
                        end
                        end
                end
                end
 
        end
 
 
 
        always @(posedge clk)
 
        begin
                old_N <= N;     // always save the old N value to guarante reset from
                old_N <= N;     // always save the old N value to guarante reset from
        end                             // an even-to-odd transition.
        end                             // an even-to-odd transition.
 
 
endmodule //odd
endmodule //odd
 
 
 No newline at end of file
 No newline at end of file

powered by: WebSVN 2.1.0

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