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

Subversion Repositories zipcpu

[/] [zipcpu/] [trunk/] [bench/] [cpp/] [testb.h] - Blame information for rev 202

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 dgisselq
////////////////////////////////////////////////////////////////////////////////
2
//
3
// Filename:    testb.h
4
//
5
// Project:     Zip CPU -- a small, lightweight, RISC CPU core
6
//
7
// Purpose:     A wrapper for a common interface to a clocked FPGA core
8
//              begin exercised in Verilator.
9
//
10
// Creator:     Dan Gisselquist, Ph.D.
11 69 dgisselq
//              Gisselquist Technology, LLC
12 2 dgisselq
//
13
////////////////////////////////////////////////////////////////////////////////
14
//
15
// Copyright (C) 2015, Gisselquist Technology, LLC
16
//
17
// This program is free software (firmware): you can redistribute it and/or
18
// modify it under the terms of  the GNU General Public License as published
19
// by the Free Software Foundation, either version 3 of the License, or (at
20
// your option) any later version.
21
//
22
// This program is distributed in the hope that it will be useful, but WITHOUT
23
// ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
24
// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
25
// for more details.
26
//
27
// You should have received a copy of the GNU General Public License along
28
// with this program.  (It's in the $(ROOT)/doc directory, run make with no
29
// target there if the PDF file isn't present.)  If not, see
30
// <http://www.gnu.org/licenses/> for a copy.
31
//
32
// License:     GPL, v3, as defined and found on www.gnu.org,
33
//              http://www.gnu.org/licenses/gpl.html
34
//
35
//
36
////////////////////////////////////////////////////////////////////////////////
37
#ifndef TESTB_H
38
#define TESTB_H
39
 
40
template <class VA>     class TESTB {
41
public:
42
        VA      *m_core;
43
        unsigned long   m_tickcount;
44
 
45
        TESTB(void) { m_core = new VA; }
46 43 dgisselq
        virtual ~TESTB(void) { delete m_core; m_core = NULL; }
47 2 dgisselq
 
48
        virtual void    eval(void) {
49
                m_core->eval();
50
        }
51
 
52
        virtual void    tick(void) {
53 36 dgisselq
                m_core->i_clk = 1;
54
                eval();
55 2 dgisselq
                m_core->i_clk = 0;
56
                eval();
57
 
58
                m_tickcount++;
59
        }
60
 
61
        virtual void    reset(void) {
62
                m_core->i_rst = 1;
63
                tick();
64
                m_core->i_rst = 0;
65
                m_tickcount = 0l;
66 36 dgisselq
                // printf("RESET\n");
67 2 dgisselq
        }
68
};
69
 
70
#endif

powered by: WebSVN 2.1.0

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