OpenCores
URL https://opencores.org/ocsvn/fwrisc/fwrisc/trunk

Subversion Repositories fwrisc

[/] [fwrisc/] [trunk/] [ve/] [fwrisc/] [tests/] [fwrisc_instr_tests_counters.cpp] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 mballance
/*
2
 * fwrisc_instr_tests_counters.cpp
3
 *
4
 *  Created on: Nov 18, 2018
5
 *      Author: ballance
6
 */
7
 
8
#include "fwrisc_instr_tests_counters.h"
9
 
10
fwrisc_instr_tests_counters::fwrisc_instr_tests_counters() : fwrisc_instr_tests(100000) {
11
        // TODO Auto-generated constructor stub
12
 
13
}
14
 
15
fwrisc_instr_tests_counters::~fwrisc_instr_tests_counters() {
16
        // TODO Auto-generated destructor stub
17
}
18
 
19
TEST_F(fwrisc_instr_tests_counters, cycle) {
20
        reg_val_s exp[] = {
21
                        {1, 0},
22
                        {2, 0x04},
23
                        {3, 0x03},
24
                        {4, 0x02},
25
                        {5, 0x01},
26
        };
27
        const char *program = R"(
28
                entry:
29
                        li              x1, 0x4000
30
                1:
31
                        addi    x1, x1, -1
32
                        bne             x1, x0, 1b
33
 
34
                        csrr    x2, mcycle
35
 
36
                        j               done
37
                data:
38
                        .word 0x01020304
39
                        .word 0x05060708
40
                        )";
41
 
42
        runtest(program, exp, sizeof(exp)/sizeof(reg_val_s));
43
}
44
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.