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

Subversion Repositories ssbcc

[/] [ssbcc/] [trunk/] [core/] [9x8/] [peripherals/] [timer.v] - Diff between revs 2 and 10

Only display areas with differences | Details | Blame | View Log

Rev 2 Rev 10
//
//
// PERIPHERAL timer:  @NAME@
// PERIPHERAL timer:  @NAME@
 
// Copyright 2013, Sinclair R.F., Inc.
//
//
localparam L__COUNT = @RATEMETHOD@-1;
localparam L__COUNT = @RATEMETHOD@-1;
localparam L__COUNT_NBITS = $clog2(L__COUNT);
localparam L__COUNT_NBITS = $clog2(L__COUNT);
generate
generate
reg [L__COUNT_NBITS-1:0] s__count = L__COUNT[0+:L__COUNT_NBITS];
reg [L__COUNT_NBITS-1:0] s__count = L__COUNT[0+:L__COUNT_NBITS];
always @ (posedge i_clk)
always @ (posedge i_clk)
  if (i_rst) begin
  if (i_rst) begin
    s__count <= L__COUNT[0+:L__COUNT_NBITS];
    s__count <= L__COUNT[0+:L__COUNT_NBITS];
    s__expired <= 1'b0;
    s__expired <= 1'b0;
  end else begin
  end else begin
    if (s__expired)
    if (s__expired)
      s__count <= L__COUNT[0+:L__COUNT_NBITS];
      s__count <= L__COUNT[0+:L__COUNT_NBITS];
    else
    else
      s__count <= s__count - { {(L__COUNT_NBITS-1){1'b0}}, 1'b1 };
      s__count <= s__count - { {(L__COUNT_NBITS-1){1'b0}}, 1'b1 };
    s__expired <= (s__count == { {(L__COUNT_NBITS-1){1'b0}}, 1'b1 });
    s__expired <= (s__count == { {(L__COUNT_NBITS-1){1'b0}}, 1'b1 });
  end
  end
endgenerate
endgenerate
 
 

powered by: WebSVN 2.1.0

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