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

Subversion Repositories spacewire

[/] [spacewire/] [trunk/] [rtl/] [TickCounter.v] - Blame information for rev 27

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 8 btltz
//File name=Module=TickCounter       2005-04-23      btltz@mail.china.com    btltz from CASIC  
2
//Description:    Tick counter / time reister   
3
//                
4
//Abbreviations:                                                        
5
//Origin:  SpaceWire Std - Draft-1(Clause 8)of ECSS(European Cooperation for Space Standardization),ESTEC,ESA.
6
//         SpaceWire Router Requirements Specification Issue 1 Rev 5. Astrium & University of Dundee 
7
//TODO:   
8
////////////////////////////////////////////////////////////////////////////////////
9
//
10
/*synthesis translate_off*/
11
`timescale 1ns/100ps
12
/*synthesis translate_on */
13
`define    reset     1    // WISHBONE standard reset
14
 
15
module TickCounter #(parameter CW=24)                     // internal counter width 
16
                   (
17
                // External time interface(also associated with the external input/output port)                                         
18
                                                        output TICK_OUT,
19
                                                        input TICK_IN,
20
                                                        output [CW-1:0] COUNT,
21
 
22
                                                        output [5:1] time_o,
23
                                                   output [1:0] ctrl_flg_o,
24
                                                        input [5:1]     time_i,
25
                                                        input [1:0]      ctrl_flg_i,
26
      // interconnect
27
                               output [] TimeReg_o,
28
                                                        input [PORTNUM-1:0] IFtick_i,             // Interface ports tick_out internal 
29
 
30
      // global signal input
31
                               input reset,
32
                                                        input gclk   );
33
 
34
reg [] TimeReg;                                                                                                                 // "time register"
35
reg [CW-1:0] tcnt;                                          // "internal time counter"
36
 
37
assign TimeReg_o = TimeReg;
38
 
39
///////////////////////
40
//       tcnt(timer counter)
41
//       
42
wire run_tcnt = |(IFtick_i[i]) ||       tick_in;
43
 
44
always @(posedge gclk)
45
begin
46
 if(reset==`reset)
47
   tcnt <= 0;
48
 else if(run_tcnt)
49
   tcnt <= tcnt + 1;
50
end
51
 
52
 
53
endmodule
54
 
55
`undef reset

powered by: WebSVN 2.1.0

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