Verilog-A参考手册

本文详细解读了Verilog-A语言的模块声明、端口定义、模拟行为描述、分支处理、模拟信号使用、analog函数以及层次结构。通过实例演示,了解如何利用Verilog-A创建和连接模拟电路模型以实现精确的模拟仿真。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

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提供了大量能使我们快速便捷地处理数据的函数和方法。
评论 5
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值