Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com 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.

[SOLVED] proplem in verilog-a code

Status
Not open for further replies.

amr hema

Newbie level 6
Newbie level 6
Joined
Jan 3, 2013
Messages
13
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Visit site
Activity points
1,360
i design sar adc and there is a proplem in sar logic code
the command @(initial_step) saw the first command only (ex. see counter=0) and the other statement repeated in code and i want to make them initial only

this is the code

// VerilogA for try, try, veriloga

`include "constants.vams"
`include "disciplines.vams"
module sar(comp,reset,clk,s1,s2,sp1,sp2,sp3,sn1,sn2,sn3);
input comp,reset,clk;
output s1,s2,sp1,sp2,sp3,sn1,sn2,sn3;
electrical comp,reset,clk,s1,s2,sp1,sp2,sp3,sn1,sn2,sn3;
parameter real Vlow = -1.2 ;
parameter real Vhigh = 1.2 ;
integer counter;
analog
begin
@(initial_step)
counter=0;
//V(s1)<+Vhigh; V(s2)<+Vhigh; V(sp1)<+Vhigh; V(sp2)<+Vhigh; V(sp3)<+Vhigh; V(sn1)<+Vhigh; V(sn2)<+Vhigh; V(sn3)<+Vhigh;
@(cross(V(clk)-1,+1))
counter=counter+1;
if (counter==1) begin
V(s1)<+Vlow; V(s2)<+Vlow;
end
if (counter==2) begin
if (V(comp)>Vhigh/2) begin
V(sp1)<+Vlow;
end
else if (V(comp)<Vhigh/2) begin
V(sn1)<+Vlow;
end
end
if (counter==3) begin
if (V(comp)>Vhigh/2) begin
V(sp2)<+Vlow;
end else if (V(comp)<Vhigh/2) begin
V(sn2)<+Vlow;
end
end
if (counter==4) begin
if (V(comp)>Vhigh/2) begin
V(sp3)<+Vlow;
end else if (V(comp)<Vhigh/2) begin
V(sn3)<+Vlow;
end
end
if (counter==5) begin
counter=0;
end
end
endmodule
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top