Commit 46ed2875 authored by Wesley W. Terpstra's avatar Wesley W. Terpstra

Add support for read/write instead of read_write/write

parent 6ce87fb1
......@@ -7,7 +7,8 @@
LM32Base::LM32Base(Interconnect* ic)
: Component(ic),
lm32_write (*addSlavePort("lm32_write", Pinout("LM32", 11))),
lm32_read_write(*addSlavePort("lm32_read_write", Pinout("LM32", 11))) {
lm32_read_write(*addSlavePort("lm32_read_write", Pinout("LM32", 11), true)),
lm32_read (*addSlavePort("lm32_read", Pinout("LM32", 11), true)) {
}
void LM32Base::send_command(unsigned int cmd) {
......@@ -36,15 +37,27 @@ void LM32Base::sendrecv_keyval(unsigned int key, uint8_t b) {
val |= (key & 0x7);
Bits x(val);
x.resize(11);
lm32_read_write(x);
if (lm32_read_write.connected()) {
lm32_read_write(x);
} else {
lm32_write(x);
lm32_read();
}
#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);
if (lm32_read.connected()) {
lm32_read();
} else {
Bits x(11, false);
lm32_read_write(x);
}
#ifdef DEBUG_LM32_JTAG
std::cerr << "LM32 RW: 0, 0" << std::endl;
#endif
......
......@@ -11,7 +11,10 @@ class LM32Base : public Component {
void recv(RecvQueue::const_iterator i, RecvQueue::const_iterator end); // dispatches to protected recv
SlavePort& lm32_write;
/* One of these must be connected */
SlavePort& lm32_read_write;
SlavePort& lm32_read;
protected:
/* A raw byte send */
......
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