Académique Documents
Professionnel Documents
Culture Documents
现在的状态算是入门了,写了个简单的 PLL。总结这几天的学习,觉得效率太低,我以前有一
基础和电路基础)
1、基尔霍夫定律撑起了整个电路学的大厦(当然也可以认为基尔霍夫定律只是麦克斯韦方程的
简化版),作为模拟电路描述语言 Verilog-A,同样将基尔霍夫定律作为其基本,最重要的两个
概念便是流量(Flow)和位(Potential),在电学里是电流和电压,在力学里可以是力和距离,在
热学里可以是功率和温差,等等。
if ( expression ) true_statement ;
procedural_assignment ) statement
0 则相反
//比例积分,式中的 0 表示积分的初值
数据类型:
integer、real,另外就是 discipline,不知道怎么翻译比较好,比如说它将电压电流这两个 na
另外,新加的一个符号<+,这个专门给模拟信号赋值用,注意这个赋值符号是可以累加的,就
是说赋两次值的话,它会加起来,而不是覆盖,如:
预处理&宏:
跟 Verilog 差不多
3、Verilog-A 程序基本结构:
analog //模拟语句从这开始
电压与输出电流的关系
endmodule //模块定义结束
写的 PLL 仿真程序,把它看完并看懂(当然第一次并不需要看得很仔细):
`include "constants.vams"
//VCO
input in;
output out;
analog
endmodule
//phase detector
module my_pd(ref,rf,outP,outN);
input ref,rf;
output outP,outN;
electrical ref,rf,outP,outN;
real clr,up,down;
analog begin
@(cross(V(ref)-0.5,+1))
up = 1;
@(cross(V(rf)-0.5,+1))
down = 1;
clr = absdelay(up && down, 1e-9);
if(clr>0.5) begin
up = 0;
down = 0;
end
if(up) begin
if(V(outP)>= 3)
end
else begin
I(outP) <+ 0;
end
if(down) begin
if(V(outN) <= 0)
end
else begin
I(outN) <+ 0;
end
end
endmodule
//N divider
module my_divider(in,out);
input in;
output out;
electrical in,out;
integer cnt;
analog begin
@(cross(V(in),+1))
cnt = cnt+1;
if(cnt>=K)
cnt=0;
if(cnt*2-K>=0)
V(out) <+ 1;
else
V(out) <+ 0;
end
endmodule