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.

N-bit ADC vams model

Status
Not open for further replies.

atulkulkarni

Newbie level 5
Joined
Apr 30, 2015
Messages
9
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,442
N bit Adc vams model

I am modelling a 12 bit ADC in vams.
The input range is 0.3 to 1.5V. i.e 0.3 = 000'H and 1.2V = FFF'H.

Need your help in selecting midpoint values
max= 1.5;
min=0.3
fullscale = max-min;
midpoint = fullscale/2.0;

This logic doesnt work.
 

Re: N bit Adc vams model

In case "midpoint" refers to the voltage level between min and max, I suggest

midpoint = (min + max)/2.0, or 0.9 V
 

Re: N bit Adc vams model

Code:
analog
begin
V(VREF)<+ 0.7 + (TRIM * 0.0266667);
max_1=V(VREF) + 0.6;
min_1=V(VREF) - 0.6;

//	min_1=0;
fullscale_1=max_1+min_1;
midpoint1=fullscale_1/2.0;
end


always@( posedge (CLK_IN) or !(fault_avdd) )
begin

//if (!(fault_avdd))
//	begin
sample1=V(VIN);
//sample1=sample1-dummy;
	$display("INSIDE LOOP");
		for (i=0;i<`BITS;i=i+1)
		begin
		if(sample1 >= midpoint1)
		begin
		V_DOUT[`BITS-1-i]=1;
		sample1=sample1-midpoint1;
		$display("VALUE OF Sample inside if %f",sample1);
		$display("VALUE OF MIDPOINT inside if %f",midpoint1);
		$display("VALUE OF DUMMY %f", dummy); 
		$display("VALUE OF MAX %f", max_1);
		
		end

		else
		begin
		V_DOUT[i]=0;
		$display("VALUE OF Sample inside else %f",sample1);
		$display("VALUE OF MIDPOINT inside else %f",midpoint1);
		$display("VALUE OF DUMMY %f", dummy); 
		$display("VALUE OF MAX %f", max_1);
		end
		sample1 = 2.0*sample1;
		end
//	end
	
	
	if (fault_avdd)
	begin
	for (i=0;i<`BITS;i=i+1)
	begin
	V_DOUT[i]=0;
	end
	end


end


VREF keeps on changing based on TRIM bits
 
Last edited by a moderator:

Re: N bit Adc vams model

Hi,

fullscale_1=max_1+min_1;
midpoint1=fullscale_1/2.0;

fullscale should be "max - min", but as long as you don´t use the value for other calculation it is OK.
The midpoint calculation is correct.

Klaus
 

Re: N bit Adc vams model

The calculation seems to mix absolute and relative voltage levels, which might cause confusion and unexpected results.

It's difficult to guess the meaning of the code without knowing the related hardware.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top