EmbDev.net

Forum: FPGA, VHDL & Verilog test bench for digitAL PI controller


von Rock B. (rocko445)


Attached files:

Rate this post
useful
not useful
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

: Edited by User
Please log in before posting. Registration is free and takes only a minute.
Existing account
Do you have a Google/GoogleMail account? No registration required!
Log in with Google account
No account? Register here.