發表文章

目前顯示的是 5月, 2020的文章

[VerilogA] moving average for measurement in simulation

    In the simulation environment, we will consider it as a perfect world. However, it's not in reality. According to adaptive time step, we will get a result which it's a little different from the theory. Sometimes, we can't not measure just one time. We need to measure multiple times in the period. At this moment, we adopt "moving average" method. In VerilogA, we can measure "Count" times. TESTX[j] is the data in period. We average this data to get more-close-to theoretic data in simulation. We implement moving average  in VerilogA. /// moving average     for( ( j = Count-1) ; j >= 1 ; j = j-1)     t_testx[j]  =  t_testx[j-1];       generate j (0, Count-1)     t_test_sum = t_test_sum+t_testx[j];     t_test  =  t_test_sum/(Count);     t_test_sum=0; /// moving average