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

Subversion Repositories amber

[/] [amber/] [trunk/] [hw/] [vlog/] [system/] [clocks_resets.v] - Diff between revs 2 and 14

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 2 Rev 14
Line 237... Line 237...
 
 
 
 
 
 
`ifndef XILINX_FPGA
`ifndef XILINX_FPGA
 
 
localparam [7:0] FULL_COUNT     = `AMBER_CLK_DIVIDER / 4;
real      brd_clk_period = 6000;  // use starting value of 6000pS
localparam [7:0] HALF_COUNT     = FULL_COUNT / 2;
real      pll_clk_period = 1000;  // use starting value of 1000pS
 
real      brd_temp;
// e.g. Divide clock by 6 to get 33MHz
reg       pll_clk_beh;
reg [7:0] clk_div_count;
reg       sys_clk_beh;
 
integer   pll_div_count = 0;
 
 
 
// measure input clock period
initial
initial
    begin
    begin
    clk_div_count <= FULL_COUNT - 1'd3;
    @ (posedge i_brd_clk_p)
    forever @ (posedge i_brd_clk_p)
    brd_temp = $time;
        if ( clk_div_count == ( FULL_COUNT - 1'd1 ) )
    @ (posedge i_brd_clk_p)
            clk_div_count <= 8'h0;
    brd_clk_period = $time - brd_temp;
 
    pll_clk_period = brd_clk_period / 4;
 
    end
 
 
 
// Generate an 800MHz pll clock based off the input clock
 
always @( posedge i_brd_clk_p )
 
    begin
 
    pll_clk_beh = 1'd1;
 
    # ( pll_clk_period / 2 )
 
    pll_clk_beh = 1'd0;
 
    # ( pll_clk_period / 2 )
 
 
 
    pll_clk_beh = 1'd1;
 
    # ( pll_clk_period / 2 )
 
    pll_clk_beh = 1'd0;
 
    # ( pll_clk_period / 2 )
 
 
 
    pll_clk_beh = 1'd1;
 
    # ( pll_clk_period / 2 )
 
    pll_clk_beh = 1'd0;
 
    # ( pll_clk_period / 2 )
 
 
 
    pll_clk_beh = 1'd1;
 
    # ( pll_clk_period / 2 )
 
    pll_clk_beh = 1'd0;
 
 
 
    end
 
 
 
// Divide the pll clock down to get the system clock
 
always @( pll_clk_beh )
 
    begin
 
    if ( pll_div_count == (
 
        `AMBER_CLK_DIVIDER
 
        * 2 ) - 1 )
 
        pll_div_count <= 'd0;
        else
        else
            clk_div_count <= clk_div_count + 1'd1;
        pll_div_count <= pll_div_count + 1'd1;
 
 
 
    if ( pll_div_count == 0 )
 
        sys_clk_beh = 1'd1;
 
    else if ( pll_div_count ==
 
        `AMBER_CLK_DIVIDER
 
        )
 
        sys_clk_beh = 1'd0;
    end
    end
 
 
assign o_sys_clk        = clk_div_count < HALF_COUNT;
assign o_sys_clk        = sys_clk_beh;
assign rst0             = i_brd_rst;
assign rst0             = i_brd_rst;
assign calib_done_33mhz = 1'd1;
assign calib_done_33mhz = 1'd1;
assign o_clk_200        = i_brd_clk_p;
assign o_clk_200        = i_brd_clk_p;
 
 
`endif
`endif

powered by: WebSVN 2.1.0

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