source: PlatformSupport/Deprecated/pcores/radio_controller_v1_07_a/hdl/verilog/radio_controller_TxTiming.v

Last change on this file was 389, checked in by murphpo, 18 years ago

Adding TxTiming module for new radio controller

File size: 2.6 KB
Line 
1module radio_controller_TxTiming
2(
3    clk,
4    reset,
5   
6    Tx_swEnable,
7   
8    TxGain_target,
9    TxGain_rampGainStep,
10    TxGain_rampTimeStep,
11   
12    dly_hwTxEn,
13    dly_TxStart,
14    dly_PowerAmpEn,
15    dly_RampGain,
16   
17    hw_TxEn,
18    hw_TxGain,
19    hw_PAEn,
20    hw_TxStart
21);
22
23    input           clk;
24    input           reset;
25   
26    input           Tx_swEnable;
27    input   [0:5]   TxGain_target;
28    input   [0:3]   TxGain_rampGainStep;
29    input   [0:3]   TxGain_rampTimeStep;
30   
31    input   [0:7]   dly_hwTxEn;
32    input   [0:7]   dly_TxStart;
33    input   [0:7]   dly_PowerAmpEn;
34    input   [0:7]   dly_RampGain;
35
36    output          hw_TxEn;
37    output          hw_TxStart;
38    output          hw_PAEn;
39    output  [0:5]   hw_TxGain;
40
41    reg     [0:7]   GainRamp_clockEn_counter;
42    reg     [0:7]   timing_counter;
43
44    wire    [0:6]   NewTxGain;
45    reg     [0:6]   TxGainBig;
46   
47    wire AutoGainRampEn;
48
49
50    //The output gain signal is the output of an accumulator, enabled after dly_RampGain clock cycles
51    //This signal is the input to the accumulator register. TxGainBig has one extra MSB to ease overflow detection
52    assign NewTxGain = ( (TxGainBig + TxGain_rampGainStep) > TxGain_target) ? TxGain_target : (TxGainBig + TxGain_rampGainStep);
53
54    //The hw_TxGain output, which eventually connects to the radio's parallel gain control bus,
55    //get the 6 LSB of the internal accumulator value
56    assign hw_TxGain = TxGainBig[1:6];
57
58    //Enable the outputs when the timing counter has excedded the various control
59    //thresholds given by the dly_* inputs
60    assign hw_TxEn = timing_counter > dly_hwTxEn;
61    assign hw_PAEn = timing_counter > dly_PowerAmpEn;
62    assign hw_TxStart = timing_counter > dly_TxStart;
63
64    //Enable the gain ramp accumulator after the given delay
65    assign AutoGainRampEn = timing_counter > dly_RampGain;
66
67    //Instiantiates a counter which runs once the timing counter exceeds the threshold
68    //for starting the ramping of Tx gains; the counter increments every TxGain_rampTimeStep cycles
69    always @( posedge clk )
70    begin
71        if(reset | ~Tx_swEnable)
72            TxGainBig <= 0;
73        else if( AutoGainRampEn & (GainRamp_clockEn_counter==1))
74            TxGainBig <= NewTxGain;
75    end
76
77    //Instantiate a counter star starts when the software enables Tx mode
78    always @( posedge clk )
79    begin
80        if(reset | ~Tx_swEnable)
81            timing_counter <= 0;
82        else if(Tx_swEnable & timing_counter < 255)
83            timing_counter <= timing_counter + 1;
84    end
85
86    //Instantiate a counter used to drive the clock enable of the gain ramp counter above
87    always @( posedge clk )
88    begin
89        if(reset | GainRamp_clockEn_counter == TxGain_rampTimeStep)
90            GainRamp_clockEn_counter <= 0;
91        else
92            GainRamp_clockEn_counter <= GainRamp_clockEn_counter + 1;
93    end
94endmodule
Note: See TracBrowser for help on using the repository browser.