|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?注册
x
想必有大佬已经看了lund大学的那篇学位论文 关于电流舵失配建模的 Modelling and implementation of a 10-bit 80 MSPS current-steering DAC with internal bandgap reference in a 0.18 µm CMOS process
我在仿他的matlab代码时发现,他好像有两个函数fullfft和FOM没给出来,我知道是通过对输出做fft求的SFDR和enob,但我不太清楚FOM(63:67)是什么意思,不太知道他在这个点的想法。
希望大佬们帮小菜指点指点这个问题
function [SFDRar,nobbar,maxinl,maxdnl,Itot]= DAC(nSample,Fsamp,Fsig,overtoner,noit,funk,sv);
%ADC
%Ramp
if (funk==1)
data = [0:1:1023];
end
%Sin
if (funk==2)
w = 2*pi*Fsig;
tid = [0:nSample-1]./Fsamp;
brus = 0.3*rand(size(tid));
data = round(1023*(1+sin(w*tid))/2+brus);
end
%OFDM
if (funk==3)
Fsig=(312.5e3:312.5e3:26*312.5e3);
w=2*pi.*Fsig;
tid=[0:nSample-1]./Fsamp;
phi=2*pi*rand(26);
sig=zeros(26,nSample);
for i=1:26
sig(i,=0.07807*sin(w(i)*tid+phi(i));
end
sigtot=sum(sig);
brus = 0.3*rand(size(tid));
data = round(1023*(1+sigtot)/2+brus);
end
%DAC
Rimp = 8e6;%Vid 20 MHz
Rl= 60;
N =1023;
Iref=5e-3/N;
sd=0.502/100;
gradient=4/400;
gradpolx=5/400;
gradpoly=5/400;
Lnoise=6.3e-6;
Inoise=3.03e-7;
%Konventionell symmetrisk matris
%i=1;
%for k=1:16
% for l=1:16
% imatris(k,l)=i;
% i =5i+1;
% end
%end
%Generera hierarkiskt switchad matris
[imatris]=swmatris;
%Generera gradienter
t=[-1:2/31:1];
xpolgrad=-gradpolx*t.^2-gradpolx;
ypolgrad=-gradpoly*t.^2+gradpoly;
xgrad=[0.5-gradient:2*gradient/31:0.5+gradient]+xpolgrad;
ygrad=[0.5-gradient:2*gradient/31:0.5+gradient]+ypolgrad;
for k=1:32
for l=1:32
gradmat(k,l)=xgrad(k)+ygrad(l);
end
end
%Sortera str?mmatrisen s? att koordinaterna f?r k?lla 1 ligger f?rsti vektorn ims
for k=1:255
[a,b]=find(imatris==k);
ims(k,=[a,b];
end
imsp=ims;
imsn=flipud(ims);
%Starta iterationsprocessen
for j=1:noit
%Generera str?mk?llor
Irefs=Iref+Iref*sd*randn(32,32);
Ibin=Iref+Iref*sd*rand(1,3);
Ibinp=Ibin;
Ibinn=fliplr(Ibinp);
Itot=Irefs.*gradmat;
%Spara str?mmatrisen
if (sv==1)
save strom_matris Itot
else
load strom_matris
end
%Generera brus
Noisetot=sqrt(N*Inoise^2+2*Lnoise^2)*randn(size(data));
%R?kna fram total str?m genom att r?kna fram varje summa avstr?mk?llor
Iutsump=zeros(1,1024);
Iutsumn=zeros(1,1024);
for i=1:4:1020
for k=1:3
Iutsump(i+k)=Iutsump(i+k-1)+Ibinp(k);
Iutsumn(i+k)=Iutsumn(i+k-1)+Ibinn(k);
end
rowp=imsp(fix(i/4)+1,1);
colp=imsp(fix(i/4)+1,2);
rown=imsn(fix(i/4)+1,1);
coln=imsn(fix(i/4)+1,2);
%Summera k?llorna enligt common-centroid (varje kvadrant flippad
%s? att enskilda k?llor f?r gemensamt centrum)
Iutsump(i+4)=Iutsump(i)+Itot(rowp,colp)+Itot(rowp,33-colp)+Itot(33-rowp,33-colp)+Itot(33-rowp,colp);
Iutsumn(i+4)=Iutsumn(i)+Itot(rown,coln)+Itot(rown,33-coln)+Itot(33-rown,33-coln)+Itot(33-rown,coln);
%Summera k?llorna utlagda likadant (ingen rotation av kvadranter)
%Iutsump(i+4)=Iutsump(i)+Itot(rowp,colp)+Itot(rowp,17-colp)+Itot(17-rowp,17-colp)+Itot(17-rowp,colp);
%Iutsumn(i+4)=Iutsumn(i)+Itot(rown,coln)+Itot(rown,17-coln)+Itot(17-rown,17-coln)+Itot(17-rown,coln);
end
for k=1022:1024
Iutsump(k)=Iutsump(k-1)+Ibinp(k-1021);
Iutsumn(k)=Iutsumn(k-1)+Ibinn(k-1021);
end
for i=1:length(data)
Ioutp(i)=Iutsump(data(i)+1);
Ioutn(i)=Iutsumn(1024-data(i));
end
%R?kna ut utsp?nningen
voutp= (2*Ioutp)./((2/Rl)+(1/Rimp)*2*data);
voutn= (2*Ioutn)./((2/Rl)+(1/Rimp)*(2046-2*data));
Idiff=Ioutp-Ioutn;
vdiff=voutp-voutn+Noisetot;
Vref1=max(vdiff)-min(vdiff);
Vref=600e-3;
%Utf?r analys av resultatet beroende p? vilken test som k?rts
if funk==1
A=[ones(size(data))', data'];
yfnutt=vdiff';
c = A\yfnutt;
inl=(vdiff'-A*c)./(Iref*Rl);
for m=1:length(data)-1
dnl(m)=(vdiff(m+1)-vdiff(m)-2*Iref*60)/(Iref*60);
end
maxdnl(j)=max(abs(dnl));
MaxDNL=maxdnl(j)
maxinl(j)=max(abs(inl));
MaxINL=maxinl(j)
SFDRar=0;
nobbar=0;
j
end
matrX=[1:32];
matrY=[1:32];
if funk==2
fullfft;
FOM
nob1=FOM(63:67);
SFDRvar=FOM(44:48)
figure(1)
SFDRvar=str2num(SFDRvar);
SFDRar(j)=SFDRvar;
nob1=str2num(nob1);
nobbar(j)=nob1;
maxinl=0;
maxdnl=0;
j
end
if funk==3
fullfft;
FOM
nobbar=0;
SFDRar=0;
maxinl=0;
maxdnl=0;
end
end
end
|
|