在线咨询
eetop公众号 创芯大讲堂 创芯人才网
切换到宽版

EETOP 创芯网论坛 (原名:电子顶级开发网)

手机号码,快捷登录

手机号码,快捷登录

找回密码

  登录   注册  

快捷导航
搜帖子
楼主: IC有我心

MASH 1-1-1,出来结果不对,

[复制链接]
 楼主| 发表于 2021-3-22 14:08:13 | 显示全部楼层


zaowulanyin 发表于 2021-3-8 15:08
我用matlab编辑了你的代码,发现不行qaq


小哥,你知道用MATLAB怎么求噪声曲线吗?
image.png
发表于 2021-3-25 10:33:11 | 显示全部楼层


IC有我心 发表于 2021-3-22 14:08
小哥,你知道用MATLAB怎么求噪声曲线吗?


你试试看,simout84(1000000:20000000)这块是要分析频谱的波形的区间,再simulink中有一个模块交simout,连接想要分析的节点上,就可以将波形数据存储到内存,可以在matlab的菜单栏编辑器工作区看到选择稳定的区间(我上次用的是100000:200000),然后运行,这个是分析频谱的
计算频谱.jpg
 楼主| 发表于 2021-3-25 16:07:57 | 显示全部楼层


zaowulanyin 发表于 2021-3-25 10:33
你试试看,simout84(1000000:20000000)这块是要分析频谱的波形的区间,再simulink中有一个模块交simout ...


小哥,怪我。我没太看懂,但是大体意思懂了。但是不会用。我写了一个MATLAB代码。YOUT1是要求得。辛苦给看看。





%MASH ((Multi Stage Noise Shaping)111 SDM
%this is a simulation of a MASH111 SDM where we look at the noise
%generated after a lengthy simulation time. The inputs are the fraction we
%are trying to synthesize, and the number of bits for the accumulators.

%The values in the accumulators are all positive, and the fraction is only
%valid from 0 to 1
%This has no dither it is just the basic modulator

%The setup is:
%                 --------> + ----------> + ----> Output
%                |         diff         diff^2
%                |          |             |
%              carry1     carry2        carry3
%Fraction=>Accumulator1=>Accumulator2=>Accumulator3

%Carry1 from accumulator 1 is added to the dirivative of carry2 and the
%2nd derivative of carry3 to make the output.

%1/29/2013 fixed the 3 stage differentiation
%1/29/2013 added better plot and description

clear
NumberSamples=2^11;
BusSize=16; %bits
Fraction=.5234; %usable 0 to 1
FractionInternal=2^BusSize*Fraction;
AccumulatorBits=16 ; %bits
AccumulatorSize=2^AccumulatorBits;

C1(1:NumberSamples)=0;%Carry out of the first accumulator
C2(1:NumberSamples)=0;%Carry out of the 2nd accumulator
C3(1:NumberSamples)=0;%Carry out of the 3rd accumulator
U1(1:NumberSamples)=0;%output of the 1st accum
U2(1:NumberSamples)=0;%output of the 2nd accum
U3(1:NumberSamples)=0;%output of the 3rd accum
Yout1(1:NumberSamples)=0;%Corresponding to the S1 value in the figure
Yout2(1:NumberSamples)=0;%Corresponding to the S value in the figure
Yout3(1:NumberSamples)=0;%Final output

for index=3:NumberSamples
    U1(index)=FractionInternal+U1(index-1);
    U2(index)=U1(index-1)+U2(index-1);
    U3(index)=U2(index-1)+U3(index-1);
    if U1(index)>AccumulatorSize
        C1(index)=1;%carry 1
        U1(index)=U1(index)-AccumulatorSize;
    end
    if U2(index)>AccumulatorSize
        C2(index)=1;%carry 2
        U2(index)=U2(index)-AccumulatorSize;
    end
    if U3(index)>AccumulatorSize
        C3(index)=1;%carry 3
        U3(index)=U3(index)-AccumulatorSize;
    end
    %The output is the overflow from acc 1, plus the diff of the overflow from
    %acc 2, plus the 2nd derivative of the overflow from acc 3

    Yout3(index)=C3(index-2)-2*C3(index-1)+C3(index);%output to the divider - 3 stages
    Yout2(index)=C2(index-1)-C2(index)-C3(index-2)+2*C3(index-1)-C3(index);%output to the divider - 2 stages
    Yout1(index)=C1(index)-C2(index-1)+C2(index)+C3(index-2)-2*C3(index-1)+C3(index);%output to the divider - 1 stages

end

MeanFrac=mean(Yout1);
fprintf('\nMeanFracMASH= %1.4f\n',MeanFrac)
%note how the close in noise improves as the order increases
figure(1)
SignalFreq1=20*log10(abs(fft(Yout1)));
plot(fftshift(SignalFreq1)-max(SignalFreq1),'g')
hold on
grid on
axis([0 NumberSamples -150 0]);
SignalFreq2=20*log10(abs(fft(Yout2)));
SignalFreq3=20*log10(abs(fft(Yout3)));
plot(fftshift(SignalFreq2)-max(SignalFreq2),'r')
plot(fftshift(SignalFreq3)-max(SignalFreq3),'b')
legend('1 stage','2 stage','3 stage')
title('MASH111 SDM Noise')
figure,plo



发表于 2021-6-30 15:07:40 | 显示全部楼层


IC有我心 发表于 2021-3-25 16:07
小哥,怪我。我没太看懂,但是大体意思懂了。但是不会用。我写了一个MATLAB代码。YOUT1是要求得。辛苦给 ...


hello, 你的psd画出来了吗?
 楼主| 发表于 2021-7-5 20:31:04 | 显示全部楼层


368zhangjian 发表于 2021-6-30 15:07
hello, 你的psd画出来了吗?


没有。
发表于 2021-7-24 11:25:11 | 显示全部楼层


image.png image.png
我最后的结果是这样,这是加了1bit dith的,暂时性的交差了。
发表于 2022-3-23 20:34:27 | 显示全部楼层


海马懒人 发表于 2021-3-9 11:56
这个结构我有点疑问,第一上一级累加器送给下一级的信号应该是上一级量化之后的量化误差,反馈给B端的应 ...


量化器其实就是取了数字溢出位的数值,如果累加到进位了,那量化器是不是就输出1,如果没进位,相当于量化为0

发表于 2022-6-21 17:18:40 | 显示全部楼层
image.png image.png image.png image.png 有人帮忙看看吗  代码不太对  是在cadence中运行  代码出来不是-3到4 代码是哪里出错了呀
发表于 2022-9-28 11:15:25 | 显示全部楼层


Mxd_xiufeng.Li 发表于 2022-6-21 17:18
有人帮忙看看吗  代码不太对  是在cadence中运行  代码出来不是-3到4 代码是哪里出错了呀 ...


加法的运算试试assign语句?用always时序可能不太好控制
发表于 2023-2-14 09:32:09 | 显示全部楼层


368zhangjian 发表于 2021-7-24 11:25
**** 作者被禁止或删除 内容自动屏蔽 ****


您好!我按照您的代码,仿不出来这样的频谱。
我仿出来的是这样的。请问我这是哪里出错了呢?



                               
登录/注册后可看大图


您需要登录后才可以回帖 登录 | 注册

本版积分规则

关闭

站长推荐 上一条 /1 下一条

小黑屋| 手机版| 关于我们| 联系我们| 隐私声明| EETOP 创芯网
( 京ICP备:10050787号 京公网安备:11010502037710 )

GMT+8, 2025-2-8 19:02 , Processed in 0.031731 second(s), 6 queries , Gzip On, Redis On.

eetop公众号 创芯大讲堂 创芯人才网
快速回复 返回顶部 返回列表