Line 1... |
Line 1... |
//
|
////////////////////////////////////////////////////////////////////////////////
|
//
|
//
|
// Filename: pipecmdr.h
|
// Filename: pipecmdr.h
|
//
|
//
|
// Project: FPGA testbench utilities.
|
// Project: XuLA2-LX25 SoC based upon the ZipCPU
|
//
|
//
|
// Purpose: This program attaches to a Verilated Verilog IP core.
|
// Purpose: This program attaches to a Verilated Verilog IP core.
|
// It will not work apart from such a core. Once attached,
|
// It will not work apart from such a core. Once attached,
|
// it connects the simulated core to a controller via a
|
// it connects the simulated core to a controller via a pipe interface
|
// pipe interface designed to act like a UART. Indeed, it
|
// designed to act like a UART. Indeed, it is hoped that the final
|
// is hoped that the final interface would be via UART. Until
|
// interface would be via UART. Until that point, however, this is just
|
// that point, however, this is just a simple test facility
|
// a simple test facility designed to verify that the IP core works
|
// designed to verify that the IP core works prior to such
|
// prior to such actual hardware implementation.
|
// actual hardware implementation.
|
//
|
|
// Creator: Dan Gisselquist, Ph.D.
|
|
// Gisselquist Technology, LLC
|
|
//
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
//
|
|
// Copyright (C) 2015-2016, Gisselquist Technology, LLC
|
|
//
|
|
// This program is free software (firmware): 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 3 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 MERCHANTIBILITY or
|
|
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
// for more details.
|
//
|
//
|
// Creator: Dan Gisselquist
|
// You should have received a copy of the GNU General Public License along
|
// Gisselquist Tecnology, LLC
|
// with this program. (It's in the $(ROOT)/doc directory, run make with no
|
|
// target there if the PDF file isn't present.) If not, see
|
|
// <http://www.gnu.org/licenses/> for a copy.
|
//
|
//
|
// Copyright: 2015
|
// License: GPL, v3, as defined and found on www.gnu.org,
|
|
// http://www.gnu.org/licenses/gpl.html
|
|
//
|
|
//
|
|
////////////////////////////////////////////////////////////////////////////////
|
//
|
//
|
//
|
//
|
#ifndef PIPECMDR_H
|
#ifndef PIPECMDR_H
|
#define PIPECMDR_H
|
#define PIPECMDR_H
|
|
|
Line 183... |
Line 205... |
m_txbuf[m_txpos++] = TESTB<VA>::m_core->o_tx_data;
|
m_txbuf[m_txpos++] = TESTB<VA>::m_core->o_tx_data;
|
tx_accepted = true;
|
tx_accepted = true;
|
if ((TESTB<VA>::m_core->o_tx_data == '\n')||(m_txpos >= sizeof(m_txbuf))) {
|
if ((TESTB<VA>::m_core->o_tx_data == '\n')||(m_txpos >= sizeof(m_txbuf))) {
|
int snt = 0;
|
int snt = 0;
|
snt = send(m_con, m_txbuf, m_txpos, 0);
|
snt = send(m_con, m_txbuf, m_txpos, 0);
|
|
if (snt < 0) {
|
|
close(m_con);
|
|
m_con = -1;
|
|
snt = 0;
|
|
}
|
m_txbuf[m_txpos] = '\0';
|
m_txbuf[m_txpos] = '\0';
|
printf("> %s", m_txbuf);
|
printf("> %s", m_txbuf);
|
if (snt < m_txpos) {
|
if (snt < m_txpos) {
|
fprintf(stderr, "Only sent %d bytes!\n",
|
fprintf(stderr, "Only sent %d bytes of %d!\n",
|
snt);
|
snt, m_txpos);
|
}
|
}
|
m_txpos = 0;
|
m_txpos = 0;
|
}
|
}
|
}
|
}
|
} else
|
} else
|