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

Subversion Repositories pit

[/] [pit/] [trunk/] [rtl/] [sys_verilog/] [pit_prescale.sv] - Diff between revs 21 and 22

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

Rev 21 Rev 22
Line 63... Line 63...
logic                   rollover;      //
logic                   rollover;      //
 
 
// This was going to be a "generate" block but iverilog does't support that
// This was going to be a "generate" block but iverilog does't support that
//  command so we'll just have to trust the compiler to simplify the logic based
//  command so we'll just have to trust the compiler to simplify the logic based
//  on the setting of the constant "DECADE_CNTR"
//  on the setting of the constant "DECADE_CNTR"
   always @*
   always_comb
     if ( DECADE_CNTR )
     if ( DECADE_CNTR )
       case (divisor)
       case (divisor)
          0: end_count = 1;
          0: end_count = 1;
          1: end_count = 2;
          1: end_count = 2;
          2: end_count = 4;
          2: end_count = 4;
Line 78... Line 78...
          7: end_count = 10_000;
          7: end_count = 10_000;
          8: end_count = 20_000;
          8: end_count = 20_000;
          default: end_count = 20_000;
          default: end_count = 20_000;
        endcase
        endcase
    else
    else
        case (divisor)
        unique case (divisor)
           0: end_count = 1;
           0: end_count = 1;
           1: end_count = 2;
           1: end_count = 2;
           2: end_count = 4;
           2: end_count = 4;
           3: end_count = 8;
           3: end_count = 8;
           4: end_count = 16;
           4: end_count = 16;
Line 109... Line 109...
 
 
// Div N Counter
// Div N Counter
// If the "NO_PRESCALE" parameter is set the compiler should hopefully strip
// If the "NO_PRESCALE" parameter is set the compiler should hopefully strip
//  these counter bits when the module is compiled because the only place the
//  these counter bits when the module is compiled because the only place the
//  register outputs go to drive a signal "rollover" that is already a constant.
//  register outputs go to drive a signal "rollover" that is already a constant.
always @(posedge bus_clk or negedge async_rst_b)
always_ff @(posedge bus_clk or negedge async_rst_b)
  if ( !async_rst_b )
  if ( !async_rst_b )
    cnt_n  <= 1;
    cnt_n  <= 1;
  else if ( !counter_sync || rollover)
  else if ( !counter_sync || rollover)
    cnt_n  <= 1;
    cnt_n  <= 1;
  else
  else

powered by: WebSVN 2.1.0

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