Verilog-A参考手册
前言
提示:这里可以添加本文要记录的大概内容:
例如:随着人工智能的不断发展,机器学习这门技术也越来越重要,很多人都开启了学习机器学习,本文就介绍了机器学习的基础内容。
提示:以下是本篇文章正文内容,下面案例可供参考
一、概述和优势
Verilog-A仅描述模拟行为,但具有与数字行为相连接的能力。
模型创建者提供输入与输出之间的本构关系、参数名称及取值范围,通过Verilog-A编译器处理模型与模拟器之间的交互。
二、Verilog-A 模块
1.模块声明
模块声明为模拟器提供模块名称、输入输出端口、参数信息及行为描述。
模块实例化
句法:
module/macromodule module_identifier [(port {, port, ...})]
module_statements
endmodule
module_identifier定义模块名称,端口port的可选列表定义与模块之间的连接,module_statements描述模块行为。
实例:电阻模块
'include "disciplines.vams" //通用定义
module R(p,n);
electrical p,n; //电学量
parameter real R=50.0; //参数为real类型,默认值为50
analog
V(p,n) <+ R * I(p,n);
endmodule
2.端口
需要在模块声明之后列出端口,并在模块主体中对端口的类型和方向进行说明。
示例:
module resistor(p,n);
inout p,n;
electrical p,n;
…
module modName(outPort, inPort);
output outPort;
input inPort;
electrical outPort, inPort;
…
端口也可以支持向量(总线)。???
3.描述模拟行为
在analog块中用过程语句对各组成部分的模拟行为进行描述。
句法:
analog block_statement //block_statement为一组语句当中的单个模拟语句
实例:
analog V(n1, n2) <+ 1; // 1V电源
analog begin
vin = V(in);
if (vin >= signal_in_dead_high)
vout = vin - signal_in_dead_high;
else
if (vin <= signal_in_dead_low)
vout = vin - signal_in_dead_low;
else
vout = 0.0;
V(out) <+ vout;
end
4.分支
分支为两个网络之间的路径。
句法:
branch list_of_branches //list_of_branches 是以逗号分隔的分支名称列表
5.模拟信号
访问网络和分支信号
网络和分支名称被指定为访问功能的参数。
实例:
Vin = V(in);
CurrentThruBranch = I(myBranch); //myBranch为分支名称
间接分支分配
V(n) : V(p) == 0; //找到可以让V(p)变为0的V(n)
间接分支分配只可用于analog块中。
分支贡献语句
V(n1, n2) <+ expression;
I(n1, n2) <+ expression;
6.analog函数
analog function {real|integer} function_name;
input_declaration; //输入参数及变量描述
statement_block;
endfunction
input_declaration
input passed_parameters;
real parameter_list;
statement_block
实例:
analog function real B_of_T;
input B, T, T_NOM, XTB;
real B, T, T_NOM, XTB;
begin
B_of_T = B * pow(T / T_NOM, XTB);
end
endfunction
该analog函数可被以下语句调用:
BF_T = B_of_T(BF, T, T_NOM, XTB);
7.层次结构
语法:
module_or_primative [#(.param1(expr)[, .param2(expr))]]instance_name ({node {, node});
实例:
phaseDetector #(.gain(2)) pd1(lo, rf, if_);
vco #(.gain(loopGain/2), .fc(fc) ) vco1(out, lo);
模型实例化参数分配
根据参数顺序:实例声明中参数次序默认遵循模块声明中参数次序
实例:
// Voltage Controlled Oscillator
module vco(in, out);
inout in, out;
electrical in, out;
parameter real gain = 1, fc = 1;
analog
V(out) <+ sin(2 * `M_PI * (fc * $realtime() + idt(gain * V(in))));
endmodule
...
// Instantiate a vco module name vco1 connected to out and
// lo with gain = 0.5, fc = 2k
vco #(0.5, 2000.0) vco1(out, lo);
根据参数名称:通过参数名称来显示分配实例中的参数
// Voltage Controlled Oscillator
module vco(in, out);
inout in, out;
electrical in, out;
parameter real gain = 1, fc = 1;
analog
V(out) <+ sin(2*‘M_PI*(fc*$realtime() + idt(gain*V(in))));
endmodule
...
// Instantiate a vco module name vco1 connected to out and lo with
// gain = loopGain/2, fc = fc
vco #(.gain(loopGain/2), .fc(fc) ) vco1(out, lo);
# 总结 提示:这里对文章进行总结: 例如:以上就是今天要讲的内容,本文仅仅简单介绍了pandas的使用,而pandas提供了大量能使我们快速便捷地处理数据的函数和方法。