Commit fe8cf1f5 authored by Wesley W. Terpstra's avatar Wesley W. Terpstra

Handy to trace code

parent 12c11384
......@@ -2,6 +2,8 @@
#include "lm32-base.h"
// #define DEBUG_LM32_JTAG 1
LM32Base::LM32Base(Interconnect* ic)
: Component(ic),
lm32_write (*addSlavePort("lm32_write", Pinout("LM32", 11))),
......@@ -23,6 +25,9 @@ void LM32Base::send_keyval(unsigned int key, uint8_t b) {
Bits x(val);
x.resize(11);
lm32_write(x);
#ifdef DEBUG_LM32_JTAG
std::cerr << "LM32 W: " << std::hex << key << ", " << std::hex << (int)b << std::endl;
#endif
}
void LM32Base::sendrecv_keyval(unsigned int key, uint8_t b) {
......@@ -32,11 +37,17 @@ void LM32Base::sendrecv_keyval(unsigned int key, uint8_t b) {
Bits x(val);
x.resize(11);
lm32_read_write(x);
#ifdef DEBUG_LM32_JTAG
std::cerr << "LM32 RW: " << std::hex << key << ", " << std::hex << (int)b << std::endl;
#endif
}
void LM32Base::read_byte() {
Bits x(11, false);
lm32_read_write(x);
#ifdef DEBUG_LM32_JTAG
std::cerr << "LM32 RW: 0, 0" << std::endl;
#endif
}
void LM32Base::recv(RecvQueue::const_iterator i, RecvQueue::const_iterator end) {
......@@ -44,6 +55,9 @@ void LM32Base::recv(RecvQueue::const_iterator i, RecvQueue::const_iterator end)
Bits c(i->bits);
c.resize(16);
uint16_t v = static_cast<uint16_t>(c);
#ifdef DEBUG_LM32_JTAG
std::cerr << "LM32 R: " << std::hex << (v&0x7) << ", " << std::hex << (int)(v>>3) << " IN " << std::endl;
#endif
recv(v & 0x7, v >> 3);
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment