mirror of
https://github.com/openhwgroup/cvw
synced 2025-02-11 06:05:49 +00:00
Updated portme file to include counters MTIME and MINSTRET. Timer currently set to read milliseconds running at 100MHZ, but this can be changed by setting a different clock speed in the testbench sv file and manipulating TIMER_RES_DIVIDER on line 120
This commit is contained in:
parent
b757c96b2d
commit
8dc40e988e
@ -126,6 +126,15 @@ void portable_free(void *p) {
|
|||||||
/** Define Host specific (POSIX), or target specific global time variables. */
|
/** Define Host specific (POSIX), or target specific global time variables. */
|
||||||
static CORETIMETYPE start_time_val, stop_time_val;
|
static CORETIMETYPE start_time_val, stop_time_val;
|
||||||
|
|
||||||
|
/* Function: minstret
|
||||||
|
This function will count the number of instructions.
|
||||||
|
*/
|
||||||
|
void minstretFunc(void)
|
||||||
|
{
|
||||||
|
unsigned long minstretAttempt = read_csr(minstret);
|
||||||
|
ee_printf("Minstret is %lu\n", minstretAttempt);
|
||||||
|
}
|
||||||
|
|
||||||
/* Function: start_time
|
/* Function: start_time
|
||||||
This function will be called right before starting the timed portion of the benchmark.
|
This function will be called right before starting the timed portion of the benchmark.
|
||||||
|
|
||||||
@ -133,6 +142,7 @@ static CORETIMETYPE start_time_val, stop_time_val;
|
|||||||
or zeroing some system parameters - e.g. setting the cpu clocks cycles to 0.
|
or zeroing some system parameters - e.g. setting the cpu clocks cycles to 0.
|
||||||
*/
|
*/
|
||||||
void start_time(void) {
|
void start_time(void) {
|
||||||
|
minstretFunc();
|
||||||
GETMYTIME(start_time_val);
|
GETMYTIME(start_time_val);
|
||||||
ee_printf("Timer started\n");
|
ee_printf("Timer started\n");
|
||||||
ee_printf(" MTIME: %u\n", start_time_val);
|
ee_printf(" MTIME: %u\n", start_time_val);
|
||||||
@ -157,6 +167,7 @@ void stop_time(void) {
|
|||||||
asm volatile("int3");/*1 */
|
asm volatile("int3");/*1 */
|
||||||
#endif
|
#endif
|
||||||
GETMYTIME(stop_time_val);
|
GETMYTIME(stop_time_val);
|
||||||
|
minstretFunc();
|
||||||
ee_printf("Timer stopped\n");
|
ee_printf("Timer stopped\n");
|
||||||
ee_printf(" MTIME: %u\n", stop_time_val);
|
ee_printf(" MTIME: %u\n", stop_time_val);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user