參考文獻:
(1)HSPICE® User Guide:Simulation and Analysis-Chapter29 Using Verilog-A
(2)Verilog-AMS Language Reference ManualAnalog & Mixed-Signal Extensions to Verilog-HDL
PS.03.23 最近要用hspice仿真,需要4X4的掃描信號,本來看手冊上說hspice只支持verilog-a,所以打算學一下來着,但是吧,萬能的師姐告訴我可以改下脈沖的延時和占空比就可以得到這幾個信號。我看了一天這個,半天都在找Verilog-a/AMS的資料,但是也用不到了。參考的文件里,第一個是hspice用戶手冊,裝的軟件里就有,第二本是語言參考手冊,可以再谷歌學術的鏡像站搜到,可以下載。這篇文章,嗯,寫都寫了。
案例文件分析:
Simple Resistor: resistor.sp
This example shows a very simple Verilog-A resistor model.
簡單電阻模型:resistor.sp
1 Title: Simple Verilog-A Resistor 2 3 .hdl resistor.va 4 .options post=1 5 6 X1 1 0 resistor r=1 7 VS 1 0 1 8 9 .dc VS 0 10 1 10 11 .end
.sp文件是先使用.hdl引入.va文件,然后設置控制語句,寫網表,最后直流仿真輸出。
簡單電阻模型:resistor.va
// Simple resistor `include "disciplines.vams" module resistor(p,n); parameter R=1.0 from (0:inf); electrical p,n; analog I(p,n) <+ V(p,n)/R; endmodule
首先`include聲明是引入了標准定義包,根據Verilog-AMS手冊定義:This annex contains the standard definition packages (disciplines.vams, constants.vams and driver_access.vams) for Verilog-AMS HDL.
module與endmodule定義一個大的模塊,電阻的定義寫在里面:包括參數R的定義(parameter),節點p,n的定義(electrical),還有模擬信號的輸出語句(analog)。
Simple Voltage Source: sinev.sp
This example shows a simple voltage source and illustrates how the $bound_step() function may be used to control and maximum allowed time step in a transient simulation.
簡單電壓源模型:sinev.sp
Title: Simple Sinusoidal Source .hdl sinev.va .options post=1 notop X1 0 out sinev gain=3.0 freq=0.5 .tran 0.01 10 .end
.option notop:Suppresses topology checks to increase preprocessing speed. 提高處理速度。
這個文件用瞬態分析(.trans)得到這電壓源的波形,步長0.01s,總10s。
簡單電壓源模型:sinev.va
// Simple sinusoidal source `include "disciplines.vams" `include "constants.vams" module sinev(n1,n2); electrical n1,n2; parameter real gain = 1.0; parameter real freq = 1.0 from (0:inf); analog begin V(n2,n1) <+ gain * sin(2 * `M_PI * freq * $abstime); // Bound the maximum time step to insure the signal is // adequately represented: $bound_step(0.05/freq); end endmodule
與上一個例子相比多了一個聲明constants.vams,這個是對基礎物理與數學常數進行聲明。
定義雙精度浮點數(real)參數並賦值
直接用函數輸出模擬電壓信號(analog),注意節點順序。
$bound_step(0.05/freq) 約束最大時間步長,以確保信號被充分表示。
這個分類應該到此完結了。
有本書:https://www.ituring.com.cn/book/1681
關於verilog-a在ADS方面的應用:https://www.jianshu.com/p/0aab2f48b9cb
