mirror of
https://github.com/aap/pdp6.git
synced 2026-01-11 23:53:31 +00:00
KA compatibility
This commit is contained in:
parent
77c02726f5
commit
9d08e7306e
@ -1,4 +1,4 @@
|
||||
#include "fe6.h"
|
||||
#include "../fe.h"
|
||||
#include <unistd.h>
|
||||
|
||||
/* Memory mapped PDP-6 interface */
|
||||
55
fe6/6/flags.inc
Normal file
55
fe6/6/flags.inc
Normal file
@ -0,0 +1,55 @@
|
||||
const char *ff0str =
|
||||
"%c KEY %c KEY %c KEY %c KEY DEP %c KEY %c MC %c MC %c MC\r\n"
|
||||
" EX ST EX SYNC DEP ST SYNC RD/WR RD WR RQ\r\n";
|
||||
|
||||
const char *ff1str =
|
||||
"%c IF1A %c AF0 %c AF3 %c AF3A %c KEY %c F1A %c F4A %c F6A\r\n"
|
||||
" AR PSE\r\n";
|
||||
|
||||
const char *ff2str =
|
||||
"%c SF3 %c SF5A %c SF7 %c AR %c BLT %c BLT %c BLT %c IOT\r\n"
|
||||
" COM F0A F3A F5A F0A\r\n";
|
||||
|
||||
const char *ff3str =
|
||||
"%c FPF1 %c FPF2 %c FAF1 %c FAF2 %c FAF3 %c FAF4 %c FMF1 %c FMF2\r\n"
|
||||
"\r\n";
|
||||
|
||||
const char *ff4str =
|
||||
"%c FDF1 %c FDF2 %c NR RND %c NRF1 %c NRF2 %c NRF3 %c FSF1 %c CHF7\r\n"
|
||||
"\r\n";
|
||||
|
||||
const char *ff5str =
|
||||
"%c DSF1 %c DSF2 %c DSF3 %c DSF4 %c DSF5 %c DSF6 %c DSF7 %c DSF8\r\n"
|
||||
"\r\n";
|
||||
|
||||
const char *ff6str =
|
||||
"%c DSF9 %c MSF1 %c MPF1 %c MPF2 %c SPLIT %c STOP %c SHF1 %c SC=777\r\n"
|
||||
" SYNC SYNC\r\n";
|
||||
|
||||
const char *ff7str =
|
||||
"%c CHF1 %c CHF2 %c CHF3 %c CHF4 %c CHF5 %c CHF6 %c LCF1 %c DCF1\r\n"
|
||||
"\r\n";
|
||||
|
||||
const char *ff8str =
|
||||
"%c PI OV %c PI CYC %c PI REQ %c IOT GO %c A LONG %c MA=MAS %c UUO F1 %c PDL OV\r\n"
|
||||
"\r\n";
|
||||
|
||||
const char *ff9str =
|
||||
"%c FE1 %c FE2 %c FE3 %c FE4 %c FE5 %c FE6 %c FE7 %c FE8\r\n"
|
||||
"\r\n";
|
||||
|
||||
const char *ff10str =
|
||||
"%c SC1 %c SC2 %c SC3 %c SC4 %c SC5 %c SC6 %c SC7 %c SC8\r\n"
|
||||
"\r\n";
|
||||
|
||||
const char *ff11str =
|
||||
"%c EXEC %c CPA %c EX %c EX UUO %c EX PI %c MQ36 %c SC0 %c FE0\r\n"
|
||||
" MODE ILL OP ILL OP SYNC SYNC\r\n";
|
||||
|
||||
const char *ff12str =
|
||||
"%c RIM %c CRY0 v %c AR CRY %c AR CRY %c AR OV %c AR CRY %c AR CRY %c PC CHG\r\n"
|
||||
" SBR CRY1 0 1 FLG 0 FLG 1 FLG FLG\r\n";
|
||||
|
||||
const char *ff13str =
|
||||
"%c NONEX %c CLOCK %c CLOCK %c PC CHG %c AR OV %c PIA 33 %c PIA 34 %c PIA 35\r\n"
|
||||
" MEM EN FLG EN EN\r\n";
|
||||
@ -1,8 +1,7 @@
|
||||
#include "fe6.h"
|
||||
#include "../fe.h"
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/mman.h>
|
||||
//#include "hps_0.h"
|
||||
|
||||
#define H2F_BASE (0xC0000000)
|
||||
|
||||
@ -378,13 +377,7 @@ static void waitmemstop(void)
|
||||
int i;
|
||||
if(!isrunning())
|
||||
return;
|
||||
for(i = 0; i < 10; i++){
|
||||
if(isstopped())
|
||||
return;
|
||||
usleep(100);
|
||||
}
|
||||
keytoggle(MM6_MEMSTOP);
|
||||
for(i = 0; i < 10; i++){
|
||||
for(i = 0; i < 20; i++){
|
||||
if(isstopped())
|
||||
return;
|
||||
usleep(100);
|
||||
@ -431,7 +424,6 @@ X typestr("<SETPC>\r\n");
|
||||
|
||||
cpu_stopinst();
|
||||
X run = 0;
|
||||
// TODO: maybe INSTSTOP?
|
||||
keydown(MM6_MEMSTOP);
|
||||
keyup(MM6_ADRSTOP);
|
||||
set_ta(a);
|
||||
@ -443,6 +435,11 @@ X typestr("<SETPC>\r\n");
|
||||
keyup(MM6_MEMSTOP);
|
||||
keytoggle(MM6_INSTSTOP);
|
||||
X run = 0;
|
||||
h2f_apr[REG6_CTL2_DN] = MM6_THISEX;
|
||||
usleep(1000);
|
||||
h2f_apr[REG6_CTL2_UP] = MM6_THISEX;
|
||||
usleep(1000);
|
||||
X memstop = 0;
|
||||
}
|
||||
|
||||
void
|
||||
@ -452,6 +449,7 @@ X typestr("<STOPINST>\r\n");
|
||||
|
||||
if(!isrunning())
|
||||
return;
|
||||
// TODO: what if memory stop?
|
||||
keytoggle(MM6_INSTSTOP);
|
||||
waithalt();
|
||||
X run = 0;
|
||||
@ -464,9 +462,10 @@ X typestr("<STOPMEM>\r\n");
|
||||
|
||||
if(!isrunning() || isstopped())
|
||||
return;
|
||||
keytoggle(MM6_MEMSTOP);
|
||||
keydown(MM6_MEMSTOP);
|
||||
waitmemstop();
|
||||
X memstop = 1;
|
||||
keyup(MM6_MEMSTOP);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -485,22 +484,12 @@ togglecont(void)
|
||||
void
|
||||
cpu_cont(void)
|
||||
{
|
||||
int stop;
|
||||
X typestr("<CONT>\r\n");
|
||||
|
||||
if(isrunning())
|
||||
return;
|
||||
stop = isstopped();
|
||||
keyup(MM6_STOP);
|
||||
togglecont();
|
||||
|
||||
// on stop the machine should halt after one instruction
|
||||
// so restart
|
||||
// BUG: if next instruction is HALT we'll continue past it
|
||||
if(stop){
|
||||
waithalt();
|
||||
togglecont();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
@ -551,6 +540,7 @@ X typestr("<RESET>\r\n");
|
||||
if(isrunning())
|
||||
err("?R? ");
|
||||
keytoggle(MM6_RESET);
|
||||
typestr("\r\n");
|
||||
}
|
||||
|
||||
#include "flags.inc"
|
||||
32
fe6/6/regs.h
Normal file
32
fe6/6/regs.h
Normal file
@ -0,0 +1,32 @@
|
||||
#define PDP_REGS \
|
||||
X("DS", APR_DS)\
|
||||
X("MAS", APR_MAS)\
|
||||
X("RPT", APR_RPT)\
|
||||
X("IR", APR_IR)\
|
||||
X("MI", APR_MI)\
|
||||
X("PC", APR_PC)\
|
||||
X("MA", APR_MA)\
|
||||
X("PIH", APR_PIH)\
|
||||
X("PIR", APR_PIR)\
|
||||
X("PIO", APR_PIO)\
|
||||
X("RUN", APR_RUN)\
|
||||
X("PION", APR_PION)\
|
||||
X("STOP", APR_STOP)
|
||||
#ifdef TEST
|
||||
#define PDP_REGS_TEST \
|
||||
X("CTL1", APR_CTL1_DN)\
|
||||
X("CTL1U", APR_CTL1_UP)\
|
||||
X("CTL2", APR_CTL2_DN)\
|
||||
X("CTL2U", APR_CTL2_UP)\
|
||||
X("MB", APR_MB)\
|
||||
X("AR", APR_AR)\
|
||||
X("MQ", APR_MQ)\
|
||||
X("TTY.TTI", TTY_TTI)\
|
||||
X("TTY.ST", TTY_ST)\
|
||||
X("PTR.PTR", PTR_PTR)\
|
||||
X("PTR.ST", PTR_ST)\
|
||||
X("PTR.FE", PTR_FE)\
|
||||
X("FE.REQ", FE_REQ)
|
||||
#else
|
||||
#define PDP_REGS_TEST
|
||||
#endif
|
||||
22
fe6/Makefile
22
fe6/Makefile
@ -1,13 +1,21 @@
|
||||
XX=/u/aap/de0-nano-soc/gcc-linaro-6.5.0-2018.12-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-
|
||||
CFLAGS=-DTEST
|
||||
|
||||
all: fe6_emu fe6_fake fe6
|
||||
SRC=fe.c cmd.c util.c pdp6common.c
|
||||
|
||||
fe6_emu: fe6.c emu6.c cmd.c util.c pdp6common.c
|
||||
$(CC) $(CFLAGS) -o $@ $^
|
||||
all: fe6_emu fe6_fake fe6 feka
|
||||
clean:
|
||||
rm fe6_emu fe6_fake fe6
|
||||
|
||||
fe6_fake: fe6.c fake.c cmd.c util.c pdp6common.c
|
||||
$(CC) $(CFLAGS) -o $@ $^
|
||||
fe6: $(SRC) 6/real6.c
|
||||
$(XX)gcc -I6 $(CFLAGS) -o $@ $^
|
||||
|
||||
fe6: fe6.c real6.c cmd.c util.c pdp6common.c
|
||||
$(XX)gcc $(CFLAGS) -o $@ $^
|
||||
fe6_fake: $(SRC) fake.c
|
||||
$(CC) -I6 $(CFLAGS) -o $@ $^
|
||||
|
||||
fe6_emu: $(SRC) 6/emu6.c
|
||||
$(CC) -I6 $(CFLAGS) -o $@ $^
|
||||
|
||||
|
||||
feka: $(SRC) ka/real.c
|
||||
$(XX)gcc -Ika $(CFLAGS) -o $@ $^
|
||||
|
||||
43
fe6/cmd.c
43
fe6/cmd.c
@ -1,4 +1,4 @@
|
||||
#include "fe6.h"
|
||||
#include "fe.h"
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
@ -60,6 +60,33 @@ splitops(void)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
loadsav(FILE *fp)
|
||||
{
|
||||
word iowd;
|
||||
word w;
|
||||
while(w = readwbak(fp), w != ~0){
|
||||
if(w >> 27 == 0254){
|
||||
printf("PC: %o\r\n", right(w));
|
||||
fflush(stdout);
|
||||
cpu_setpc(right(w));
|
||||
started = 1;
|
||||
return;
|
||||
}
|
||||
iowd = w;
|
||||
while(left(iowd) != 0){
|
||||
iowd += 01000001;
|
||||
w = readwbak(fp);
|
||||
if(w == ~0)
|
||||
goto format;
|
||||
deposit(right(iowd), w);
|
||||
}
|
||||
}
|
||||
format:
|
||||
printf("\r\nSAV format botch\r\n");
|
||||
fflush(stdout);
|
||||
}
|
||||
|
||||
void
|
||||
loadsblk(FILE *fp)
|
||||
{
|
||||
@ -209,6 +236,19 @@ c_load(int argc, char *argv[])
|
||||
fclose(f);
|
||||
}
|
||||
|
||||
void
|
||||
c_loadsav(int argc, char *argv[])
|
||||
{
|
||||
FILE *f;
|
||||
if(argc < 2)
|
||||
return;
|
||||
f = fopen(ops[1], "rb");
|
||||
if(f == nil)
|
||||
err("?F? ");
|
||||
loadsav(f);
|
||||
fclose(f);
|
||||
}
|
||||
|
||||
struct dev devtab[] = {
|
||||
{ "ptr", O_RDONLY, -1, nil },
|
||||
{ "ptp", O_WRONLY | O_CREAT | O_TRUNC, -1, nil },
|
||||
@ -285,6 +325,7 @@ struct {
|
||||
void (*f)(int, char **);
|
||||
} cmdtab[] = {
|
||||
{ "load", c_load },
|
||||
{ "loadsav", c_loadsav },
|
||||
{ "dump", c_dump },
|
||||
{ "mount", c_mount },
|
||||
{ "unmount", c_unmount },
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
#include "fe6.h"
|
||||
#include "fe.h"
|
||||
#include <unistd.h>
|
||||
|
||||
static word memory[01000000];
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
#include <unistd.h>
|
||||
#include <setjmp.h>
|
||||
|
||||
#include "fe6.h"
|
||||
#include "fe.h"
|
||||
|
||||
struct termios tiosaved;
|
||||
char erasec, killc, intrc;
|
||||
@ -224,20 +224,6 @@ struct Symbol
|
||||
|
||||
Symbol symtab[] = {
|
||||
{ "SM", 01000000 },
|
||||
// { "MM", 02000000 },
|
||||
{ "DS", APR_DS },
|
||||
{ "MAS", APR_MAS },
|
||||
{ "RPT", APR_RPT },
|
||||
{ "IR", APR_IR },
|
||||
{ "MI", APR_MI },
|
||||
{ "PC", APR_PC },
|
||||
{ "MA", APR_MA },
|
||||
{ "PIH", APR_PIH },
|
||||
{ "PIR", APR_PIR },
|
||||
{ "PIO", APR_PIO },
|
||||
{ "RUN", APR_RUN },
|
||||
{ "PION", APR_PION },
|
||||
{ "STOP", APR_STOP },
|
||||
{ "LED", 01001000 },
|
||||
{ "SW", 01001001 },
|
||||
|
||||
@ -254,21 +240,12 @@ Symbol symtab[] = {
|
||||
{ "%DC", 0200 },
|
||||
{ "%UTC", 0204 },
|
||||
{ "%UTS", 0210 },
|
||||
#ifdef TEST
|
||||
{ "CTL1U", APR_CTL1_UP },
|
||||
{ "CTL1", APR_CTL1_DN },
|
||||
{ "CTL2U", APR_CTL2_UP },
|
||||
{ "CTL2", APR_CTL2_DN },
|
||||
{ "MB", APR_MB },
|
||||
{ "AR", APR_AR },
|
||||
{ "MQ", APR_MQ },
|
||||
{ "TTY.TTI", TTY_TTI },
|
||||
{ "TTY.ST", TTY_ST },
|
||||
{ "PTR.PTR", PTR_PTR },
|
||||
{ "PTR.ST", PTR_ST },
|
||||
{ "PTR.FE", PTR_FE },
|
||||
{ "FE.REQ", FE_REQ },
|
||||
#endif
|
||||
|
||||
#define X(str, name) { str, name },
|
||||
PDP_REGS
|
||||
PDP_REGS_TEST
|
||||
#undef X
|
||||
|
||||
{ nil, 0 },
|
||||
};
|
||||
|
||||
@ -554,6 +531,15 @@ runline(void)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
zerocore(void)
|
||||
{
|
||||
hword a;
|
||||
for(a = 0; a < MAXMEM; a++)
|
||||
deposit(a, 0);
|
||||
typestr("\r\n");
|
||||
}
|
||||
|
||||
void
|
||||
quit(void)
|
||||
{
|
||||
@ -755,6 +741,13 @@ main()
|
||||
combine(q);
|
||||
break;
|
||||
|
||||
case 'Z':
|
||||
if(flags & CCF)
|
||||
zerocore();
|
||||
else
|
||||
err(" ?? ");
|
||||
break;
|
||||
|
||||
case ALT:
|
||||
if(flags & CF)
|
||||
flags |= CCF;
|
||||
@ -20,38 +20,14 @@ typedef uint8_t u8;
|
||||
|
||||
#define MAXMEM (16*1024)
|
||||
|
||||
#include "regs.h"
|
||||
|
||||
enum {
|
||||
APR_DS = 01000020,
|
||||
APR_MAS,
|
||||
APR_RPT,
|
||||
APR_IR,
|
||||
APR_MI,
|
||||
APR_PC,
|
||||
APR_MA,
|
||||
APR_PIH,
|
||||
APR_PIR,
|
||||
APR_PIO,
|
||||
APR_RUN,
|
||||
APR_PION,
|
||||
APR_STOP,
|
||||
|
||||
#ifdef TEST
|
||||
APR_CTL1_DN,
|
||||
APR_CTL1_UP,
|
||||
APR_CTL2_DN,
|
||||
APR_CTL2_UP,
|
||||
APR_MB,
|
||||
APR_AR,
|
||||
APR_MQ,
|
||||
|
||||
TTY_TTI,
|
||||
TTY_ST,
|
||||
PTR_PTR,
|
||||
PTR_ST,
|
||||
PTR_FE,
|
||||
|
||||
FE_REQ,
|
||||
#endif
|
||||
FAKEFAKE = 01000017,
|
||||
#define X(str, name) name,
|
||||
PDP_REGS
|
||||
PDP_REGS_TEST
|
||||
#undef X
|
||||
|
||||
APR_END,
|
||||
};
|
||||
713
fe6/ka/real.c
Executable file
713
fe6/ka/real.c
Executable file
@ -0,0 +1,713 @@
|
||||
#include "../fe.h"
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/mman.h>
|
||||
|
||||
#define H2F_BASE (0xC0000000)
|
||||
|
||||
#define PERIPH_BASE (0xFC000000)
|
||||
#define PERIPH_SPAN (0x04000000)
|
||||
#define PERIPH_MASK (PERIPH_SPAN - 1)
|
||||
|
||||
#define LWH2F_BASE (0xFF200000)
|
||||
|
||||
/* Memory mapped KA10 interface */
|
||||
enum
|
||||
{
|
||||
/* keys, switches and some lights */
|
||||
REG_SW_DN = 0,
|
||||
REG_SW_UP = 1,
|
||||
// keys
|
||||
MMKA_DEP_NXT = 1,
|
||||
MMKA_DEP = 2,
|
||||
MMKA_EX_NXT = 4,
|
||||
MMKA_EX = 010,
|
||||
MMKA_XCT = 020,
|
||||
MMKA_RESET = 040,
|
||||
MMKA_STOP = 0100,
|
||||
MMKA_CONT = 0200,
|
||||
MMKA_START = 0400,
|
||||
MMKA_READIN = 01000,
|
||||
// switches
|
||||
MMKA_ADR_BRK = 02000,
|
||||
MMKA_ADR_STOP = 04000,
|
||||
MMKA_ADR_WR = 010000,
|
||||
MMKA_ADR_RD = 020000,
|
||||
MMKA_ADR_INST = 040000,
|
||||
MMKA_RPT = 0100000,
|
||||
MMKA_NXM_STOP = 0200000,
|
||||
MMKA_PAR_STOP = 0400000,
|
||||
MMKA_SING_CYC = 01000000,
|
||||
MMKA_SING_INST = 02000000,
|
||||
/* lights */
|
||||
MMKA_MEM_STOP = 04000000,
|
||||
MMKA_USER = 010000000,
|
||||
MMKA_PROG_STOP = 020000000,
|
||||
MMKA_PWR_ON = 040000000,
|
||||
MMKA_RUN = 0100000000,
|
||||
|
||||
/* Maintenance switches */
|
||||
REG_MAINT_DN = 2,
|
||||
REG_MAINT_UP = 3,
|
||||
MMKA_RDI_SEL = 0177,
|
||||
MMKA_MI_PROG_DIS = 0200,
|
||||
MMKA_RPT_BYPASS = 0400,
|
||||
MMKA_FM_EN = 01000,
|
||||
MMKA_SC_STOP = 02000,
|
||||
|
||||
/* switches and knobs */
|
||||
REG_DSLT = 4,
|
||||
REG_DSRT = 5,
|
||||
REG_AS = 6,
|
||||
REG_REPEAT = 7,
|
||||
|
||||
/* lights */
|
||||
REG_IR = 010,
|
||||
REG_MILT = 011,
|
||||
REG_MIRT = 012,
|
||||
REG_PC = 013,
|
||||
REG_MA = 014,
|
||||
REG_PI = 015,
|
||||
|
||||
REG_ARLT = 016,
|
||||
REG_ARRT = 017,
|
||||
REG_BRLT = 020,
|
||||
REG_BRRT = 021,
|
||||
REG_MQLT = 022,
|
||||
REG_MQRT = 023,
|
||||
REG_ADLT = 024,
|
||||
REG_ADRT = 025,
|
||||
REG_SC_FE = 026,
|
||||
REG_SCAD = 027,
|
||||
REG_KEY_OPR = 030,
|
||||
REG_F_S_FMA = 031,
|
||||
REG_PR_RL = 032,
|
||||
REG_RLA_MEM = 033,
|
||||
REG_CPA_MISC = 034,
|
||||
REG_REST = 035,
|
||||
|
||||
REG_TTY = 040,
|
||||
REG_PTP = 041,
|
||||
REG_PTR = 042,
|
||||
REG_PTR_LT = 043,
|
||||
REG_PTR_RT = 044,
|
||||
};
|
||||
|
||||
enum {
|
||||
FEREG_REQ = 0,
|
||||
FEREG_PTR,
|
||||
FEREG_PTP
|
||||
};
|
||||
|
||||
|
||||
static u64 *h2f_base;
|
||||
static u32 *virtual_base;
|
||||
static u32 *getLWH2Faddr(u32 offset)
|
||||
{
|
||||
return (u32*)((u32)virtual_base - PERIPH_BASE + (LWH2F_BASE+offset));
|
||||
}
|
||||
static u64 *getH2Faddr(u32 offset)
|
||||
{
|
||||
return (u64*)((u32)h2f_base + offset);
|
||||
}
|
||||
|
||||
static int memfd;
|
||||
static volatile u32 *h2f_cmemif;
|
||||
static volatile u32 *h2f_fmemif;
|
||||
static volatile u32 *h2f_apr;
|
||||
static volatile u32 *h2f_fe;
|
||||
|
||||
void
|
||||
deposit(hword a, word w)
|
||||
{
|
||||
if(a < 020){
|
||||
h2f_fmemif[0] = a & 017;
|
||||
h2f_fmemif[1] = w & RT;
|
||||
h2f_fmemif[2] = (w >> 18) & RT;
|
||||
}else if(a < 01000020){
|
||||
h2f_cmemif[0] = a & RT;
|
||||
h2f_cmemif[1] = w & RT;
|
||||
h2f_cmemif[2] = (w >> 18) & RT;
|
||||
}else switch(a){
|
||||
case APR_DS:
|
||||
h2f_apr[REG_DSLT] = w>>18 & RT;
|
||||
h2f_apr[REG_DSRT] = w & RT;
|
||||
break;
|
||||
case APR_AS:
|
||||
h2f_apr[REG_AS] = w & RT;
|
||||
break;
|
||||
case APR_RPT:
|
||||
h2f_apr[REG_REPEAT] = w;
|
||||
break;
|
||||
|
||||
#ifdef TEST
|
||||
case APR_SW_DN:
|
||||
h2f_apr[REG_SW_DN] = w;
|
||||
break;
|
||||
case APR_SW_UP:
|
||||
h2f_apr[REG_SW_UP] = w;
|
||||
break;
|
||||
case APR_MAINT_DN:
|
||||
h2f_apr[REG_MAINT_DN] = w;
|
||||
break;
|
||||
case APR_MAINT_UP:
|
||||
h2f_apr[REG_MAINT_UP] = w;
|
||||
break;
|
||||
|
||||
case PTR_FE:
|
||||
h2f_fe[FEREG_PTR] = w;
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
word
|
||||
examine(hword a)
|
||||
{
|
||||
u64 w;
|
||||
w = 0;
|
||||
|
||||
if(a < 020){
|
||||
h2f_fmemif[0] = a & 017;
|
||||
w = h2f_fmemif[2] & RT;
|
||||
w <<= 18;
|
||||
w |= h2f_fmemif[1] & RT;
|
||||
}else if(a < 01000020){
|
||||
h2f_cmemif[0] = a & RT;
|
||||
w = h2f_cmemif[2] & RT;
|
||||
w <<= 18;
|
||||
w |= h2f_cmemif[1] & RT;
|
||||
}else switch(a){
|
||||
case APR_DS:
|
||||
w = h2f_apr[REG_DSLT] & RT;
|
||||
w <<= 18;
|
||||
w |= h2f_apr[REG_DSRT] & RT;
|
||||
return w;
|
||||
case APR_AS:
|
||||
w = h2f_apr[REG_AS];
|
||||
break;
|
||||
case APR_RPT:
|
||||
w = h2f_apr[REG_REPEAT];
|
||||
break;
|
||||
|
||||
case APR_IR:
|
||||
return h2f_apr[REG_IR] & RT;
|
||||
case APR_MI:
|
||||
w = h2f_apr[REG_MILT] & RT;
|
||||
w <<= 18;
|
||||
w |= h2f_apr[REG_MIRT] & RT;
|
||||
return w;
|
||||
case APR_PC:
|
||||
return h2f_apr[REG_PC];
|
||||
case APR_MA:
|
||||
return h2f_apr[REG_MA];
|
||||
case APR_PIO:
|
||||
return h2f_apr[REG_PI]>>1 & 0177;
|
||||
case APR_PIR:
|
||||
return h2f_apr[REG_PI]>>8 & 0177;
|
||||
case APR_PIH:
|
||||
return h2f_apr[REG_PI]>>15 & 0177;
|
||||
case APR_PION:
|
||||
return h2f_apr[REG_PI] & 1;
|
||||
|
||||
case APR_RUN:
|
||||
return !!(h2f_apr[REG_SW_DN] & MMKA_RUN);
|
||||
case APR_STOP:
|
||||
return !!(h2f_apr[REG_SW_DN] & MMKA_MEM_STOP);
|
||||
|
||||
#ifdef TEST
|
||||
case APR_SW_DN:
|
||||
return h2f_apr[REG_SW_DN];
|
||||
case APR_SW_UP:
|
||||
return h2f_apr[REG_SW_UP];
|
||||
case APR_MAINT_DN:
|
||||
return h2f_apr[REG_MAINT_DN];
|
||||
case APR_MAINT_UP:
|
||||
return h2f_apr[REG_MAINT_UP];
|
||||
case APR_AR:
|
||||
w = h2f_apr[REG_ARLT] & RT;
|
||||
w <<= 18;
|
||||
w |= h2f_apr[REG_ARRT] & RT;
|
||||
return w;
|
||||
case APR_BR:
|
||||
w = h2f_apr[REG_BRLT] & RT;
|
||||
w <<= 18;
|
||||
w |= h2f_apr[REG_BRRT] & RT;
|
||||
return w;
|
||||
case APR_MQ:
|
||||
w = h2f_apr[REG_MQLT] & RT;
|
||||
w <<= 18;
|
||||
w |= h2f_apr[REG_MQRT] & RT;
|
||||
return w;
|
||||
case APR_AD:
|
||||
w = h2f_apr[REG_ADLT] & RT;
|
||||
w <<= 18;
|
||||
w |= h2f_apr[REG_ADRT] & RT;
|
||||
return w;
|
||||
|
||||
case TTY_TTI:
|
||||
return (h2f_apr[REG_TTY]>>9) & 0377;
|
||||
case TTY_ST:
|
||||
return h2f_apr[REG_TTY] & 0177;
|
||||
case PTR_PTR:
|
||||
w = h2f_apr[REG_PTR_LT];
|
||||
w <<= 18;
|
||||
w |= h2f_apr[REG_PTR_RT] & RT;
|
||||
return w;
|
||||
case PTR_ST:
|
||||
return h2f_apr[REG_PTR] & 0177;
|
||||
|
||||
case FE_REQ:
|
||||
return h2f_fe[FEREG_REQ];
|
||||
#endif
|
||||
}
|
||||
return w;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void set_ta(hword a)
|
||||
{
|
||||
h2f_apr[REG_AS] = a & RT;
|
||||
}
|
||||
|
||||
static void set_td(word d)
|
||||
{
|
||||
h2f_apr[REG_DSLT] = d>>18 & RT;
|
||||
h2f_apr[REG_DSRT] = d & RT;
|
||||
}
|
||||
|
||||
static void keydown(u32 k)
|
||||
{
|
||||
h2f_apr[REG_SW_DN] = k;
|
||||
// TODO: still needed with KA?
|
||||
if(k & MMKA_STOP)
|
||||
usleep(1000); // wait for AT INH to go down
|
||||
}
|
||||
|
||||
static void keyup(u32 k)
|
||||
{
|
||||
h2f_apr[REG_SW_UP] = k;
|
||||
}
|
||||
|
||||
static void keytoggle(u32 k) {
|
||||
keydown(k);
|
||||
usleep(1000); // TODO: maybe don't sleep? or different duration?
|
||||
keyup(k);
|
||||
}
|
||||
|
||||
int isrunning(void)
|
||||
{
|
||||
return !!(h2f_apr[REG_SW_DN] & MMKA_RUN);
|
||||
}
|
||||
int isstopped(void)
|
||||
{
|
||||
return !!(h2f_apr[REG_SW_DN] & MMKA_MEM_STOP);
|
||||
}
|
||||
|
||||
static void waithalt(void)
|
||||
{
|
||||
int i;
|
||||
for(i = 0; i < 10; i++){
|
||||
if(!isrunning())
|
||||
return;
|
||||
usleep(100);
|
||||
}
|
||||
keytoggle(MMKA_STOP);
|
||||
for(i = 0; i < 10; i++){
|
||||
if(!isrunning())
|
||||
return;
|
||||
usleep(100);
|
||||
}
|
||||
typestr("not halted!!!\r\n");
|
||||
}
|
||||
|
||||
static void waitmemstop(void)
|
||||
{
|
||||
int i;
|
||||
if(!isrunning())
|
||||
return;
|
||||
for(i = 0; i < 20; i++){
|
||||
if(isstopped())
|
||||
return;
|
||||
usleep(100);
|
||||
}
|
||||
typestr("not stopped!!!\r\n");
|
||||
}
|
||||
|
||||
static int run;
|
||||
static int memstop;
|
||||
#define X if(0)
|
||||
|
||||
void
|
||||
cpu_start(hword a)
|
||||
{
|
||||
X typestr("<GO>\r\n");
|
||||
|
||||
cpu_stopinst();
|
||||
X run = 0;
|
||||
keyup(MMKA_SING_INST | MMKA_ADR_STOP);
|
||||
set_ta(a);
|
||||
keytoggle(MMKA_START);
|
||||
X run = 1;
|
||||
X memstop = 0;
|
||||
}
|
||||
|
||||
void
|
||||
cpu_readin(hword a)
|
||||
{
|
||||
X typestr("<READIN>\r\n");
|
||||
|
||||
cpu_stopinst();
|
||||
X run = 0;
|
||||
keyup(MMKA_SING_INST | MMKA_ADR_STOP);
|
||||
h2f_apr[REG_MAINT_UP] = 0177;
|
||||
h2f_apr[REG_MAINT_DN] = a & 0177;
|
||||
keytoggle(MMKA_READIN);
|
||||
X run = 1;
|
||||
X memstop = 0;
|
||||
}
|
||||
|
||||
void
|
||||
cpu_setpc(hword a)
|
||||
{
|
||||
X typestr("<SETPC>\r\n");
|
||||
|
||||
cpu_stopinst();
|
||||
X run = 0;
|
||||
keydown(MMKA_SING_CYC);
|
||||
keyup(MMKA_ADR_STOP);
|
||||
set_ta(a);
|
||||
keytoggle(MMKA_START);
|
||||
X run = 1;
|
||||
X memstop = 0;
|
||||
waitmemstop();
|
||||
X memstop = 1;
|
||||
keyup(MMKA_SING_CYC);
|
||||
keytoggle(MMKA_STOP);
|
||||
X run = 0;
|
||||
keytoggle(MMKA_EX);
|
||||
usleep(1000);
|
||||
X memstop = 0;
|
||||
}
|
||||
|
||||
void
|
||||
cpu_stopinst(void)
|
||||
{
|
||||
X typestr("<STOPINST>\r\n");
|
||||
|
||||
if(!isrunning())
|
||||
return;
|
||||
// TODO: what if memory stop?
|
||||
keytoggle(MMKA_STOP);
|
||||
keydown(MMKA_SING_INST);
|
||||
waithalt();
|
||||
X run = 0;
|
||||
keyup(MMKA_SING_INST);
|
||||
}
|
||||
|
||||
void
|
||||
cpu_stopmem(void)
|
||||
{
|
||||
X typestr("<STOPMEM>\r\n");
|
||||
|
||||
if(!isrunning() || isstopped())
|
||||
return;
|
||||
keydown(MMKA_SING_CYC);
|
||||
waitmemstop();
|
||||
X memstop = 1;
|
||||
keyup(MMKA_SING_CYC);
|
||||
}
|
||||
|
||||
static void
|
||||
togglecont(void)
|
||||
{
|
||||
keytoggle(MMKA_CONT);
|
||||
}
|
||||
|
||||
void
|
||||
cpu_cont(void)
|
||||
{
|
||||
X typestr("<CONT>\r\n");
|
||||
|
||||
if(isrunning())
|
||||
return;
|
||||
keyup(MMKA_SING_CYC | MMKA_SING_INST | MMKA_ADR_STOP);
|
||||
togglecont();
|
||||
}
|
||||
|
||||
void
|
||||
cpu_nextinst(void)
|
||||
{
|
||||
X typestr("<NEXTINST>\r\n");
|
||||
|
||||
if(isrunning() && !isstopped())
|
||||
err("?R? ");
|
||||
keydown(MMKA_SING_INST);
|
||||
X run = 0;
|
||||
togglecont();
|
||||
waithalt();
|
||||
X run = 0;
|
||||
keyup(MMKA_SING_INST);
|
||||
}
|
||||
|
||||
void
|
||||
cpu_nextmem(void)
|
||||
{
|
||||
X typestr("<NEXTMEM>\r\n");
|
||||
|
||||
if(isrunning() && !isstopped())
|
||||
err("?R? ");
|
||||
keydown(MMKA_SING_CYC);
|
||||
togglecont();
|
||||
waitmemstop();
|
||||
X memstop = 1;
|
||||
keyup(MMKA_SING_CYC);
|
||||
}
|
||||
|
||||
void
|
||||
cpu_exec(word inst)
|
||||
{
|
||||
X typestr("<EXEC>\r\n");
|
||||
|
||||
if(isrunning())
|
||||
err("?R? ");
|
||||
set_td(inst);
|
||||
keytoggle(MMKA_XCT);
|
||||
}
|
||||
|
||||
void
|
||||
cpu_ioreset(void)
|
||||
{
|
||||
X typestr("<RESET>\r\n");
|
||||
|
||||
if(isrunning())
|
||||
err("?R? ");
|
||||
keytoggle(MMKA_RESET);
|
||||
typestr("\r\n");
|
||||
}
|
||||
|
||||
void
|
||||
cpu_printflags(void)
|
||||
{
|
||||
static const char *l = ".#";
|
||||
u32 ctl, pi;
|
||||
u32 sc_fe, scad, key_opr, f_s_fma, pr_rl, rla_mem, cpa_misc, rest;
|
||||
|
||||
ctl = h2f_apr[REG_SW_DN];
|
||||
pi = h2f_apr[REG_PI];
|
||||
sc_fe = h2f_apr[REG_SC_FE];
|
||||
scad = h2f_apr[REG_SCAD];
|
||||
key_opr = h2f_apr[REG_KEY_OPR];
|
||||
f_s_fma = h2f_apr[REG_F_S_FMA];
|
||||
pr_rl = h2f_apr[REG_PR_RL];
|
||||
rla_mem = h2f_apr[REG_RLA_MEM];
|
||||
cpa_misc = h2f_apr[REG_CPA_MISC];
|
||||
rest = h2f_apr[REG_REST];
|
||||
|
||||
printf("\r\n");
|
||||
printf("FE %03o SC %03o STOP %c\r\n", sc_fe&0777, sc_fe>>9&0777,
|
||||
l[!!(sc_fe & 01000000)]);
|
||||
printf("SCAD %03o\r\n", scad&0777);
|
||||
|
||||
printf("KEY F1 %c SYNC RQ %c SYNC %c RSET %c\r\n"
|
||||
" EXAM %c EX NXT %c DEP %c DEP NXT %c\r\n"
|
||||
" RDI %c STRT %c EXE %c CONT %c\r\n",
|
||||
l[!!(key_opr&040000000)],
|
||||
l[!!(key_opr&020000000)],
|
||||
l[!!(key_opr&010000000)],
|
||||
l[!!(key_opr&04000000)],
|
||||
l[!!(key_opr&02000000)],
|
||||
l[!!(key_opr&01000000)],
|
||||
l[!!(key_opr&0400000)],
|
||||
l[!!(key_opr&0200000)],
|
||||
l[!!(key_opr&0100000)],
|
||||
l[!!(key_opr&040000)],
|
||||
l[!!(key_opr&020000)],
|
||||
l[!!(key_opr&010000)]);
|
||||
|
||||
printf("OPR IF0 %c AF2 %c FF1 %c FF2 %c FF4 %c\r\n"
|
||||
" E UUOF %c E XCTF %c E LONG %c EF0 LONG %c\r\n"
|
||||
" SF1 %c SF6 %c SF8 %c\r\n",
|
||||
l[!!(key_opr&04000)],
|
||||
l[!!(key_opr&02000)],
|
||||
l[!!(key_opr&01000)],
|
||||
l[!!(key_opr&0400)],
|
||||
l[!!(key_opr&0200)],
|
||||
l[!!(key_opr&0100)],
|
||||
l[!!(key_opr&040)],
|
||||
l[!!(key_opr&020)],
|
||||
l[!!(key_opr&010)],
|
||||
l[!!(key_opr&04)],
|
||||
l[!!(key_opr&02)],
|
||||
l[!!(key_opr&01)]);
|
||||
|
||||
printf("FETCH FCE %c FCE PSE %c FAC INH %c FAC2 %c"
|
||||
" FCC ACLT %c FCC ACRT\r\n",
|
||||
l[!!(f_s_fma&040000)],
|
||||
l[!!(f_s_fma&020000)],
|
||||
l[!!(f_s_fma&010000)],
|
||||
l[!!(f_s_fma&04000)],
|
||||
l[!!(f_s_fma&02000)],
|
||||
l[!!(f_s_fma&01000)]);
|
||||
|
||||
printf("STORE SCE %c ST INH %c SAC2 %c SAC INH %c SAC=0 %c\r\n",
|
||||
l[!!(f_s_fma&0400)],
|
||||
l[!!(f_s_fma&0200)],
|
||||
l[!!(f_s_fma&0100)],
|
||||
l[!!(f_s_fma&040)],
|
||||
l[!!(f_s_fma&020)]);
|
||||
|
||||
printf("FMA %02o\r\n", f_s_fma & 017);
|
||||
|
||||
printf("PR RL %o\r\n", pr_rl);
|
||||
|
||||
printf("RLA %03o RLC %03o\r\n", rla_mem<<1 & 0776, rla_mem>>7 & 0776);
|
||||
printf("MEM MC RQ %c MC RD %c MC WR %c REQ CYC %c SPLIT SYNC %c\r\n"
|
||||
" FM EN %c FMA SEL %c FMA AC %c FMA AC2 %c FMA XR %c\r\n",
|
||||
l[!!(rla_mem&0200000000)],
|
||||
l[!!(rla_mem&0100000000)],
|
||||
l[!!(rla_mem&040000000)],
|
||||
l[!!(rla_mem&020000000)],
|
||||
l[!!(rla_mem&010000000)],
|
||||
l[!!(rla_mem&04000000)],
|
||||
l[!!(rla_mem&02000000)],
|
||||
l[!!(rla_mem&01000000)],
|
||||
l[!!(rla_mem&0400000)],
|
||||
l[!!(rla_mem&0200000)]);
|
||||
|
||||
printf("CPA PWR %c ADR BRK %c PAR ERR %c PAR EN %c PDL OV %c MEM PROT %c\r\n"
|
||||
" NXM FLAG %c CLK EN %c CLK FLAG %c FOV EN %c AROV EN %c\r\n"
|
||||
" PIA %o\r\n",
|
||||
l[!!(cpa_misc&020000)],
|
||||
l[!!(cpa_misc&010000)],
|
||||
l[!!(cpa_misc&04000)],
|
||||
l[!!(cpa_misc&02000)],
|
||||
l[!!(cpa_misc&01000)],
|
||||
l[!!(cpa_misc&0400)],
|
||||
l[!!(cpa_misc&0200)],
|
||||
l[!!(cpa_misc&0100)],
|
||||
l[!!(cpa_misc&040)],
|
||||
l[!!(cpa_misc&020)],
|
||||
l[!!(cpa_misc&010)],
|
||||
cpa_misc&07);
|
||||
|
||||
printf("MISC %o\r\n", cpa_misc>>14);
|
||||
|
||||
printf("EX ILL OP %c PI SYNC %c MODE SYNC %c IOT USER %c REL %c\r\n",
|
||||
l[!!(rest&020000)],
|
||||
l[!!(rest&010000)],
|
||||
l[!!(rest&04000)],
|
||||
l[!!(rest&02000)],
|
||||
l[!!(rest&01000)]);
|
||||
printf("PI OV %c CYC %c\r\n",
|
||||
l[!!(rest&0400)],
|
||||
l[!!(rest&0200)]);
|
||||
printf("BYTE LOAD %c DEP %c\r\n",
|
||||
l[!!(rest&0100)],
|
||||
l[!!(rest&040)]);
|
||||
printf("NR SHRT COND %c NOR %c RND %c\r\n",
|
||||
l[!!(rest&020)],
|
||||
l[!!(rest&010)],
|
||||
l[!!(rest&04)]);
|
||||
printf("AS= RLA %c FMA %c\r\n",
|
||||
l[!!(rest&02)],
|
||||
l[!!(rest&01)]);
|
||||
|
||||
printf("PIH/%03o PIR/%03o PIO/%03o PI ACTIVE/%o\r\n",
|
||||
pi>>15 & 0177, pi>>8 & 0177, pi>>1 & 0177, !!(pi & 1));
|
||||
printf("PWR %c RUN %c MCSTOP %c PROGSTOP %c USER %c\r\n",
|
||||
l[!!(ctl&MMKA_PWR_ON)],
|
||||
l[!!(ctl&MMKA_RUN)],
|
||||
l[!!(ctl&MMKA_MEM_STOP)],
|
||||
l[!!(ctl&MMKA_PROG_STOP)],
|
||||
l[!!(ctl&MMKA_USER)]);
|
||||
fflush(stdout);
|
||||
}
|
||||
|
||||
static void
|
||||
svc_ptr(void)
|
||||
{
|
||||
int fd;
|
||||
u8 c;
|
||||
|
||||
fd = devtab[DEV_PTR].fd;
|
||||
if(fd < 0)
|
||||
return;
|
||||
if(read(fd, &c, 1) == 1){
|
||||
printf("%d%d%d%d%d%d%d%d -> PTR\r\n",
|
||||
!!(c&0200), !!(c&0100), !!(c&040), !!(c&020), !!(c&010),
|
||||
!!(c&04), !!(c&02), !!(c&01));
|
||||
fflush(stdout);
|
||||
h2f_fe[FEREG_PTR] = c;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
svc_ptp(void)
|
||||
{
|
||||
int fd;
|
||||
u8 c;
|
||||
|
||||
c = h2f_fe[FEREG_PTP];
|
||||
printf("PTP <- %d%d%d%d%d%d%d%d\r\n",
|
||||
!!(c&0200), !!(c&0100), !!(c&040), !!(c&020), !!(c&010),
|
||||
!!(c&04), !!(c&02), !!(c&01));
|
||||
fflush(stdout);
|
||||
|
||||
fd = devtab[DEV_PTP].fd;
|
||||
if(fd < 0)
|
||||
return;
|
||||
write(fd, &c, 1);
|
||||
}
|
||||
|
||||
void
|
||||
fe_svc(void)
|
||||
{
|
||||
u32 req;
|
||||
|
||||
req = h2f_fe[FEREG_REQ];
|
||||
|
||||
if(req & 1) svc_ptr();
|
||||
if(req & 2) svc_ptp();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
init6(void)
|
||||
{
|
||||
if((memfd = open("/dev/mem", (O_RDWR | O_SYNC))) == -1) {
|
||||
fprintf(stderr, "ERROR: could not open /dev/mem...\n");
|
||||
exit(1);
|
||||
}
|
||||
virtual_base = (u32*)mmap(nil, PERIPH_SPAN,
|
||||
(PROT_READ | PROT_WRITE), MAP_SHARED, memfd, PERIPH_BASE);
|
||||
if(virtual_base == MAP_FAILED) {
|
||||
fprintf(stderr, "ERROR: mmap() failed...\n");
|
||||
close(memfd);
|
||||
exit(1);
|
||||
}
|
||||
h2f_base = (u64*)mmap(nil, 0x100000,
|
||||
(PROT_READ | PROT_WRITE), MAP_SHARED, memfd, H2F_BASE);
|
||||
if(h2f_base == MAP_FAILED) {
|
||||
fprintf(stderr, "ERROR: mmap() failed...\n");
|
||||
close(memfd);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
h2f_cmemif = getLWH2Faddr(0x10000);
|
||||
h2f_fmemif = getLWH2Faddr(0x10010);
|
||||
h2f_apr = getLWH2Faddr(0x10100);
|
||||
h2f_fe = getLWH2Faddr(0x20000);
|
||||
}
|
||||
|
||||
void
|
||||
deinit6(void)
|
||||
{
|
||||
if(munmap(virtual_base, PERIPH_SPAN) != 0) {
|
||||
fprintf(stderr, "ERROR: munmap() failed...\n");
|
||||
close(memfd);
|
||||
exit(1);
|
||||
}
|
||||
close(memfd);
|
||||
}
|
||||
33
fe6/ka/regs.h
Normal file
33
fe6/ka/regs.h
Normal file
@ -0,0 +1,33 @@
|
||||
#define PDP_REGS \
|
||||
X("DS", APR_DS)\
|
||||
X("AS", APR_AS)\
|
||||
X("RPT", APR_RPT)\
|
||||
X("IR", APR_IR)\
|
||||
X("MI", APR_MI)\
|
||||
X("PC", APR_PC)\
|
||||
X("MA", APR_MA)\
|
||||
X("PIH", APR_PIH)\
|
||||
X("PIR", APR_PIR)\
|
||||
X("PIO", APR_PIO)\
|
||||
X("RUN", APR_RUN)\
|
||||
X("PION", APR_PION)\
|
||||
X("STOP", APR_STOP)
|
||||
#ifdef TEST
|
||||
#define PDP_REGS_TEST \
|
||||
X("SW", APR_SW_DN)\
|
||||
X("SWU", APR_SW_UP)\
|
||||
X("MAINT", APR_MAINT_DN)\
|
||||
X("MAINTU", APR_MAINT_UP)\
|
||||
X("AR", APR_AR)\
|
||||
X("BR", APR_BR)\
|
||||
X("MQ", APR_MQ)\
|
||||
X("AD", APR_AD)\
|
||||
X("TTY.TTI", TTY_TTI)\
|
||||
X("TTY.ST", TTY_ST)\
|
||||
X("PTR.PTR", PTR_PTR)\
|
||||
X("PTR.ST", PTR_ST)\
|
||||
X("PTR.FE", PTR_FE)\
|
||||
X("FE.REQ", FE_REQ)
|
||||
#else
|
||||
#define PDP_REGS_TEST
|
||||
#endif
|
||||
@ -77,10 +77,10 @@ module apr(
|
||||
output wire [0:7] ff13,
|
||||
|
||||
// membus
|
||||
output wire membus_wr_rs,
|
||||
output wire membus_rq_cyc,
|
||||
output wire membus_rd_rq,
|
||||
output wire membus_wr_rq,
|
||||
output wire membus_rq_cyc,
|
||||
output wire membus_wr_rs,
|
||||
output wire [21:35] membus_ma,
|
||||
output wire [18:21] membus_sel,
|
||||
output wire membus_fmc_select,
|
||||
@ -98,10 +98,13 @@ module apr(
|
||||
output wire iobus_cono_set,
|
||||
output wire iobus_iob_fm_datai,
|
||||
output wire iobus_iob_fm_status,
|
||||
output wire iobus_rdi_pulse, // unused on 6
|
||||
output wire [3:9] iobus_ios,
|
||||
output wire [0:35] iobus_iob_out,
|
||||
input wire [1:7] iobus_pi_req,
|
||||
input wire [0:35] iobus_iob_in
|
||||
input wire [0:35] iobus_iob_in,
|
||||
input wire iobus_dr_split,
|
||||
input wire iobus_rdi_data // unused on 6
|
||||
);
|
||||
|
||||
`ifdef simulation
|
||||
@ -111,6 +114,7 @@ module apr(
|
||||
`endif
|
||||
wire rst = reset | ~sw_power;
|
||||
|
||||
assign iobus_rdi_pulse = 0;
|
||||
|
||||
assign ff0 = { key_ex_st, key_ex_sync, key_dep_st, key_dep_sync, key_rdwr, mc_rd, mc_wr, mc_rq };
|
||||
assign ff1 = { if1a, af0, af3, af3a, et4_ar_pse, f1a, f4a, f6a };
|
||||
@ -2846,7 +2850,7 @@ module apr(
|
||||
// reg mc_stop;
|
||||
reg mc_stop_sync;
|
||||
reg mc_split_cyc_sync;
|
||||
wire mc_dr_split = 0; // we don't support drums right now
|
||||
wire mc_dr_split = iobus_dr_split;
|
||||
wire mc_sw_stop = key_mem_stop | sw_addr_stop | mc_dr_split;
|
||||
wire mc_rd_rq_pulse;
|
||||
wire mc_wr_rq_pulse;
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
|
||||
module dly50ns(input clk, input reset, input in, output p);
|
||||
reg [2-1:0] r;
|
||||
always @(posedge clk or posedge reset) begin
|
||||
@ -13,6 +14,7 @@ module dly50ns(input clk, input reset, input in, output p);
|
||||
assign p = r == 2;
|
||||
endmodule
|
||||
|
||||
|
||||
module dly70ns(input clk, input reset, input in, output p);
|
||||
reg [2-1:0] r;
|
||||
always @(posedge clk or posedge reset) begin
|
||||
@ -28,6 +30,7 @@ module dly70ns(input clk, input reset, input in, output p);
|
||||
assign p = r == 3;
|
||||
endmodule
|
||||
|
||||
|
||||
module dly100ns(input clk, input reset, input in, output p);
|
||||
reg [3-1:0] r;
|
||||
always @(posedge clk or posedge reset) begin
|
||||
@ -43,6 +46,7 @@ module dly100ns(input clk, input reset, input in, output p);
|
||||
assign p = r == 5;
|
||||
endmodule
|
||||
|
||||
|
||||
module dly150ns(input clk, input reset, input in, output p);
|
||||
reg [3-1:0] r;
|
||||
always @(posedge clk or posedge reset) begin
|
||||
@ -58,6 +62,7 @@ module dly150ns(input clk, input reset, input in, output p);
|
||||
assign p = r == 7;
|
||||
endmodule
|
||||
|
||||
|
||||
module dly200ns(input clk, input reset, input in, output p);
|
||||
reg [4-1:0] r;
|
||||
always @(posedge clk or posedge reset) begin
|
||||
@ -73,6 +78,7 @@ module dly200ns(input clk, input reset, input in, output p);
|
||||
assign p = r == 10;
|
||||
endmodule
|
||||
|
||||
|
||||
module dly250ns(input clk, input reset, input in, output p);
|
||||
reg [4-1:0] r;
|
||||
always @(posedge clk or posedge reset) begin
|
||||
@ -88,6 +94,7 @@ module dly250ns(input clk, input reset, input in, output p);
|
||||
assign p = r == 12;
|
||||
endmodule
|
||||
|
||||
|
||||
module dly300ns(input clk, input reset, input in, output p);
|
||||
reg [4-1:0] r;
|
||||
always @(posedge clk or posedge reset) begin
|
||||
@ -103,6 +110,7 @@ module dly300ns(input clk, input reset, input in, output p);
|
||||
assign p = r == 15;
|
||||
endmodule
|
||||
|
||||
|
||||
module dly400ns(input clk, input reset, input in, output p);
|
||||
reg [5-1:0] r;
|
||||
always @(posedge clk or posedge reset) begin
|
||||
@ -118,6 +126,7 @@ module dly400ns(input clk, input reset, input in, output p);
|
||||
assign p = r == 20;
|
||||
endmodule
|
||||
|
||||
|
||||
module dly450ns(input clk, input reset, input in, output p);
|
||||
reg [5-1:0] r;
|
||||
always @(posedge clk or posedge reset) begin
|
||||
@ -133,6 +142,7 @@ module dly450ns(input clk, input reset, input in, output p);
|
||||
assign p = r == 22;
|
||||
endmodule
|
||||
|
||||
|
||||
module dly550ns(input clk, input reset, input in, output p);
|
||||
reg [5-1:0] r;
|
||||
always @(posedge clk or posedge reset) begin
|
||||
@ -148,6 +158,7 @@ module dly550ns(input clk, input reset, input in, output p);
|
||||
assign p = r == 27;
|
||||
endmodule
|
||||
|
||||
|
||||
module dly750ns(input clk, input reset, input in, output p);
|
||||
reg [6-1:0] r;
|
||||
always @(posedge clk or posedge reset) begin
|
||||
@ -163,6 +174,7 @@ module dly750ns(input clk, input reset, input in, output p);
|
||||
assign p = r == 37;
|
||||
endmodule
|
||||
|
||||
|
||||
module dly800ns(input clk, input reset, input in, output p);
|
||||
reg [6-1:0] r;
|
||||
always @(posedge clk or posedge reset) begin
|
||||
|
||||
@ -4,101 +4,6 @@ from math import *
|
||||
# delays are rounded down
|
||||
clock=20 # cycle time of clock in ns
|
||||
|
||||
nsdly="""module dly{ns}ns(input clk, input reset, input in, output p);
|
||||
reg [{width}-1:0] r;
|
||||
always @(posedge clk or posedge reset) begin
|
||||
if(reset)
|
||||
r <= 0;
|
||||
else begin
|
||||
if(r)
|
||||
r <= r + {width}'b1;
|
||||
if(in)
|
||||
r <= 1;
|
||||
end
|
||||
end
|
||||
assign p = r == {n};
|
||||
endmodule
|
||||
"""
|
||||
|
||||
def gendlyns(ns):
|
||||
n = ns//clock
|
||||
nb = ceil(log(n+1,2))
|
||||
print(nsdly.format(ns=ns, width=nb, n=n))
|
||||
|
||||
gendlyns(50)
|
||||
gendlyns(70)
|
||||
gendlyns(100)
|
||||
gendlyns(150)
|
||||
gendlyns(200)
|
||||
gendlyns(250)
|
||||
gendlyns(300)
|
||||
gendlyns(400)
|
||||
gendlyns(450)
|
||||
gendlyns(550)
|
||||
gendlyns(750)
|
||||
gendlyns(800)
|
||||
|
||||
|
||||
usdly="""
|
||||
module dly{us}us(input clk, input reset, input in, output p);
|
||||
reg [{width}-1:0] r;
|
||||
always @(posedge clk or posedge reset) begin
|
||||
if(reset)
|
||||
r <= 0;
|
||||
else begin
|
||||
if(r)
|
||||
r <= r + {width}'b1;
|
||||
if(in)
|
||||
r <= 1;
|
||||
end
|
||||
end
|
||||
assign p = r == {n};
|
||||
endmodule
|
||||
"""
|
||||
|
||||
usldly="""
|
||||
module ldly{us}us(input clk, input reset, input in, output p, output reg l);
|
||||
reg [{width}-1:0] r;
|
||||
always @(posedge clk or posedge reset) begin
|
||||
if(reset) begin
|
||||
r <= 0;
|
||||
l <= 0;
|
||||
end else begin
|
||||
if(r)
|
||||
r <= r + {width}'b1;
|
||||
if(in) begin
|
||||
r <= 1;
|
||||
l <= 1;
|
||||
end
|
||||
if(p) begin
|
||||
r <= 0;
|
||||
l <= 0;
|
||||
end
|
||||
end
|
||||
end
|
||||
assign p = r == {n};
|
||||
endmodule
|
||||
"""
|
||||
|
||||
def genldlyus(us):
|
||||
s = str(us).replace('.', '_')
|
||||
n = int(us*1000//clock)
|
||||
nb = ceil(log(n+1,2))
|
||||
print(usldly.format(us=s, width=nb, n=n))
|
||||
|
||||
def gendlyus(us):
|
||||
s = str(us).replace('.', '_')
|
||||
n = int(us*1000//clock)
|
||||
nb = ceil(log(n+1,2))
|
||||
print(usdly.format(us=s, width=nb, n=n))
|
||||
|
||||
gendlyus(1)
|
||||
genldlyus(1)
|
||||
genldlyus(1.5)
|
||||
genldlyus(2)
|
||||
gendlyus(100)
|
||||
genldlyus(100)
|
||||
|
||||
|
||||
dly="""
|
||||
module dly{type}(input clk, input reset, input in, output p);
|
||||
@ -141,6 +46,24 @@ module ldly{type}(input clk, input reset, input in, output p, output reg l);
|
||||
endmodule
|
||||
"""
|
||||
|
||||
def gendlyns(ns):
|
||||
t = str(ns).replace('.', '_')
|
||||
n = int(ns//clock)
|
||||
nb = ceil(log(n+1,2))
|
||||
print(dly.format(type='%sns' % t, width=nb, n=n))
|
||||
|
||||
def gendlyus(us):
|
||||
t = str(us).replace('.', '_')
|
||||
n = int(us*1000//clock)
|
||||
nb = ceil(log(n+1,2))
|
||||
print(dly.format(type='%sus' % t, width=nb, n=n))
|
||||
|
||||
def genldlyus(us):
|
||||
t = str(us).replace('.', '_')
|
||||
n = int(us*1000//clock)
|
||||
nb = ceil(log(n+1,2))
|
||||
print(ldly.format(type='%sus' % t, width=nb, n=n))
|
||||
|
||||
def gendlyms(ms):
|
||||
t = str(ms).replace('.', '_')
|
||||
n = int(ms*1000*1000//clock)
|
||||
@ -160,10 +83,34 @@ def genldlys(s):
|
||||
print(ldly.format(type='%ss' % t, width=nb, n=n))
|
||||
|
||||
|
||||
|
||||
gendlyns(50)
|
||||
gendlyns(70)
|
||||
gendlyns(100)
|
||||
gendlyns(150)
|
||||
gendlyns(200)
|
||||
gendlyns(250)
|
||||
gendlyns(300)
|
||||
gendlyns(400)
|
||||
gendlyns(450)
|
||||
gendlyns(550)
|
||||
gendlyns(750)
|
||||
gendlyns(800)
|
||||
|
||||
|
||||
gendlyus(1)
|
||||
genldlyus(1)
|
||||
genldlyus(1.5)
|
||||
genldlyus(2)
|
||||
gendlyus(100)
|
||||
genldlyus(100)
|
||||
|
||||
|
||||
gendlyms(2.1)
|
||||
gendlyms(2.5)
|
||||
gendlyms(5)
|
||||
genldlyms(5)
|
||||
|
||||
|
||||
genldlys(1)
|
||||
genldlys(5)
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
// AUTOGEN
|
||||
module iobus_0_connect(
|
||||
// unused
|
||||
input wire clk,
|
||||
@ -12,11 +13,17 @@ module iobus_0_connect(
|
||||
input wire m_cono_set,
|
||||
input wire m_iob_fm_datai,
|
||||
input wire m_iob_fm_status,
|
||||
input wire [3:9] m_ios,
|
||||
input wire [0:35] m_iob_out,
|
||||
output wire [1:7] m_pi_req,
|
||||
output wire [0:35] m_iob_in
|
||||
input wire m_rdi_pulse,
|
||||
input wire [3:9] m_ios,
|
||||
input wire [0:35] m_iob_write,
|
||||
output wire [1:7] m_pi_req,
|
||||
output wire [0:35] m_iob_read,
|
||||
output wire m_dr_split,
|
||||
output wire m_rdi_data
|
||||
);
|
||||
assign m_pi_req = 0;
|
||||
assign m_iob_in = m_iob_out;
|
||||
assign m_iob_read = m_iob_write;
|
||||
assign m_dr_split = 0;
|
||||
assign m_rdi_data = 0;
|
||||
|
||||
endmodule
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
// AUTOGEN
|
||||
module iobus_1_connect(
|
||||
// unused
|
||||
input wire clk,
|
||||
@ -12,10 +13,13 @@ module iobus_1_connect(
|
||||
input wire m_cono_set,
|
||||
input wire m_iob_fm_datai,
|
||||
input wire m_iob_fm_status,
|
||||
input wire m_rdi_pulse,
|
||||
input wire [3:9] m_ios,
|
||||
input wire [0:35] m_iob_write,
|
||||
output wire [1:7] m_pi_req,
|
||||
output wire [0:35] m_iob_read,
|
||||
output wire m_dr_split,
|
||||
output wire m_rdi_data,
|
||||
|
||||
// Slave 0
|
||||
output wire s0_iob_poweron,
|
||||
@ -26,13 +30,19 @@ module iobus_1_connect(
|
||||
output wire s0_cono_set,
|
||||
output wire s0_iob_fm_datai,
|
||||
output wire s0_iob_fm_status,
|
||||
output wire s0_rdi_pulse,
|
||||
output wire [3:9] s0_ios,
|
||||
output wire [0:35] s0_iob_write,
|
||||
input wire [1:7] s0_pi_req,
|
||||
input wire [0:35] s0_iob_read
|
||||
input wire [0:35] s0_iob_read,
|
||||
input wire s0_dr_split,
|
||||
input wire s0_rdi_data
|
||||
);
|
||||
assign m_pi_req = s0_pi_req;
|
||||
assign m_pi_req = 0 | s0_pi_req;
|
||||
assign m_iob_read = m_iob_write | s0_iob_read;
|
||||
assign m_dr_split = 0 | s0_dr_split;
|
||||
assign m_rdi_data = 0 | s0_rdi_data;
|
||||
|
||||
|
||||
assign s0_iob_poweron = m_iob_poweron;
|
||||
assign s0_iob_reset = m_iob_reset;
|
||||
@ -42,6 +52,7 @@ module iobus_1_connect(
|
||||
assign s0_cono_set = m_cono_set;
|
||||
assign s0_iob_fm_datai = m_iob_fm_datai;
|
||||
assign s0_iob_fm_status = m_iob_fm_status;
|
||||
assign s0_rdi_pulse = m_rdi_pulse;
|
||||
assign s0_ios = m_ios;
|
||||
assign s0_iob_write = m_iob_write;
|
||||
endmodule
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
// AUTOGEN
|
||||
module iobus_2_connect(
|
||||
// unused
|
||||
input wire clk,
|
||||
@ -12,10 +13,13 @@ module iobus_2_connect(
|
||||
input wire m_cono_set,
|
||||
input wire m_iob_fm_datai,
|
||||
input wire m_iob_fm_status,
|
||||
input wire m_rdi_pulse,
|
||||
input wire [3:9] m_ios,
|
||||
input wire [0:35] m_iob_write,
|
||||
output wire [1:7] m_pi_req,
|
||||
output wire [0:35] m_iob_read,
|
||||
output wire m_dr_split,
|
||||
output wire m_rdi_data,
|
||||
|
||||
// Slave 0
|
||||
output wire s0_iob_poweron,
|
||||
@ -26,12 +30,15 @@ module iobus_2_connect(
|
||||
output wire s0_cono_set,
|
||||
output wire s0_iob_fm_datai,
|
||||
output wire s0_iob_fm_status,
|
||||
output wire s0_rdi_pulse,
|
||||
output wire [3:9] s0_ios,
|
||||
output wire [0:35] s0_iob_write,
|
||||
input wire [1:7] s0_pi_req,
|
||||
input wire [0:35] s0_iob_read,
|
||||
input wire s0_dr_split,
|
||||
input wire s0_rdi_data,
|
||||
|
||||
// Slave
|
||||
// Slave 1
|
||||
output wire s1_iob_poweron,
|
||||
output wire s1_iob_reset,
|
||||
output wire s1_datao_clear,
|
||||
@ -40,13 +47,19 @@ module iobus_2_connect(
|
||||
output wire s1_cono_set,
|
||||
output wire s1_iob_fm_datai,
|
||||
output wire s1_iob_fm_status,
|
||||
output wire s1_rdi_pulse,
|
||||
output wire [3:9] s1_ios,
|
||||
output wire [0:35] s1_iob_write,
|
||||
input wire [1:7] s1_pi_req,
|
||||
input wire [0:35] s1_iob_read
|
||||
input wire [0:35] s1_iob_read,
|
||||
input wire s1_dr_split,
|
||||
input wire s1_rdi_data
|
||||
);
|
||||
assign m_pi_req = s0_pi_req | s1_pi_req;
|
||||
assign m_pi_req = 0 | s0_pi_req | s1_pi_req;
|
||||
assign m_iob_read = m_iob_write | s0_iob_read | s1_iob_read;
|
||||
assign m_dr_split = 0 | s0_dr_split | s1_dr_split;
|
||||
assign m_rdi_data = 0 | s0_rdi_data | s1_rdi_data;
|
||||
|
||||
|
||||
assign s0_iob_poweron = m_iob_poweron;
|
||||
assign s0_iob_reset = m_iob_reset;
|
||||
@ -56,6 +69,7 @@ module iobus_2_connect(
|
||||
assign s0_cono_set = m_cono_set;
|
||||
assign s0_iob_fm_datai = m_iob_fm_datai;
|
||||
assign s0_iob_fm_status = m_iob_fm_status;
|
||||
assign s0_rdi_pulse = m_rdi_pulse;
|
||||
assign s0_ios = m_ios;
|
||||
assign s0_iob_write = m_iob_write;
|
||||
|
||||
@ -67,6 +81,7 @@ module iobus_2_connect(
|
||||
assign s1_cono_set = m_cono_set;
|
||||
assign s1_iob_fm_datai = m_iob_fm_datai;
|
||||
assign s1_iob_fm_status = m_iob_fm_status;
|
||||
assign s1_rdi_pulse = m_rdi_pulse;
|
||||
assign s1_ios = m_ios;
|
||||
assign s1_iob_write = m_iob_write;
|
||||
endmodule
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
// AUTOGEN
|
||||
module iobus_3_connect(
|
||||
// unused
|
||||
input wire clk,
|
||||
@ -12,10 +13,13 @@ module iobus_3_connect(
|
||||
input wire m_cono_set,
|
||||
input wire m_iob_fm_datai,
|
||||
input wire m_iob_fm_status,
|
||||
input wire m_rdi_pulse,
|
||||
input wire [3:9] m_ios,
|
||||
input wire [0:35] m_iob_write,
|
||||
output wire [1:7] m_pi_req,
|
||||
output wire [0:35] m_iob_read,
|
||||
output wire m_dr_split,
|
||||
output wire m_rdi_data,
|
||||
|
||||
// Slave 0
|
||||
output wire s0_iob_poweron,
|
||||
@ -26,10 +30,13 @@ module iobus_3_connect(
|
||||
output wire s0_cono_set,
|
||||
output wire s0_iob_fm_datai,
|
||||
output wire s0_iob_fm_status,
|
||||
output wire s0_rdi_pulse,
|
||||
output wire [3:9] s0_ios,
|
||||
output wire [0:35] s0_iob_write,
|
||||
input wire [1:7] s0_pi_req,
|
||||
input wire [0:35] s0_iob_read,
|
||||
input wire s0_dr_split,
|
||||
input wire s0_rdi_data,
|
||||
|
||||
// Slave 1
|
||||
output wire s1_iob_poweron,
|
||||
@ -40,10 +47,13 @@ module iobus_3_connect(
|
||||
output wire s1_cono_set,
|
||||
output wire s1_iob_fm_datai,
|
||||
output wire s1_iob_fm_status,
|
||||
output wire s1_rdi_pulse,
|
||||
output wire [3:9] s1_ios,
|
||||
output wire [0:35] s1_iob_write,
|
||||
input wire [1:7] s1_pi_req,
|
||||
input wire [0:35] s1_iob_read,
|
||||
input wire s1_dr_split,
|
||||
input wire s1_rdi_data,
|
||||
|
||||
// Slave 2
|
||||
output wire s2_iob_poweron,
|
||||
@ -54,13 +64,19 @@ module iobus_3_connect(
|
||||
output wire s2_cono_set,
|
||||
output wire s2_iob_fm_datai,
|
||||
output wire s2_iob_fm_status,
|
||||
output wire s2_rdi_pulse,
|
||||
output wire [3:9] s2_ios,
|
||||
output wire [0:35] s2_iob_write,
|
||||
input wire [1:7] s2_pi_req,
|
||||
input wire [0:35] s2_iob_read
|
||||
input wire [0:35] s2_iob_read,
|
||||
input wire s2_dr_split,
|
||||
input wire s2_rdi_data
|
||||
);
|
||||
assign m_pi_req = s0_pi_req | s1_pi_req | s2_pi_req;
|
||||
assign m_pi_req = 0 | s0_pi_req | s1_pi_req | s2_pi_req;
|
||||
assign m_iob_read = m_iob_write | s0_iob_read | s1_iob_read | s2_iob_read;
|
||||
assign m_dr_split = 0 | s0_dr_split | s1_dr_split | s2_dr_split;
|
||||
assign m_rdi_data = 0 | s0_rdi_data | s1_rdi_data | s2_rdi_data;
|
||||
|
||||
|
||||
assign s0_iob_poweron = m_iob_poweron;
|
||||
assign s0_iob_reset = m_iob_reset;
|
||||
@ -70,6 +86,7 @@ module iobus_3_connect(
|
||||
assign s0_cono_set = m_cono_set;
|
||||
assign s0_iob_fm_datai = m_iob_fm_datai;
|
||||
assign s0_iob_fm_status = m_iob_fm_status;
|
||||
assign s0_rdi_pulse = m_rdi_pulse;
|
||||
assign s0_ios = m_ios;
|
||||
assign s0_iob_write = m_iob_write;
|
||||
|
||||
@ -81,6 +98,7 @@ module iobus_3_connect(
|
||||
assign s1_cono_set = m_cono_set;
|
||||
assign s1_iob_fm_datai = m_iob_fm_datai;
|
||||
assign s1_iob_fm_status = m_iob_fm_status;
|
||||
assign s1_rdi_pulse = m_rdi_pulse;
|
||||
assign s1_ios = m_ios;
|
||||
assign s1_iob_write = m_iob_write;
|
||||
|
||||
@ -92,6 +110,7 @@ module iobus_3_connect(
|
||||
assign s2_cono_set = m_cono_set;
|
||||
assign s2_iob_fm_datai = m_iob_fm_datai;
|
||||
assign s2_iob_fm_status = m_iob_fm_status;
|
||||
assign s2_rdi_pulse = m_rdi_pulse;
|
||||
assign s2_ios = m_ios;
|
||||
assign s2_iob_write = m_iob_write;
|
||||
endmodule
|
||||
|
||||
46
verilog/membus_1_connect.v
Normal file
46
verilog/membus_1_connect.v
Normal file
@ -0,0 +1,46 @@
|
||||
module membus_1_connect(
|
||||
// unused
|
||||
input wire clk,
|
||||
input wire reset,
|
||||
|
||||
// Master
|
||||
input wire m_wr_rs,
|
||||
input wire m_rq_cyc,
|
||||
input wire m_rd_rq,
|
||||
input wire m_wr_rq,
|
||||
input wire [21:35] m_ma,
|
||||
input wire [18:21] m_sel,
|
||||
input wire m_fmc_select,
|
||||
input wire [0:35] m_mb_write,
|
||||
output wire m_addr_ack,
|
||||
output wire m_rd_rs,
|
||||
output wire [0:35] m_mb_read,
|
||||
|
||||
// Slave 0
|
||||
output wire s0_wr_rs,
|
||||
output wire s0_rq_cyc,
|
||||
output wire s0_rd_rq,
|
||||
output wire s0_wr_rq,
|
||||
output wire [21:35] s0_ma,
|
||||
output wire [18:21] s0_sel,
|
||||
output wire s0_fmc_select,
|
||||
output wire [0:35] s0_mb_write,
|
||||
input wire s0_addr_ack,
|
||||
input wire s0_rd_rs,
|
||||
input wire [0:35] s0_mb_read
|
||||
);
|
||||
wire [0:35] mb_out = m_mb_write | s0_mb_read;
|
||||
|
||||
assign m_addr_ack = s0_addr_ack;
|
||||
assign m_rd_rs = s0_rd_rs;
|
||||
assign m_mb_read = mb_out;
|
||||
|
||||
assign s0_wr_rs = m_wr_rs;
|
||||
assign s0_rq_cyc = m_rq_cyc;
|
||||
assign s0_rd_rq = m_rd_rq;
|
||||
assign s0_wr_rq = m_wr_rq;
|
||||
assign s0_ma = m_ma;
|
||||
assign s0_sel = m_sel;
|
||||
assign s0_fmc_select = m_fmc_select;
|
||||
assign s0_mb_write = mb_out;
|
||||
endmodule
|
||||
217
verilog/mkiocon.py
Executable file
217
verilog/mkiocon.py
Executable file
@ -0,0 +1,217 @@
|
||||
#!/usr/bin/python3
|
||||
|
||||
import sys;
|
||||
|
||||
|
||||
start = '''// AUTOGEN
|
||||
module iobus_{num}_connect(
|
||||
// unused
|
||||
input wire clk,
|
||||
input wire reset,
|
||||
|
||||
// Master
|
||||
input wire m_iob_poweron,
|
||||
input wire m_iob_reset,
|
||||
input wire m_datao_clear,
|
||||
input wire m_datao_set,
|
||||
input wire m_cono_clear,
|
||||
input wire m_cono_set,
|
||||
input wire m_iob_fm_datai,
|
||||
input wire m_iob_fm_status,
|
||||
input wire m_rdi_pulse,
|
||||
input wire [3:9] m_ios,
|
||||
input wire [0:35] m_iob_write,
|
||||
output wire [1:7] m_pi_req,
|
||||
output wire [0:35] m_iob_read,
|
||||
output wire m_dr_split,
|
||||
output wire m_rdi_data'''
|
||||
|
||||
slv = ''',
|
||||
|
||||
// Slave {i}
|
||||
output wire s{i}_iob_poweron,
|
||||
output wire s{i}_iob_reset,
|
||||
output wire s{i}_datao_clear,
|
||||
output wire s{i}_datao_set,
|
||||
output wire s{i}_cono_clear,
|
||||
output wire s{i}_cono_set,
|
||||
output wire s{i}_iob_fm_datai,
|
||||
output wire s{i}_iob_fm_status,
|
||||
output wire s{i}_rdi_pulse,
|
||||
output wire [3:9] s{i}_ios,
|
||||
output wire [0:35] s{i}_iob_write,
|
||||
input wire [1:7] s{i}_pi_req,
|
||||
input wire [0:35] s{i}_iob_read,
|
||||
input wire s{i}_dr_split,
|
||||
input wire s{i}_rdi_data'''
|
||||
|
||||
mas = '''
|
||||
);
|
||||
assign m_pi_req = {pireq};
|
||||
assign m_iob_read = {read};
|
||||
assign m_dr_split = {split};
|
||||
assign m_rdi_data = {rdidata};
|
||||
'''
|
||||
|
||||
sas = '''
|
||||
assign s{i}_iob_poweron = m_iob_poweron;
|
||||
assign s{i}_iob_reset = m_iob_reset;
|
||||
assign s{i}_datao_clear = m_datao_clear;
|
||||
assign s{i}_datao_set = m_datao_set;
|
||||
assign s{i}_cono_clear = m_cono_clear;
|
||||
assign s{i}_cono_set = m_cono_set;
|
||||
assign s{i}_iob_fm_datai = m_iob_fm_datai;
|
||||
assign s{i}_iob_fm_status = m_iob_fm_status;
|
||||
assign s{i}_rdi_pulse = m_rdi_pulse;
|
||||
assign s{i}_ios = m_ios;
|
||||
assign s{i}_iob_write = m_iob_write;'''
|
||||
|
||||
n = int(sys.argv[1])
|
||||
|
||||
vf = open("iobus_%d_connect.v" % n, "w+")
|
||||
tf = open("iobus_%d_connect_hw.tcl" % n, "w+")
|
||||
|
||||
sys.stdout = vf
|
||||
|
||||
print(start.format(num=n), end='')
|
||||
for i in range(n):
|
||||
print(slv.format(i=i), end='')
|
||||
|
||||
pireq = ' | '.join(['0'] + ["s%d_pi_req" % i for i in range(n)])
|
||||
read = ' | '.join(['m_iob_write'] + ["s%d_iob_read" % i for i in range(n)])
|
||||
split = ' | '.join(['0'] + ["s%d_dr_split" % i for i in range(n)])
|
||||
rdidata = ' | '.join(['0'] + ["s%d_rdi_data" % i for i in range(n)])
|
||||
|
||||
print(mas.format(pireq=pireq, read=read, split=split, rdidata=rdidata))
|
||||
|
||||
for i in range(n):
|
||||
print(sas.format(i=i))
|
||||
|
||||
print('endmodule')
|
||||
|
||||
|
||||
|
||||
|
||||
tclhead='''package require -exact qsys 16.1
|
||||
|
||||
|
||||
#
|
||||
# module iobus_{n}_connect
|
||||
#
|
||||
set_module_property DESCRIPTION ""
|
||||
set_module_property NAME iobus_{n}_connect
|
||||
set_module_property VERSION 1.0
|
||||
set_module_property INTERNAL false
|
||||
set_module_property OPAQUE_ADDRESS_MAP true
|
||||
set_module_property AUTHOR ""
|
||||
set_module_property DISPLAY_NAME iobus_{n}_connect
|
||||
set_module_property INSTANTIATE_IN_SYSTEM_MODULE true
|
||||
set_module_property EDITABLE true
|
||||
set_module_property REPORT_TO_TALKBACK false
|
||||
set_module_property ALLOW_GREYBOX_GENERATION false
|
||||
set_module_property REPORT_HIERARCHY false
|
||||
|
||||
#
|
||||
# file sets
|
||||
#
|
||||
add_fileset QUARTUS_SYNTH QUARTUS_SYNTH "" ""
|
||||
set_fileset_property QUARTUS_SYNTH TOP_LEVEL iobus_{n}_connect
|
||||
set_fileset_property QUARTUS_SYNTH ENABLE_RELATIVE_INCLUDE_PATHS false
|
||||
set_fileset_property QUARTUS_SYNTH ENABLE_FILE_OVERWRITE_MODE false
|
||||
add_fileset_file iobus_{n}_connect.v VERILOG PATH rtl/iobus_{n}_connect.v TOP_LEVEL_FILE
|
||||
|
||||
#
|
||||
# connection point clock
|
||||
#
|
||||
add_interface clock clock end
|
||||
set_interface_property clock clockRate 0
|
||||
set_interface_property clock ENABLED true
|
||||
set_interface_property clock EXPORT_OF ""
|
||||
set_interface_property clock PORT_NAME_MAP ""
|
||||
set_interface_property clock CMSIS_SVD_VARIABLES ""
|
||||
set_interface_property clock SVD_ADDRESS_GROUP ""
|
||||
|
||||
add_interface_port clock clk clk Input 1
|
||||
|
||||
|
||||
#
|
||||
# connection point reset
|
||||
#
|
||||
add_interface reset reset end
|
||||
set_interface_property reset associatedClock clock
|
||||
set_interface_property reset synchronousEdges DEASSERT
|
||||
set_interface_property reset ENABLED true
|
||||
set_interface_property reset EXPORT_OF ""
|
||||
set_interface_property reset PORT_NAME_MAP ""
|
||||
set_interface_property reset CMSIS_SVD_VARIABLES ""
|
||||
set_interface_property reset SVD_ADDRESS_GROUP ""
|
||||
|
||||
add_interface_port reset reset reset Input 1
|
||||
|
||||
'''
|
||||
|
||||
tclslv='''#
|
||||
# connection point iobus_slave{i}
|
||||
#
|
||||
add_interface iobus_slave{i} conduit end
|
||||
set_interface_property iobus_slave{i} associatedClock clock
|
||||
set_interface_property iobus_slave{i} associatedReset reset
|
||||
set_interface_property iobus_slave{i} ENABLED true
|
||||
set_interface_property iobus_slave{i} EXPORT_OF ""
|
||||
set_interface_property iobus_slave{i} PORT_NAME_MAP ""
|
||||
set_interface_property iobus_slave{i} CMSIS_SVD_VARIABLES ""
|
||||
set_interface_property iobus_slave{i} SVD_ADDRESS_GROUP ""
|
||||
|
||||
add_interface_port iobus_slave{i} s{i}_iob_poweron iob_poweron Output 1
|
||||
add_interface_port iobus_slave{i} s{i}_iob_reset iob_reset Output 1
|
||||
add_interface_port iobus_slave{i} s{i}_datao_clear datao_clear Output 1
|
||||
add_interface_port iobus_slave{i} s{i}_datao_set datao_set Output 1
|
||||
add_interface_port iobus_slave{i} s{i}_cono_clear cono_clear Output 1
|
||||
add_interface_port iobus_slave{i} s{i}_cono_set cono_set Output 1
|
||||
add_interface_port iobus_slave{i} s{i}_iob_fm_datai iob_fm_datai Output 1
|
||||
add_interface_port iobus_slave{i} s{i}_iob_fm_status iob_fm_status Output 1
|
||||
add_interface_port iobus_slave{i} s{i}_rdi_pulse rdi_pulse Output 1
|
||||
add_interface_port iobus_slave{i} s{i}_ios ios Output 7
|
||||
add_interface_port iobus_slave{i} s{i}_iob_write iob_write Output 36
|
||||
add_interface_port iobus_slave{i} s{i}_pi_req pi_req Input 7
|
||||
add_interface_port iobus_slave{i} s{i}_iob_read iob_read Input 36
|
||||
add_interface_port iobus_slave{i} s{i}_dr_split dr_split Input 1
|
||||
add_interface_port iobus_slave{i} s{i}_rdi_data rdi_data Input 1
|
||||
|
||||
'''
|
||||
|
||||
tclmas='''#
|
||||
# connection point iobus_master
|
||||
#
|
||||
add_interface iobus_master conduit end
|
||||
set_interface_property iobus_master associatedClock clock
|
||||
set_interface_property iobus_master associatedReset reset
|
||||
set_interface_property iobus_master ENABLED true
|
||||
set_interface_property iobus_master EXPORT_OF ""
|
||||
set_interface_property iobus_master PORT_NAME_MAP ""
|
||||
set_interface_property iobus_master CMSIS_SVD_VARIABLES ""
|
||||
set_interface_property iobus_master SVD_ADDRESS_GROUP ""
|
||||
|
||||
add_interface_port iobus_master m_iob_poweron iob_poweron Input 1
|
||||
add_interface_port iobus_master m_iob_reset iob_reset Input 1
|
||||
add_interface_port iobus_master m_datao_clear datao_clear Input 1
|
||||
add_interface_port iobus_master m_datao_set datao_set Input 1
|
||||
add_interface_port iobus_master m_cono_clear cono_clear Input 1
|
||||
add_interface_port iobus_master m_cono_set cono_set Input 1
|
||||
add_interface_port iobus_master m_iob_fm_datai iob_fm_datai Input 1
|
||||
add_interface_port iobus_master m_iob_fm_status iob_fm_status Input 1
|
||||
add_interface_port iobus_master m_rdi_pulse rdi_pulse Input 1
|
||||
add_interface_port iobus_master m_ios ios Input 7
|
||||
add_interface_port iobus_master m_iob_write iob_write Input 36
|
||||
add_interface_port iobus_master m_pi_req pi_req Output 7
|
||||
add_interface_port iobus_master m_iob_read iob_read Output 36
|
||||
add_interface_port iobus_master m_dr_split dr_split Output 1
|
||||
add_interface_port iobus_master m_rdi_data rdi_data Output 1
|
||||
|
||||
'''
|
||||
|
||||
sys.stdout = tf
|
||||
print(tclhead.format(n=n))
|
||||
for i in range(n):
|
||||
print(tclslv.format(i=i))
|
||||
print(tclmas)
|
||||
@ -11,10 +11,13 @@ module ptp(
|
||||
input wire iobus_cono_set,
|
||||
input wire iobus_iob_fm_datai,
|
||||
input wire iobus_iob_fm_status,
|
||||
input wire iobus_rdi_pulse, // unused on 6
|
||||
input wire [3:9] iobus_ios,
|
||||
input wire [0:35] iobus_iob_in,
|
||||
output wire [1:7] iobus_pi_req,
|
||||
output wire [0:35] iobus_iob_out,
|
||||
output wire iobus_dr_split,
|
||||
output wire iobus_rdi_data, // unused on 6
|
||||
|
||||
/* Console panel */
|
||||
input wire key_tape_feed,
|
||||
@ -27,6 +30,9 @@ module ptp(
|
||||
|
||||
output wire fe_data_rq
|
||||
);
|
||||
assign iobus_dr_split = 0;
|
||||
assign iobus_rdi_data = 0;
|
||||
|
||||
assign ptp_ind = ptp;
|
||||
assign status_ind = { ptp_speed, ptp_b, ptp_busy, ptp_flag, ptp_pia };
|
||||
|
||||
|
||||
@ -11,10 +11,13 @@ module ptr(
|
||||
input wire iobus_cono_set,
|
||||
input wire iobus_iob_fm_datai,
|
||||
input wire iobus_iob_fm_status,
|
||||
input wire iobus_rdi_pulse, // unused on 6
|
||||
input wire [3:9] iobus_ios,
|
||||
input wire [0:35] iobus_iob_in,
|
||||
output wire [1:7] iobus_pi_req,
|
||||
output wire [0:35] iobus_iob_out,
|
||||
output wire iobus_dr_split,
|
||||
output wire iobus_rdi_data, // unused on 6
|
||||
|
||||
/* Console panel */
|
||||
input wire key_start,
|
||||
@ -29,6 +32,9 @@ module ptr(
|
||||
|
||||
output wire fe_data_rq
|
||||
);
|
||||
assign iobus_dr_split = 0;
|
||||
assign iobus_rdi_data = 0;
|
||||
|
||||
assign ptr_ind = ptr;
|
||||
assign status_ind = { motor_on, ptr_b, ptr_busy, ptr_flag, ptr_pia };
|
||||
|
||||
|
||||
@ -11,10 +11,13 @@ module tty(
|
||||
input wire iobus_cono_set,
|
||||
input wire iobus_iob_fm_datai,
|
||||
input wire iobus_iob_fm_status,
|
||||
input wire iobus_rdi_pulse, // unused on 6
|
||||
input wire [3:9] iobus_ios,
|
||||
input wire [0:35] iobus_iob_in,
|
||||
output wire [1:7] iobus_pi_req,
|
||||
output wire [0:35] iobus_iob_out,
|
||||
output wire iobus_dr_split,
|
||||
output wire iobus_rdi_data, // unused on 6
|
||||
|
||||
/* UART pins */
|
||||
input wire rx,
|
||||
@ -24,6 +27,9 @@ module tty(
|
||||
output wire [7:0] tti_ind,
|
||||
output wire [6:0] status_ind
|
||||
);
|
||||
assign iobus_dr_split = 0;
|
||||
assign iobus_rdi_data = 0;
|
||||
|
||||
wire clk2;
|
||||
clk14khz clock2(.inclk(clk),
|
||||
.outclk(clk2));
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user