This commit is contained in:
David Harris 2021-07-07 06:32:29 -04:00
commit 5d5274ec73
4 changed files with 54 additions and 43 deletions

View File

@ -96,7 +96,7 @@ MAIN_RETURN_TYPE main(void) {
MAIN_RETURN_TYPE main(int argc, char *argv[]) {
#endif
//const char s[] = "Elizabeth";
//ee_printf("eeprint");
ee_printf("eeprint");
//ee_printf("Trying to print: %d", 0);
/*gg_printf("Elizabeth");*/
//sendstring("Elizabeth");
@ -198,7 +198,7 @@ MAIN_RETURN_TYPE main(int argc, char *argv[]) {
if (results[i].execs & ID_LIST) {
ee_printf("loop");
ee_printf("%d \n", MULTITHREAD);
ee_printf("%d \n sizethread ", results[0].size);
ee_printf("%d \n sizethread \n", results[0].size);
results[i].list=core_list_init(results[0].size,results[i].memblock[1],results[i].seed1);
@ -212,20 +212,6 @@ MAIN_RETURN_TYPE main(int argc, char *argv[]) {
}
}
/*int foreverLoop = 1;
secs_ret timing = 0;
int timingInt;
ee_printf("\nENTERING FOREVER WHILE LOOP\n");
while(foreverLoop == 1)
{
start_time();
//filler
stop_time();
timing += time_in_secs(get_time());
timingInt = (int)timing;
ee_printf("Timing is %d\n", timingInt);
}/*
/* automatically determine number of iterations if not set */
if (results[0].iterations==0) {
secs_ret secs_passed=0;
@ -257,6 +243,7 @@ MAIN_RETURN_TYPE main(int argc, char *argv[]) {
ee_printf("iterations is %d\n", results[0].iterations);
}
/* perform actual benchmark */
ee_printf("iterations is %d\n", results[0].iterations);
ee_printf("Starting benchmark\n");
start_time();
#if (MULTITHREAD>1)
@ -376,7 +363,7 @@ MAIN_RETURN_TYPE main(int argc, char *argv[]) {
unsigned long long tmp = (unsigned long long) 1000.0*default_num_contexts*results[0].iterations/time_in_secs(total_time);
secs_ret totalmsecs = time_in_secs(total_time);
int totalmint = (int) totalmsecs;
ee_printf("ELAPSED S: %d\n", totalmint);
ee_printf("ELAPSED TIME: %d\n", totalmint);
ee_printf("CoreMark 1.0 : %d / %s %s\n",tmp,COMPILER_VERSION,COMPILER_FLAGS);
#if defined(MEM_LOCATION) && !defined(MEM_LOCATION_UNSPEC)

View File

@ -125,6 +125,28 @@ void portable_free(void *p) {
#if SAMPLE_TIME_IMPLEMENTATION
/** Define Host specific (POSIX), or target specific global time variables. */
static CORETIMETYPE start_time_val, stop_time_val;
static unsigned long start_instr_val, stop_instr_val;
/* Function: minstretFunc
This function will count the number of instructions.
*/
unsigned long minstretFunc(void)
{
unsigned long minstretRead = read_csr(minstret);
//ee_printf("Minstret is %lu\n", minstretRead);
return minstretRead;
}
/* Function: minstretDiff
This function will take the difference between the first and second reads from the
MINSTRET csr to determine the number of machine instructions retired between two points
of time
*/
unsigned long minstretDiff(void)
{
unsigned long minstretDifference = MYTIMEDIFF(stop_instr_val, start_instr_val);
return minstretDifference;
}
/* Function: start_time
This function will be called right before starting the timed portion of the benchmark.
@ -133,9 +155,10 @@ static CORETIMETYPE start_time_val, stop_time_val;
or zeroing some system parameters - e.g. setting the cpu clocks cycles to 0.
*/
void start_time(void) {
start_instr_val = minstretFunc();
GETMYTIME(start_time_val);
ee_printf("Timer started\n");
ee_printf(" MTIME: %u\n", start_time_val);
//ee_printf("Timer started\n");
//ee_printf(" MTIME: %u\n", start_time_val);
#if CALLGRIND_RUN
CALLGRIND_START_INSTRUMENTATION
#endif
@ -157,8 +180,9 @@ void stop_time(void) {
asm volatile("int3");/*1 */
#endif
GETMYTIME(stop_time_val);
ee_printf("Timer stopped\n");
ee_printf(" MTIME: %u\n", stop_time_val);
stop_instr_val = minstretFunc();
//ee_printf("Timer stopped\n");
//ee_printf(" MTIME: %u\n", stop_time_val);
}
/* Function: get_time
Return an abstract "ticks" number that signifies time on the system.
@ -171,7 +195,8 @@ void stop_time(void) {
*/
CORE_TICKS get_time(void) {
CORE_TICKS elapsed=(CORE_TICKS)(MYTIMEDIFF(stop_time_val, start_time_val));
ee_printf(" Elapsed MTIME: %u\n", elapsed);
//ee_printf(" Elapsed MTIME: %u\n", elapsed);
//ee_printf(" Elapsed MINSTRET: %lu\n", minstretDiff());
return elapsed;
}
/* Function: time_in_secs
@ -183,7 +208,7 @@ CORE_TICKS get_time(void) {
secs_ret time_in_secs(CORE_TICKS ticks) {
secs_ret retval=((secs_ret)ticks) / (secs_ret)EE_TICKS_PER_SEC;
int retvalint = (int)retval;
ee_printf(" RETURN VALUE FROM TIME IN SECS FUNCTION: %d\n", retvalint);
//ee_printf("RETURN VALUE FROM TIME IN SECS FUNCTION: %d\n", retvalint);
return retval;
}
#else

View File

@ -34,7 +34,8 @@
`define XLEN 64
//`define MISA (32'h00000104)
`define MISA (32'h00001104 | 1<<5 | 1<<18 | 1 << 20 | 1 << 12 | 1 << 0)
//`define MISA (32'h00001104 | 1<<5 | 1<<18 | 1 << 20 | 1 << 12 | 1 << 0)
`define MISA (32'h00000104 | 0 << 5 | 0 << 3 | 1 << 18 | 1 << 20 | 1 << 12 | 1 << 0)
`define ZCSR_SUPPORTED 1
`define COUNTERS 32
`define ZCOUNTERS_SUPPORTED 1
@ -53,7 +54,7 @@
`define DTLB_ENTRIES 32
// Legal number of PMP entries are 0, 16, or 64
`define PMP_ENTRIES 16
`define PMP_ENTRIES 64
// Address space
`define RESET_VECTOR 64'h0000000080000000
@ -66,23 +67,23 @@
// Range should be a thermometer code with 0's in the upper bits and 1s in the lower bits
`define BOOTTIM_SUPPORTED 1'b1
`define BOOTTIM_BASE 34'h00001000
`define BOOTTIM_RANGE 34'h00000FFF
`define BOOTTIM_BASE 56'h00001000
`define BOOTTIM_RANGE 56'h00000FFF
`define TIM_SUPPORTED 1'b1
`define TIM_BASE 34'h80000000
`define TIM_RANGE 34'h07FFFFFF
`define TIM_BASE 56'h80000000
`define TIM_RANGE 56'h07FFFFFF
`define CLINT_SUPPORTED 1'b1
`define CLINT_BASE 34'h02000000
`define CLINT_RANGE 34'h0000FFFF
`define CLINT_BASE 56'h02000000
`define CLINT_RANGE 56'h0000FFFF
`define GPIO_SUPPORTED 1'b1
`define GPIO_BASE 34'h10012000
`define GPIO_RANGE 34'h000000FF
`define GPIO_BASE 56'h10012000
`define GPIO_RANGE 56'h000000FF
`define UART_SUPPORTED 1'b1
`define UART_BASE 34'h10000000
`define UART_RANGE 34'h00000007
`define UART_BASE 56'h10000000
`define UART_RANGE 56'h00000007
`define PLIC_SUPPORTED 1'b1
`define PLIC_BASE 34'h0C000000
`define PLIC_RANGE 34'h03FFFFFF
`define PLIC_BASE 56'h0C000000
`define PLIC_RANGE 56'h03FFFFFF
// Test modes

View File

@ -70,12 +70,10 @@ module tlbcontrol #(parameter TLB_ENTRIES = 8,
if (`XLEN==64) begin
assign SV39Mode = (SVMode == `SV39);
// generate page fault if upper bits aren't all the same
logic UpperOnes39, UpperZeros39, UpperOnes48, UpperZeros48;
assign UpperOnes39 = &(Address[63:39]);
assign UpperZeros39 = ~|(Address[63:39]);
assign UpperOnes48 = &(Address[63:48]);
assign UpperZeros48 = ~|(Address[63:48]);
assign UpperBitsUnequalPageFault = SV39Mode ? (Address[38] ? UpperOnes39 : UpperZeros39) : (Address[47] ? UpperOnes48 : UpperZeros48);
logic UpperEqual39, UpperEqual48;
assign UpperEqual39 = &(Address[63:38]) | ~|(Address[63:38]);
assign UpperEqual48 = &(Address[63:47]) | ~|(Address[63:47]);
assign UpperBitsUnequalPageFault = SVMode ? ~UpperEqual39 : ~UpperEqual48;
end else begin
assign SV39Mode = 0;
assign UpperBitsUnequalPageFault = 0;