Hello, i am trying to build a test bench for a PI conntroller based on
the attached article.
whole code is playing with coefficient for the last line.
how do you recooment to represent the coefficients in the testbench?
Thanks
1 | always #((t0-vctl*kphi)/2) vco<=~vco;
|
1 | module loop_filter(t0,clk,integral,proportional,filt_i,filt_p,vtcl,kptl,vtcl,vco);
|
2 |
|
3 | input t0,smpclk,integral,proportional,filt_i,filt_p,vtcl,kptl,vtcl;
|
4 | output vco;
|
5 |
|
6 | reg integral=4'b0;
|
7 | reg proportional=4'b0;
|
8 |
|
9 | always @(posedge smpclk)
|
10 | begin
|
11 | if (pdup==1'b1) begin
|
12 | integral=integral+filt_i;
|
13 | proportional=filt_p;
|
14 | end
|
15 | else if (pdup==1'b0)
|
16 | begin
|
17 | integral=integral-filt_i;
|
18 | proportional=-filt_p;
|
19 | end
|
20 | else begin
|
21 | proportional=0;
|
22 | end
|
23 |
|
24 | always #((t0-vctl*kphi)/2) vco<=~vco;
|
25 | end
|
26 | endmodule
|