Continue to Site

Welcome to

Welcome to our site! is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

phase selector verilog-A model

Not open for further replies.


Newbie level 3
Apr 12, 2010
Reaction score
Trophy points
Activity points
Hi, all:

I need your help. I want to write verilog-A model about phase selector. The phase selector theory is: there are eight phase clock input, and the phase difference is 0.125*2*pi*Fref. I need to select one of them output.
When A=-1, the output is a phase that lag the current one
A=0, the output is current phase.
A=1, the output is a phase lead the current one by two
A=2, the output is a phase lead the current one by one.
I write the verilog-A model like this:

// VerilogA for USB20, PHASE_SELECT, veriloga

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

module PHASE_SELECT(P, IN0, IN1, IN2, IN3, OUT);
output OUT;
input [0:7] P;
input IN0, IN1, IN2, IN3;
voltage [0:7] P;
electrical IN0, IN1, IN2, IN3, OUT;

parameter real tdel = 0 from [0:inf);
parameter real trise = 0 from [0:inf);
parameter real tfall = 0 from [0:inf);

real IN;
integer i;
analog begin
@ ( initial_step ) begin
IN = V(IN0) + 2*V(IN1) + 4*V(IN2) -8* V(IN3);
case (IN)
2: begin if (i-2>=0)
i= i-2;
else i= 8+i-2;
1: begin if (i-1>=0)
i= i-1;
else i= 8+i-1;
0: i=i;
-1: begin if (i+1<=7)
i= i+1;
else i=-8+i+1;

V(OUT) <+ transition(P, tdel, trise, tfall);

Whatever I setup the IN0-IN3, the output is zero without any change. Can anyone help me? Thanks.

---------- Post added at 10:04 ---------- Previous post was at 09:32 ----------

My cadence version is 5.10.41, so I can not use "genvar" command.

Maybe it caused by this.

Your block is not sensitive to the input changes and therefore once you finish the @initial_step your block stays inactive. You need to detect changes in the control word and in the input clock and transfer them to the output. You can, for instance, use the function @cross() on your inputs.

Thanks, JoannesPaulus. I don't know how to use a vector P[0:7] as input, indeed. Whether You mean that I need to use cross function instead of if function?
And another question is //V(OUT) <+ transition(P, tdel, trise, tfall);// I want to send P to output, is it right? thanks again.

Last edited:

Verilog-A uses "generate" not "genvar".

If I understand pancho_hideboo's code, he is generating an autonomous clock with a given phase but he is not muxing one of the input phases out.
In my opinion, you need to check for changes of either P or IN and then select the correct output using a case statement.


  • generate.png
    121.8 KB · Views: 150

Wrong."genvar" is used in cadence 6.1
Very wrong.

You can't understand Cadence tools at all.

"5.10.41" is version of DFII.

We can use MMSIM(=Spectre) of version 5.X and 6.* in DFII of 5.10.X.

"genvar" is used in any of MMSIM 5.X and 6.X.
But "genvar" can't be used in older Spectre such as 4.4.X.

Generally Spectre of version 4.4.X is not used in DFII of 5.10.X intensively.
The Designer's Guide Community Forum - simulating phase noise of differential LC-VCO in spectre
Last edited:

I stand corrected on the versions and all the rest.
At any rate, from the bit of information nichocheng gave I believe he is using an older version of spectre - possibly 4.4.x - with DFII 5.10.x (I had the same set-up at a start-up a few years back).

nichocheng, what what is your set-up?
Last edited:

Not open for further replies.

Part and Inventory Search

Welcome to