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

Subversion Repositories fwrisc

[/] [fwrisc/] [trunk/] [ve/] [fwrisc/] [tests/] [fwrisc_instr_tests.h] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 mballance
/*
2
 * fwrisc_instr_tests.h
3
 *
4
 *
5
 * Copyright 2018 Matthew Ballance
6
 *
7
 * Licensed under the Apache License, Version 2.0 (the
8
 * "License"); you may not use this file except in
9
 * compliance with the License.  You may obtain a copy of
10
 * the License at
11
 *
12
 * http://www.apache.org/licenses/LICENSE-2.0
13
 *
14
 * Unless required by applicable law or agreed to in
15
 * writing, software distributed under the License is
16
 * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
17
 * CONDITIONS OF ANY KIND, either express or implied.  See
18
 * the License for the specific language governing
19
 * permissions and limitations under the License.
20
 *
21
 *  Created on: Oct 28, 2018
22
 *      Author: ballance
23
 */
24
 
25
#ifndef INCLUDED_FWRISC_INSTR_TESTS_H
26
#define INCLUDED_FWRISC_INSTR_TESTS_H
27
#include "Vfwrisc_tb_hdl.h"
28
#include "GoogletestVlTest.h"
29
 
30
class fwrisc_instr_tests : public GoogletestVlTest<Vfwrisc_tb_hdl> {
31
public:
32
        struct reg_val_s {
33
                uint32_t        addr;
34
                uint32_t        val;
35
        };
36
public:
37
        fwrisc_instr_tests(uint32_t max_instr=100);
38
 
39
        virtual ~fwrisc_instr_tests();
40
 
41
        virtual void SetUp();
42
 
43
        virtual void regwrite(uint32_t raddr, uint32_t rdata);
44
 
45
        virtual void exec(uint32_t addr, uint32_t instr);
46
 
47
        virtual void memwrite(uint32_t addr, uint8_t mask, uint32_t data);
48
 
49
protected:
50
 
51
        void runtest(
52
                        const std::string       &program,
53
                        reg_val_s                       *regs,
54
                        uint32_t                        n_regs);
55
 
56
        void check(reg_val_s *regs, uint32_t n_regs);
57
 
58
public:
59
        static fwrisc_instr_tests               *test;
60
 
61
protected:
62
        uint32_t                                                m_icount;
63
        uint32_t                                                m_max_instr;
64
        uint32_t                                                m_halt_addr;
65
        bool                                                    m_end_of_test;
66
        std::pair<uint32_t, bool>               m_regs[64];
67
        std::pair<uint32_t, bool>               m_mem[4096];
68
};
69
 
70
#endif /* INCLUDED_FWRISC_INSTR_TESTS_H */

powered by: WebSVN 2.1.0

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