OpenCores
URL https://opencores.org/ocsvn/tv80/tv80/trunk

Subversion Repositories tv80

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /tv80/trunk
    from Rev 110 to Rev 111
    Reverse comparison

Rev 110 → Rev 111

/rtl/core/tv80_core.v
955,8 → 955,8
begin
RegWEH = 1'b0;
RegWEL = 1'b0;
if ((tstate[1] && Save_ALU_r == 1'b0 && Auto_Wait_t1 == 1'b0) ||
(Save_ALU_r == 1'b1 && ALU_Op_r != 4'b0111) )
if ((tstate[1] && ~Save_ALU_r && ~Auto_Wait_t1) ||
(Save_ALU_r && (ALU_Op_r != 4'b0111)) )
begin
case (Read_To_Reg_r)
5'b10000 , 5'b10001 , 5'b10010 , 5'b10011 , 5'b10100 , 5'b10101 :
970,13 → 970,13
end // if ((tstate == 1 && Save_ALU_r == 1'b0 && Auto_Wait_t1 == 1'b0) ||...
 
if (ExchangeDH == 1'b1 && (tstate[3] || tstate[4]) )
if (ExchangeDH && (tstate[3] || tstate[4]) )
begin
RegWEH = 1'b1;
RegWEL = 1'b1;
end
 
if (IncDec_16[2] && ((tstate[2] && ~wait_n && ~mcycle[0]) || (tstate[3] && mcycle[0])) )
if (IncDec_16[2] && ((tstate[2] && wait_n && ~mcycle[0]) || (tstate[3] && mcycle[0])) )
begin
case (IncDec_16[1:0])
2'b00 , 2'b01 , 2'b10 :
/tests/stdint.h
20,6 → 20,7
// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
 
#ifndef _SYS_TYPES_H
#ifndef _STDINT_H
#define _STDINT_H 1
// reduced version of stdint.h for Z80
32,3 → 33,4
typedef unsigned long uint32_t;
 
#endif
#endif
/tests/tv80_env.h
28,6 → 28,8
#ifndef TV80_ENV_H
#define TV80_ENV_H
 
#include "tv80_scenv.h"
 
sfr at 0x80 sim_ctl_port;
sfr at 0x81 msg_port;
sfr at 0x82 timeout_port;
41,10 → 43,12
sfr at 0x95 nmi_cntdwn;
sfr at 0xA0 nmi_trig_opcode;
 
/* now included from scenv.h
#define SC_TEST_PASSED 0x01
#define SC_TEST_FAILED 0x02
#define SC_DUMPON 0x03
#define SC_DUMPOFF 0x04
*/
 
void print (char *string)
{
/tests/blk_out_inst.c
106,8 → 106,8
_endasm;
}
 
char cksum_sw (char *buf, char len) {
char rv, i;
char cksum_sw (char *buf, int len) {
char rv; int i;
 
rv = 0;
for (i=0; i<len; i++) {
119,17 → 119,19
 
int main ()
{
char i, cs_a, cs_b;
unsigned char cs_a, cs_b;
int i;
 
max_timeout_high = 0xff;
 
for (i=0; i<BUF_SIZE; i=i+1) {
for (i=0; i<BUF_SIZE; i++) {
buf[i] = i+1;
//timeout_port = 3;
}
 
print ("Checking OTIR\n");
cs_a = cksum_asm (buf, BUF_SIZE);
cs_b = cksum_up (buf, BUF_SIZE);
cs_a = cksum_sw (buf, BUF_SIZE);
cs_b = cksum_up (buf, BUF_SIZE);
 
if (cs_a != cs_b)
sim_ctl (SC_TEST_FAILED);
/tests/Makefile
5,7 → 5,7
#CC=$(SDCC_ROOT)/bin/sdcc -mz80
#AS=$(SDCC_ROOT)/bin/as-z80
#LD=$(SDCC_ROOT)/bin/link-z80
CC=sdcc -mz80
CC=sdcc -mz80 -I../sc_env
AS=as-z80
LD=link-z80
IHEX2MEM=../scripts/ihex2mem.py
/scripts/sc_gen
1,5 → 1,7
#!/bin/bash
 
rm -rf obj_dir
 
verilator --sc --trace -O3 rtl/core/tv80s.v rtl/core/tv80_alu.v \
rtl/core/tv80_mcode.v rtl/core/tv80_reg.v rtl/core/tv80_core.v
 
/sc_env/tv_responder.h
2,6 → 2,7
#define TV_RESPONDER_H_
 
#include "sc_env.h"
#include "tv80_scenv.h"
 
SC_MODULE(tv_responder)
{
/sc_env/env_memory.cpp
30,6 → 30,8
{
int c = 1, cnt = 0;
assert (fh != NULL);
if (feof(fh)) {
*buf = (char) 0;
return 0;
86,6 → 88,7
sscanf (lp, "%02x", &databyte);
lp += 2;
//printf ("DEBUG: loaded mem[%04x]=%02x\n", addr+c, databyte);
assert ( (addr+c) < AM_DEPTH );
memory[addr+c] = databyte; dcount++;
}
rv = readline (fh, line);
/sc_env/tv80_scenv.h
0,0 → 1,29
/* This file contains defines which are common to both the
* SystemC testbench and the SDCC/Z80 C tests. This should
* contain only defines and statements which can be understood
* by both SDCC and gcc. Any types referenced should use the
* stdint.h types rather than int/char.
*/
 
#ifndef TV80_SCENV_H_
#define TV80_SCENV_H_
 
#define SIM_CTL_PORT 0x80
#define MSG_PORT 0x81
#define TIMEOUT_PORT 0x82
#define MAX_TIMEOUT_LOW 0x83
#define MAX_TIMEOUT_HIGH 0x84
#define INTR_CNTDWN 0x90
#define CKSUM_VALUE 0x91
#define CKSUM_ACCUM 0x92
#define INC_ON_READ 0x93
#define RANDVAL 0x94
#define NMI_CNTDWN 0x95
#define NMI_TRIG_OPCODE 0xA0
 
#define SC_TEST_PASSED 0x01
#define SC_TEST_FAILED 0x02
#define SC_DUMPON 0x03
#define SC_DUMPOFF 0x04
 
#endif /*TV80_SCENV_H_*/
/sc_env/env_memory.h
3,7 → 3,7
#ifndef ENV_MEMORY_H
#define ENV_MEMORY_H
#define AM_ASZ 16
#define AM_DEPTH (1<<16)
#define AM_DEPTH (1<<AM_ASZ)
 
SC_MODULE(env_memory) {
 
/sc_env/tv_responder.cpp
1,5 → 1,12
#include "tv_responder.h"
 
uint64_t get_time_stamp () {
sc_time t;
t = sc_time_stamp();
return t.value();
}
 
void tv_responder::event ()
{
// init
11,6 → 18,7
busrq_n = 1;
di_resp = 0;
*/
uint8_t oldval;
if (reset_time > 0) {
reset_n = 0;
39,7 → 47,10
case(0x84) : di_resp = max_timeout >> 8; break;
 
case(0x90) : di_resp = int_countdown; break;
case(0x91) : di_resp = checksum; break;
case(CKSUM_VALUE) :
di_resp = checksum;
//printf ("%2.6f: Read checksum value of %02x\n", sc_time_stamp().to_seconds(), checksum);
break;
case(0x93) : di_resp = ior_value; break;
case(0x94) : di_resp = rand(); break;
case(0x95) : di_resp = nmi_countdown; break;
67,31 → 78,26
last_iowrite = true;
switch ( l_addr & 0xff) {
case(0x80) :
case(SIM_CTL_PORT) :
// dump control deprecated
if (l_dout == 1) {
printf ("%8d: --- TEST PASSED ---\n", 0);
printf ("%2.6f: --- TEST PASSED ---\n", sc_time_stamp().to_seconds());
sc_stop();
} else if (l_dout == 2) {
printf ("%8d: !!! TEST FAILED !!!\n", 0);
printf ("%2.6f: !!! TEST FAILED !!!\n", sc_time_stamp().to_seconds());
sc_stop();
}
break;
 
case(0x81) :
case(MSG_PORT) :
//printf ("%s: DEBUG : Detected write of character %x\n", sc_time_stamp().to_string(), l_dout);
//cout << sc_time_stamp().to_string() << "DEBUG : Detected write of character " << l_dout << endl;
if (l_dout == 0x0A) {
//printf ("%8d: PROGRAM : ", sc_simulation_time());
cout << sc_time_stamp() << ": PROGRAM : ";
printf ("%2.6f: PROGRAM : ", sc_time_stamp().to_seconds());
 
for (int i=0; i<buf_ptr; i=i+1)
//printf ("%s", str_buf[i]);
cout << str_buf[i];
printf ("%c", str_buf[i]);
//printf ("\n");
cout << endl;
printf ("\n");
buf_ptr = 0;
} else {
str_buf[buf_ptr] = (char) (l_dout & 0xff);
99,21 → 105,26
}
break;
 
case(0x82) :
case(TIMEOUT_PORT) :
timeout_ctl = l_dout;
break;
 
case(0x83) :
case(MAX_TIMEOUT_LOW) :
max_timeout = l_dout | (max_timeout & 0xFF00);
break;
case(0x84) :
max_timeout = l_dout << 8 | (max_timeout & 0x00FF);
case(MAX_TIMEOUT_HIGH) :
max_timeout = (l_dout << 8) | (max_timeout & 0x00FF);
printf ("%2.6f: ENVIRON : Timeout reset to %d (dout=%d)\n", sc_time_stamp().to_seconds(), max_timeout, l_dout);
break;
 
case(0x90) : int_countdown = dout; break;
case(0x91) : checksum = dout; break;
case(0x92) : checksum = checksum + dout; break;
case(CKSUM_VALUE) : checksum = dout; break;
case(CKSUM_ACCUM) :
oldval = checksum;
checksum = checksum + dout;
//printf ("%2.6f: ENVIRON : cksum %02x=%02x + %02x\n", sc_time_stamp().to_seconds(), checksum, oldval, l_dout);
break;
case(0x93) : ior_value = dout; break;
case(0x95) : nmi_countdown = dout; break;
case(0xA0) : nmi_trigger = dout; break;
121,13 → 132,14
} else if (iorq_n)
last_iowrite = false;
 
if (timeout_ctl & 0x2)
if (timeout_ctl & 0x2) {
cur_timeout = 0;
else if (timeout_ctl & 0x1)
timeout_ctl = timeout_ctl & 1;
} else if (timeout_ctl & 0x1)
cur_timeout = cur_timeout + 1;
 
if (cur_timeout >= max_timeout) {
printf ("%8d: ERROR : Reached timeout %d cycles\n", 0, max_timeout);
printf ("%2.6f: ERROR : Reached timeout %d cycles\n", sc_time_stamp().to_seconds(), max_timeout);
//tb_top.test_fail;
sc_stop();
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.