VERILOGA语言编程入门

上传人:无*** 文档编号:27062775 上传时间:2021-08-16 格式:PPT 页数:13 大小:308.97KB
返回 下载 相关 举报
VERILOGA语言编程入门_第1页
第1页 / 共13页
VERILOGA语言编程入门_第2页
第2页 / 共13页
VERILOGA语言编程入门_第3页
第3页 / 共13页
点击查看更多>>
资源描述
Compact modeling with VerilogADamien QuerliozInstitut dElectronique Fondamentale, Univ. Paris-Sud, CNRS, Orsay 1 Outline What VerilogA is Two simple examples =, Verilog, Europe-VHDL For analog and mixed signal: USA - VerilogA(MS), Europe - DEPENDS 4 VerilogA vs. C Compact models used to be written in C Need to be rewritten for different simualtors Need to compute derivatievs by hand Need to write different code for DC, AC , tran analysis BUT you understand performance better BUT VerilogA can often be as fast as C today 5 A super simple exampleinclude disciplines.vamsmodule R(p,n);electrical p,n;parameter real R=5 0 .0 ;analog begin V(p,n) + R * I(p,n);endendmodule 6Could as well be I(p,n) + V(p,n)/R; A more complicated example include disciplines.vamsinclude constants.vamsmodule diode(a,c); inout a,c; electrical a,c,int; branch (a,int) res; branch (int,c) dio; parameter real is = 1 0 p from (0 :inf); parameter real rs = 0 .0 from 0 :inf); parameter real cjo = 0 .0 from 0 :inf); parameter real vj = 1 .0 from (0 :inf); real vd, id, qd; analog begin V(res) + I(res) * rs; vd = V(dio); id = is * (limexp(vd/$ vt) - 1 .0 ); if (vd vj) begin qd = cjo * vj * (1 .0 - 2 .0 * sqrt(1 .0 - vd/vj); end else begin qd = cjo * vd * (1 .0 + vd / (4 .0 * vj) ); end I(dio) + id; I(dio) + ddt(qd); endendmodule 7 =, +, = = : assigns a VARIABLE vd = V(dio); + : adds a contribution a voltage or current I(dio) + ddt(qd); = : allows to define a DIFFERENTIAL equation for a voltage or current V(n): ddt(V(n)+V(n)=V(lala); 8 How this works Every ITERATTION of the simulator, it goes thru the analog blocks: this defines the equations the simulator has to solve Highly nonlinear system The simulator will usually use iterative methods (eg Newton/Raphson) NEED DERIVATIVES OF STUFF WITH REGARDS TO VOLTAGES AND CURRENTS It will AUTOMATICALLY compute them based on the equations that you give 9 YOUR EQUATIONS SHOULD BE DERIBAVLE WITH CONTINUOUS DERIVATIVES 1 0 I V I VSEVERE CONVERGENCE ISSUES CONVERGENCE ISSUESI V GOOD IF CAN BE DANGEROUS if (vd =0 ) begin q=0 ; end else begin q=vdend FINE IN ALL LANGUAGES BUT NOT IN VERILOGA WILL ASSUME dq/dvd=0 FOR vd=0 ! 1 1 Other hazards with automatic derivatives SQRT has no derivative at 0 if (vd vj) begin qd = cjo * vj * (1 .0 - 2 .0 * sqrt(1 .0 - vd/vj); end else begin qd = cjo * vd * (1 .0 + vd / (4 .0 * vj) ); End IN ALL LANGUAGES = WOULD HAVE BEEN FINE BUT NOT IN VERILOGA ! 1 2 Other hazards abs has non continuous derivative log is decimal log, ln is natural log Suggestion: always add a comment to remind this when you use log or ln 1 /2 is 0 , like in C (1 .0 /2 .0 is 0 .5 ) Limexp instead of exp if you have convergence issues 1 3
展开阅读全文
相关资源
相关搜索

最新文档


当前位置:首页 > 机械制造 > 工业自动化


copyright@ 2023-2025  zhuangpeitu.com 装配图网版权所有   联系电话:18123376007

备案号:ICP2024067431-1 川公网安备51140202000466号


本站为文档C2C交易模式,即用户上传的文档直接被用户下载,本站只是中间服务平台,本站所有文档下载所得的收益归上传人(含作者)所有。装配图网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。若文档所含内容侵犯了您的版权或隐私,请立即通知装配图网,我们立即给予删除!