veriloga要怎么在candence中编译和加密?

从编译器的角度来说,我在ADS中可能就是直接用notepad编写,然后生成检查,它会有提示成功或报错的信息。但是对比下来,我发现candence的编译器更加方便编写va,所以把运行成功的步骤记录下来,防止遗忘。

首先,在libManager界面create new cell,选择veriloga;也可以选择asm

复制这段opamp定义的代码

`include "discipline.h"
`include "constants.h"

// $Date: 1997/08/28 05:45:21 $
// $Revision: 1.1 $
//
//
// Based on the OVI Verilog-A Language Reference Manual, version 1.0 1996
//
//
 
`define PI  	3.14159265358979323846264338327950288419716939937511



//--------------------
// opamp
//
// -  operational amplifier
//
// vin_p,vin_n:	differential input voltage [V,A]
// vout:	output voltage [V,A]
// vref:	reference voltage [V,A]
// vspply_p:	positive supply voltage [V,A]
// vspply_n:	negative supply voltage [V,A]
//
// INSTANCE parameters
//    gain           = gain []
//    freq_unitygain = unity gain frequency [Hz]
//    rin            = input resistance [Ohms]
//    vin_offset     = input offset voltage referred to negative [V]
//    ibias          = input current [A]
//    iin_max           = maximum current [A]
//    slew_rate      = slew rate [A/F]
//    rout           = output resistance [Ohms]
//    vsoft          = soft output limiting value [V]
//
// MODEL parameters
//    {none}
//

module opamp(vout, vref, vin_p, vin_n, vspply_p, vspply_n);
input vref, vspply_p, vspply_n;
inout vout, vin_p, vin_n;
electrical vout, vref, vin_p, vin_n, vspply_p, vspply_n;
parameter real gain = 835e3;
parameter real freq_unitygain  = 1.0e6;
parameter real rin = 1e6;
parameter real vin_offset = 0.0;
parameter real ibias = 0.0;
parameter real iin_max = 100e-6;
parameter real slew_rate = 0.5e6;
parameter real rout = 80;
parameter real vsoft = 0.5;
   real c1;
   real gm_nom;
   real r1;
   real vmax_in;
   real vin_val;

   electrical cout;

 
   analog begin

      @ ( initial_step or initial_step("dc") ) begin
	 c1 = iin_max/(slew_rate);
	 gm_nom = 2 * `PI * freq_unitygain * c1;
	 r1 = gain/gm_nom;
	 vmax_in = iin_max/gm_nom;
      end
 
      vin_val = V(vin_p,vin_n) + vin_offset;

      //
      // Input stage.
      //
      I(vin_p, vin_n) <+ (V(vin_p, vin_n) + vin_offset)/ rin;
      I(vref, vin_p) <+ ibias;
      I(vref, vin_n) <+ ibias;

      //
      // GM stage with slewing
      //
      I(vref, cout) <+ V(vref, cout)/100e6;

      if (vin_val > vmax_in)
         I(vref, cout) <+ iin_max;
      else if (vin_val < -vmax_in)
         I(vref, cout) <+ -iin_max;
      else 
         I(vref, cout) <+ gm_nom*vin_val ;

      //
      // Dominant Pole.
      //
      I(cout, vref) <+ ddt(c1*V(cout, vref));
      I(cout, vref) <+ V(cout, vref)/r1;

      //
      // Output Stage.
      //
      I(vref, vout) <+ V(cout, vref)/rout;
      I(vout, vref) <+ V(vout, vref)/rout;

      //
      // Soft Output Limiting.
      //
      if (V(vout) > (V(vspply_p) - vsoft))
         I(cout, vref) <+ gm_nom*(V(vout, vspply_p)+vsoft);
      else if (V(vout) < (V(vspply_n) + vsoft))
         I(cout, vref) <+ gm_nom*(V(vout, vspply_n)-vsoft); 
   end
endmodule





黏贴到Text Editor中,选择保存和生成这两个按钮

如果编译成功,则会跳出pin脚设置界面,如果有错误可以查看AHDL Linter Log File文件。

在引用测试的时候,把va参数开启,在仿真的时候需要把va的仿真器兼容进去。

此时va代码已经生成了,需要去对应的lib库路径底下编译va文件

进入va文件夹,找到verilog.asm文件,然后

ncprotect -extension vap -language vlog -autoprotect verilog.vams

那么就会生成一份文件,verilog.vams.vap这个文件是编译过的,删除.vap就可以使用了。

编译的具体指令可以参考

ncverilog -help
ncprotect -help

  • 4
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值