本人在22集创赛芯来riscv杯打酱油,分享下芯来官方的demo的理解
首先导入工程,打开helloworld的例程,将application的main.c删除,用nuclei-board-labs-master中的nice_demo中的.c进行替代
int main(void)
{
int i=100;
int arr[4]={1,2,3,4};
unsigned int array[ROW_LEN][COL_LEN]=
{
{10,20,30},
{20,30,40},
{30,40,50}
};
unsigned int begin_instret, end_instret, instret_normal, instret_nice;
unsigned int begin_cycle, end_cycle, cycle_normal, cycle_nice;
//不使用nice核
begin_instret = __get_rv_instret();
begin_cycle = __get_rv_cycle();
normal_case(array);
end_instret = __get_rv_instret();
end_cycle = __get_rv_cycle();
instret_normal = end_instret - begin_instret;
cycle_normal = end_cycle - begin_cycle;
//调用nice核
begin_instret = __get_rv_instret();
begin_cycle = __get_rv_cycle();
nice_case(array);
end_i