Closed Yuano0o closed 1 year ago
将MCLK的工作频率调整在8MHz(如果需要用到UART,相应地调整UART的参数,与频率对应),SMCLK,即计时器的驱动频率调整到1MHz,分频比保持不变,为64.
void clock_sys_init()
{
CS_setDCOFreq(CS_DCORSEL_0, CS_DCOFSEL_6); // DCO in 8MHz
CS_initClockSignal(CS_MCLK, CS_DCOCLK_SELECT, CS_CLOCK_DIVIDER_1); // MCLK = DCO = 8MHz
CS_initClockSignal(CS_SMCLK, CS_DCOCLK_SELECT, CS_CLOCK_DIVIDER_8); // SMCLK = DCO/8 = 1MHz, x8 divided DCO
CS_initClockSignal(CS_ACLK, CS_VLOCLK_SELECT, CS_CLOCK_DIVIDER_1);
CS_turnOffLFXT();
}
这可以让时间测量的范围较之前再提升8倍(但是精度也会相应变为原来的1/8)。
另外,对于任务数溢出的问题,用float
或者uin32_t
即可。
alpaca
current testbench: 0.Cycles: 89664.the total number of tasks: 726.
current testbench: 1.Cycles: 96384.the total number of tasks: 905.
current testbench: 2.Cycles: 165632.the total number of tasks: 1081.
current testbench: 3.Cycles: 109184.the total number of tasks: 2750.
current testbench: 4.Cycles: 80832.the total number of tasks: 1025.
current testbench: 5.Cycles: 63168.the total number of tasks: 927.
current testbench: 6.Cycles: 157056.the total number of tasks: 2212.
current testbench: 7.Cycles: 89024.the total number of tasks: 669.
current testbench: 8.Cycles: 242048.the total number of tasks: 5050.
Latics
current testbench: 0.Cycles: 78080.the total number of tasks: 726.
current testbench: 1.Cycles: 28992.the total number of tasks: 905.
current testbench: 2.Cycles: 156160.the total number of tasks: 1081.
current testbench: 3.Cycles: 61440.the total number of tasks: 2750.
current testbench: 4.Cycles: 25472.the total number of tasks: 1025.
current testbench: 5.Cycles: 193472.the total number of tasks: 927.
current testbench: 6.Cycles: 152832.the total number of tasks: 2212.
current testbench: 7.Cycles: 64704.the total number of tasks: 669.
current testbench: 8.Cycles: 573952.the total number of tasks: 5050.
MCLK = 8MHz
需要把alpaca()和latics()分别测量.
//alpaca
current testbench: 0.Cycles: 89664.the total number of tasks: 726.
current testbench: 1.Cycles: 96384.the total number of tasks: 905.
current testbench: 2.Cycles: 165632.the total number of tasks: 1081.
current testbench: 3.Cycles: 109184.the total number of tasks: 2750.
current testbench: 4.Cycles: 80832.the total number of tasks: 1025.
current testbench: 5.Cycles: 63168.the total number of tasks: 927.
current testbench: 6.Cycles: 157056.the total number of tasks: 2212.
current testbench: 7.Cycles: 89024.the total number of tasks: 669.
current testbench: 8.Cycles: 242048.the total number of tasks: 5050.
//latics
//第一个testbench的计数都出现了问题
current testbench: 0.Cycles: 242048.the total number of tasks: 0.
current testbench: 1.Cycles: 28992.the total number of tasks: 905.
current testbench: 2.Cycles: 156160.the total number of tasks: 1081.
current testbench: 3.Cycles: 61440.the total number of tasks: 2750.
current testbench: 4.Cycles: 25472.the total number of tasks: 1025.
current testbench: 5.Cycles: 193472.the total number of tasks: 927.
current testbench: 6.Cycles: 152832.the total number of tasks: 2212.
current testbench: 7.Cycles: 64704.the total number of tasks: 669.
current testbench: 8.Cycles: 573952.the total number of tasks: 5050.
alpaca: current testbench: 8.Cycles: 242048.the total number of tasks: 5050.
latics(错误点): current testbench: 0.Cycles: 242048.the total number of tasks: 0.
时间和一致性测试
分别测试了benchmark的时间(
Cycles
),及其执行的任务数(total number of tasks
).alpaca
latics
测试结果和问题
alpaca的
cem.c
时间和任务数都产生溢出. 除cem.c
外,alpaca和latics的benchmark的执行流程一致.cem.c
.逻辑上暂时还没发现问题.Cycles
溢出的问题