simX openfile working
This commit is contained in:
12553
emulator/emulator.debug
Normal file
12553
emulator/emulator.debug
Normal file
File diff suppressed because it is too large
Load Diff
@@ -53,32 +53,32 @@ namespace Harp {
|
||||
};
|
||||
|
||||
class Core;
|
||||
class ConsoleMemDevice : public MemDevice {
|
||||
public:
|
||||
ConsoleMemDevice(Size wS, std::ostream &o, Core &core, bool batch = false);
|
||||
~ConsoleMemDevice() {}
|
||||
// class ConsoleMemDevice : public MemDevice {
|
||||
// public:
|
||||
// ConsoleMemDevice(Size wS, std::ostream &o, Core &core, bool batch = false);
|
||||
// ~ConsoleMemDevice() {}
|
||||
|
||||
//virtual Size wordSize() const { return wordSize; }
|
||||
virtual Size size() const { return wordSize; }
|
||||
virtual Word read(Addr) { pthread_mutex_lock(&cBufLock);
|
||||
char c = cBuf.front();
|
||||
cBuf.pop();
|
||||
pthread_mutex_unlock(&cBufLock);
|
||||
return Word(c); }
|
||||
virtual void write(Addr a, Word w) { output << char(w); }
|
||||
// //virtual Size wordSize() const { return wordSize; }
|
||||
// virtual Size size() const { return wordSize; }
|
||||
// virtual Word read(Addr) { pthread_mutex_lock(&cBufLock);
|
||||
// char c = cBuf.front();
|
||||
// cBuf.pop();
|
||||
// pthread_mutex_unlock(&cBufLock);
|
||||
// return Word(c); }
|
||||
// virtual void write(Addr a, Word w) { output << char(w); }
|
||||
|
||||
void poll();
|
||||
// void poll();
|
||||
|
||||
friend void *Harp::consoleInputThread(void *);
|
||||
// friend void *Harp::consoleInputThread(void *);
|
||||
|
||||
private:
|
||||
std::ostream &output;
|
||||
Size wordSize;
|
||||
Core &core;
|
||||
// private:
|
||||
// std::ostream &output;
|
||||
// Size wordSize;
|
||||
// Core &core;
|
||||
|
||||
std::queue<char> cBuf;
|
||||
pthread_mutex_t cBufLock;
|
||||
};
|
||||
// std::queue<char> cBuf;
|
||||
// pthread_mutex_t cBufLock;
|
||||
// };
|
||||
|
||||
class DiskControllerMemDevice : public MemDevice {
|
||||
public:
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <stdlib.h>
|
||||
#include <pthread.h>
|
||||
// #include <pthread.h>
|
||||
|
||||
#include "include/debug.h"
|
||||
#include "include/types.h"
|
||||
@@ -205,37 +205,6 @@ void MemoryUnit::tlbRm(Addr va) {
|
||||
if (tlb.find(va/pageSize) != tlb.end()) tlb.erase(tlb.find(va/pageSize));
|
||||
}
|
||||
|
||||
void *Harp::consoleInputThread(void* arg_vp) {
|
||||
ConsoleMemDevice *arg = (ConsoleMemDevice *)arg_vp;
|
||||
char c;
|
||||
while (cin) {
|
||||
c = cin.get();
|
||||
pthread_mutex_lock(&arg->cBufLock);
|
||||
arg->cBuf.push(c);
|
||||
pthread_mutex_unlock(&arg->cBufLock);
|
||||
}
|
||||
cout << "Console input ended. Exiting.\n";
|
||||
exit(4);
|
||||
}
|
||||
|
||||
ConsoleMemDevice::ConsoleMemDevice(Size wS, std::ostream &o, Core &core,
|
||||
bool batch) :
|
||||
wordSize(wS), output(o), core(core), cBuf()
|
||||
{
|
||||
// Create a console input thread if we are running in interactive mode.
|
||||
if (!batch) {
|
||||
pthread_t *thread = new pthread_t;
|
||||
pthread_create(thread, NULL, consoleInputThread, (void*)this);
|
||||
}
|
||||
pthread_mutex_init(&cBufLock, NULL);
|
||||
}
|
||||
|
||||
void ConsoleMemDevice::poll() {
|
||||
pthread_mutex_lock(&cBufLock);
|
||||
if (!cBuf.empty()) core.interrupt(8);
|
||||
pthread_mutex_unlock(&cBufLock);
|
||||
}
|
||||
|
||||
Word DiskControllerMemDevice::read(Addr a) {
|
||||
switch (a/8) {
|
||||
case 0: return curDisk;
|
||||
|
||||
@@ -2,3 +2,4 @@ echo start > results.txt
|
||||
|
||||
# echo ../kernel/vortex_test.hex
|
||||
./harptool -E -a rv32i --core ../runtime/mains/nativevecadd/vx_pocl_main.hex -s -b 1> emulator.debug
|
||||
# ./harptool -E -a rv32i --core ../runtime/mains/vector_test/vx_vector_main.hex -s -b 1> emulator.debug
|
||||
|
||||
Reference in New Issue
Block a user