• Skip to main content
  • Skip to search
  • Skip to footer
Cadence Home
  • This search text may be transcribed, used, stored, or accessed by our third-party service providers per our Cookie Policy and Privacy Policy.

  1. Community Forums
  2. Custom IC SKILL
  3. How to use variable port width in VerilogA?

Stats

  • Locked Locked
  • Replies 0
  • Subscribers 143
  • Views 15772
  • Members are here 0
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

How to use variable port width in VerilogA?

Qilong
Qilong over 7 years ago

Hi all, 

  Recently I am writing a simple verilog-A ADC and using variable-port width for the output bits. After I use "parameter integer nlevel=7" in the verilog-A file and finish the verilog-A parsing, I can only see out<0> instead of out<7:0> in the generated symbol. After reading  [SOLVED] Verilog-(AMS) PCell with variable bus width

Creating a component that allows setting a value on a bus in an analog simulation

and this 

Parametrized busses in Verilog-A

I start to build my symbol with SKILL. After loading the SKILL I can observe the port now can change with nlevel. But again, during spectre netlisting it throws out an error saying the verilog-A view is not synchronised with the symbol. After updating the symbol from verilog-A, the variable-port width again becomes out<0> only. 

  I think this issue must have been reported and discussed before. But can anyone provide some references to it? Thanks in advance. 

  PS: Attached are my verilog-A and SKILL code.

  PPS: Now I am using Virtuoso 6.1.6

Fullscreen VerilogA.txt Download
// VerilogA for , verloga

`include "constants.vams"
`include "disciplines.vams"

module flash_nbit_pre_amp( inp, inn, clk, out );
parameter real FS=2;
parameter integer nlevel=7;  //input threshold level
parameter real gain=1;


input inp, inn;
input clk;
output  [nlevel:0]out;


electrical inp, inn,clk;
electrical [nlevel:0]out;



real LSB=FS/nlevel;
real td=0;
real tt=0;
real vdd=1.1;
real vth=vdd/2;
real dir=1;
real Vref_i=0;
real sample;
genvar i;
real result[nlevel:0];




analog begin
	@(cross(V(clk)-vth, +1) or initial_step) begin	
		sample = gain*(V(inp)-V(inn));
		for (i = nlevel; i >= 0; i =i -1) begin
			Vref_i=FS/2-LSB/2-(nlevel-i)*LSB;
			if (sample > Vref_i) begin
				 result[i] = vdd;
			end 
			else begin
			result[i] = 0;
			end 
		end	
	end
	for (i = nlevel; i >=0; i = i - 1) begin
		V(out[i])<+ transition(result[i], td, tt);
	end
end

endmodule
 
Fullscreen SKILL.txt Download
let( (library cell pcellId)
    library="<XXXX>"
    cell="flash_nbit_pre_amp"
    unless(ddGetObj(library)
	error("Couldn't open library %L" library)
    )


    ;--------------------------------------------------------------------
    ; Now the symbol
    ;--------------------------------------------------------------------
    pcellId=pcDefinePCell(
	list(ddGetObj(library) cell "symbol" "schematicSymbol")

	;----------------------------------------------------------------
	; Formal parameters
	;----------------------------------------------------------------
	(
	    (FS 2)
	    (nlevel 7)
	    (gain 1)
	)

	;----------------------------------------------------------------
	; Code itself
	;----------------------------------------------------------------
	let(( cv netINP netINN netCLK netOUT 
		figINP figINN figINN figCLK netOUT hp ps pl bw lh
	    pxc label)

	cv = pcCellView

	;----------------------------------------------------------------
	; Various dimensions
	;----------------------------------------------------------------
	; half pin size
	hp=0.025
	; pin spacing
	ps=0.125
	; pin length
	pl=0.250
	; box width
	bw=1.4375
	; label height
	lh=0.0625
	; param label x coord
	pxc=0.5

	;----------------------------------------------------------------
	; create the shapes - first the pins
	;----------------------------------------------------------------
	figINP = dbCreateRect(cv list("pin" "drawing") list(-hp:-hp hp:hp)) 
	dbCreateLine(cv list("device" "drawing") list(0:0 pl:0))
	figINN = dbCreateRect(cv list("pin" "drawing") list(-hp:-ps-hp hp:-ps+hp))
	dbCreateLine(cv list("device" "drawing") list(0:-ps pl:-ps))
	figCLK = dbCreateRect(cv list("pin" "drawing") list(-hp:-3*ps-hp hp:-3*ps+hp))
	dbCreateLine(cv list("device" "drawing") list(0:-3*ps pl:-3*ps))
	figOUT = dbCreateRect(cv list("pin" "drawing") list(2*pl+bw-hp:-hp 2*pl+bw+hp:hp))
	dbCreateLine(cv list("device" "drawing") list(pl+bw:0 2*pl+bw:0))

	;----------------------------------------------------------------
	; Then the boxes
	;----------------------------------------------------------------
	dbCreateRect(cv list("device" "drawing") list(pl:-4*ps pl+bw:ps))
	dbCreateRect(cv list("instance" "drawing") list(0:-4*ps 2*pl+bw:ps))

	;----------------------------------------------------------------
	; create the nets
	;----------------------------------------------------------------
	netINP=dbMakeNet(cv "inp")
	netINN=dbMakeNet(cv "inn")
	netCLK=dbMakeNet(cv "clk")
	netOUT=dbMakeNet(cv sprintf(nil "out<%d:0>" nlevel))

	;----------------------------------------------------------------
	; create the terminals
	;----------------------------------------------------------------
	dbCreateTerm(netINP netINP~>name "input")
	dbCreateTerm(netINN netINN~>name "input")
	dbCreateTerm(netCLK netCLK~>name "input")
	dbCreateTerm(netOUT netOUT~>name "output")
	;----------------------------------------------------------------
	; create the pins
	;----------------------------------------------------------------
	dbCreatePin(netINP figINP)
	dbCreatePin(netINN figINN)
	dbCreatePin(netCLK figCLK)
	dbCreatePin(netOUT figOUT)
	
	;----------------------------------------------------------------
	; Put some labels for the pins
	;----------------------------------------------------------------
	dbCreateLabel(cv list("pin" "drawing") pl+ps/2:0
	    netINP~>name "centerLeft" "R0" "stick" lh)
	dbCreateLabel(cv list("pin" "drawing") pl+ps/2:-ps
	    netINN~>name "centerLeft" "R0" "stick" lh)
	dbCreateLabel(cv list("pin" "drawing") pl+ps/2:-3*ps
	    netCLK~>name "centerLeft" "R0" "stick" lh)
	dbCreateLabel(cv list("pin" "drawing") bw+pl-ps/2:0
	    netOUT~>name "centerRight" "R0" "stick" lh)

	;----------------------------------------------------------------
	; And other symbol labels
	;----------------------------------------------------------------
	label=dbCreateLabel(cv list("annotate" "drawing7") bw+pl-ps/2:ps*1.5
	    "cdsName()" "centerRight" "R0" "stick" lh)
	label~>labelType="ILLabel"
	label=dbCreateLabel(cv list("annotate" "drawing") pxc:0
	    "cdsParam(1)" "centerLeft" "R0" "stick" lh)
	label~>labelType="ILLabel"
	label=dbCreateLabel(cv list("annotate" "drawing") pxc:-ps
	    "cdsParam(2)" "centerLeft" "R0" "stick" lh)
	label~>labelType="ILLabel"
	label=dbCreateLabel(cv list("annotate" "drawing") pxc:-2*ps
	    "cdsParam(3)" "centerLeft" "R0" "stick" lh)
	label~>labelType="ILLabel"

	t
	) ; let
    )
    dbSave(pcellId)
    dbClose(pcellId) 

;------------------------------------------------------------------------
; Now create the CDF
;------------------------------------------------------------------------
    let( (cellId cdfId )
	unless( cellId = ddGetObj( library cell )
	    error( "Could not get cell %s." cell )
	)
	when( cdfId = cdfGetBaseCellCDF( cellId )
	    cdfDeleteCDF( cdfId )
	)
	cdfId  = cdfCreateBaseCellCDF( cellId )

	;;; Parameters
	cdfCreateParam( cdfId
	    ?name           "FS"
	    ?prompt         "Full Scale"
	    ?defValue       "2" 
	    ?type           "string"
	    ?display        "t"
	)
	cdfCreateParam( cdfId
	    ?name           "nlevel"
	    ?prompt         "nlevel"
	    ?defValue       " 7" 
	    ?type           "string"
	    ?display        "t"
	)
	cdfCreateParam( cdfId
	    ?name           "gain"
	    ?prompt         "Pre_amp Gain"
	    ?defValue       " 1" 
	    ?type           "string"
	    ?display        "t"
	)

	;;; Simulator Information
	cdfId->simInfo = list( nil )
	cdfId->simInfo->UltraSim = '( nil )
	cdfId->simInfo->ams = '( nil )
	cdfId->simInfo->auCdl = '( nil )
	cdfId->simInfo->auLvs = '( nil )
	cdfId->simInfo->cdsSpice = '( nil )
	cdfId->simInfo->hspiceD = '( nil )
	cdfId->simInfo->hspiceS = '( nil )
	cdfId->simInfo->spectre = '( nil )
	cdfId->simInfo->spectreS = '( nil )

	;;; Properties
	cdfId->formInitProc            = ""
	cdfId->doneProc                = ""
	cdfId->buttonFieldWidth        = 340
	cdfId->fieldHeight             = 35
	cdfId->fieldWidth              = 350
	cdfId->promptWidth             = 175
	cdfId->paramLabelSet           = "FS nlevel gain"
	cdfId->paramDisplayMode        = "parameter"
	cdfId->paramEvaluate           = "t nil nil nil nil"
	cdfSaveCDF( cdfId )
    ) ; let
) ; let

  • Cancel

Community Guidelines

The Cadence Design Communities support Cadence users and technologists interacting to exchange ideas, news, technical information, and best practices to solve problems and get the most from Cadence technology. The community is open to everyone, and to provide the most value, we require participants to follow our Community Guidelines that facilitate a quality exchange of ideas and information. By accessing, contributing, using or downloading any materials from the site, you agree to be bound by the full Community Guidelines.

© 2025 Cadence Design Systems, Inc. All Rights Reserved.

  • Terms of Use
  • Privacy
  • Cookie Policy
  • US Trademarks
  • Do Not Sell or Share My Personal Information