1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
|
/***************************************************************************
* Copyright (C) 2005 by Mark Six *
* marksix@xs4all.nl *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
***************************************************************************/
#ifndef KSIMULATOR_H
#define KSIMULATOR_H
#include <qobject.h>
#include "cpicoblaze.h"
#include "cassembler.h"
#include <string>
#include <qtimer.h>
#include <klistview.h>
#include "kprocessorview.h"
#define ZERO_FLAG 0x01
#define CARRY_FLAG 0x02
#define INTERRUPT_FLAG 0x04
class KSimulator : public QObject
{
Q_OBJECT
public:
KSimulator(QObject *parent = 0, const char *name = 0);
~KSimulator();
void setFilename( string filename ) { m_assembler->setFilename( filename ) ; }
bool compile() { return m_assembler->assemble() ; }
bool exportVHDL( string templateFile, string outputDir, string entityName )
{
return m_assembler->exportVHDL( templateFile, outputDir, entityName ) ;
}
bool exportHEX( string filename, bool mem )
{
return m_assembler->exportHEX( filename, mem ) ;
}
void setRegisterValues( unsigned char *values ) ;
void getRegisterValues( unsigned char *values ) ;
unsigned char getFlags() ;
void setFlags( unsigned char flags ) ;
void getScratchpad( unsigned char * values ) ;
unsigned int getNextSourceLine() ;
void assemblerError( unsigned int line, const char * str ) ;
void setMessageList( KListView *messageList ) ;
bool isRunning() ;
CPicoBlaze * getCpu() ;
signals:
void stepped( unsigned int currentSourceLine ) ;
public slots:
void run() ;
void stop() ;
void next() ;
void interrupt() ;
void reset() ;
void clear() ;
private:
CPicoBlaze * m_picoBlaze ;
CAssembler * m_assembler ;
QTimer * m_timer ;
bool m_bInterrupt ;
KListView *m_messageList ;
bool m_run ;
};
#endif
|