|
|
|
@ -133,6 +133,240 @@ typedef struct {
|
|
|
|
|
#define SER_TXD ((bus_params_t *) bus->params)->ser_txd
|
|
|
|
|
#define SER_NCTS ((bus_params_t *) bus->params)->ser_ncts
|
|
|
|
|
|
|
|
|
|
static int
|
|
|
|
|
attach_sig( bus_t *bus, signal_t **sig, char *id )
|
|
|
|
|
{
|
|
|
|
|
int failed = 0;
|
|
|
|
|
|
|
|
|
|
*sig = part_find_signal( PART, id );
|
|
|
|
|
if (!*sig) {
|
|
|
|
|
printf( _("signal '%s' not found\n"), id );
|
|
|
|
|
failed = 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return failed;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* bus->driver->(*new_bus)
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
static bus_t *
|
|
|
|
|
jopcyc_bus_new( chain_t *chain, char *cmd_params[] )
|
|
|
|
|
{
|
|
|
|
|
bus_t *bus;
|
|
|
|
|
int failed = 0;
|
|
|
|
|
component_t *comp;
|
|
|
|
|
|
|
|
|
|
if (!chain || !chain->parts || chain->parts->len <= chain->active_part || chain->active_part < 0)
|
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
|
|
bus = calloc( 1, sizeof (bus_t) );
|
|
|
|
|
if (!bus)
|
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
|
|
bus->driver = &jopcyc_bus;
|
|
|
|
|
bus->params = calloc( 1, sizeof (bus_params_t) );
|
|
|
|
|
if (!bus->params) {
|
|
|
|
|
free( bus );
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
CHAIN = chain;
|
|
|
|
|
PART = chain->parts->parts[chain->active_part];
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Setup RAMA
|
|
|
|
|
*/
|
|
|
|
|
comp = COMP_RAMA;
|
|
|
|
|
comp->ctype = RAM;
|
|
|
|
|
comp->cname = "RAMA";
|
|
|
|
|
|
|
|
|
|
failed |= attach_sig( bus, &(A[ 0]), "IO64" );
|
|
|
|
|
failed |= attach_sig( bus, &(A[ 1]), "IO66" );
|
|
|
|
|
failed |= attach_sig( bus, &(A[ 2]), "IO68" );
|
|
|
|
|
failed |= attach_sig( bus, &(A[ 3]), "IO74" );
|
|
|
|
|
failed |= attach_sig( bus, &(A[ 4]), "IO76" );
|
|
|
|
|
failed |= attach_sig( bus, &(A[ 5]), "IO107" );
|
|
|
|
|
failed |= attach_sig( bus, &(A[ 6]), "IO113" );
|
|
|
|
|
failed |= attach_sig( bus, &(A[ 7]), "IO115" );
|
|
|
|
|
failed |= attach_sig( bus, &(A[ 8]), "IO117" );
|
|
|
|
|
failed |= attach_sig( bus, &(A[ 9]), "IO119" );
|
|
|
|
|
failed |= attach_sig( bus, &(A[10]), "IO118" );
|
|
|
|
|
failed |= attach_sig( bus, &(A[11]), "IO116" );
|
|
|
|
|
failed |= attach_sig( bus, &(A[12]), "IO114" );
|
|
|
|
|
failed |= attach_sig( bus, &(A[13]), "IO108" );
|
|
|
|
|
failed |= attach_sig( bus, &(A[14]), "IO106" );
|
|
|
|
|
failed |= attach_sig( bus, &(A[15]), "IO67" );
|
|
|
|
|
failed |= attach_sig( bus, &(A[16]), "IO65" );
|
|
|
|
|
failed |= attach_sig( bus, &(A[17]), "IO63" );
|
|
|
|
|
A[18] = NULL;
|
|
|
|
|
|
|
|
|
|
failed |= attach_sig( bus, &(D[ 0]), "IO82" );
|
|
|
|
|
failed |= attach_sig( bus, &(D[ 1]), "IO84" );
|
|
|
|
|
failed |= attach_sig( bus, &(D[ 2]), "IO86" );
|
|
|
|
|
failed |= attach_sig( bus, &(D[ 3]), "IO88" );
|
|
|
|
|
failed |= attach_sig( bus, &(D[ 4]), "IO94" );
|
|
|
|
|
failed |= attach_sig( bus, &(D[ 5]), "IO98" );
|
|
|
|
|
failed |= attach_sig( bus, &(D[ 6]), "IO100" );
|
|
|
|
|
failed |= attach_sig( bus, &(D[ 7]), "IO104" );
|
|
|
|
|
failed |= attach_sig( bus, &(D[ 8]), "IO101" );
|
|
|
|
|
failed |= attach_sig( bus, &(D[ 9]), "IO99" );
|
|
|
|
|
failed |= attach_sig( bus, &(D[10]), "IO95" );
|
|
|
|
|
failed |= attach_sig( bus, &(D[11]), "IO93" );
|
|
|
|
|
failed |= attach_sig( bus, &(D[12]), "IO87" );
|
|
|
|
|
failed |= attach_sig( bus, &(D[13]), "IO85" );
|
|
|
|
|
failed |= attach_sig( bus, &(D[14]), "IO83" );
|
|
|
|
|
failed |= attach_sig( bus, &(D[15]), "IO79" );
|
|
|
|
|
|
|
|
|
|
failed |= attach_sig( bus, &(nCS), "IO78" );
|
|
|
|
|
failed |= attach_sig( bus, &(nOE), "IO73" );
|
|
|
|
|
failed |= attach_sig( bus, &(nWE), "IO105" );
|
|
|
|
|
failed |= attach_sig( bus, &(nLB), "IO77" );
|
|
|
|
|
failed |= attach_sig( bus, &(nUB), "IO75" );
|
|
|
|
|
nCS2 = NULL;
|
|
|
|
|
nRDY = NULL;
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Setup RAMB
|
|
|
|
|
*/
|
|
|
|
|
comp = COMP_RAMB;
|
|
|
|
|
comp->ctype = RAM;
|
|
|
|
|
comp->cname = "RAMB";
|
|
|
|
|
|
|
|
|
|
failed |= attach_sig( bus, &(A[ 0]), "IO237" );
|
|
|
|
|
failed |= attach_sig( bus, &(A[ 1]), "IO235" );
|
|
|
|
|
failed |= attach_sig( bus, &(A[ 2]), "IO233" );
|
|
|
|
|
failed |= attach_sig( bus, &(A[ 3]), "IO227" );
|
|
|
|
|
failed |= attach_sig( bus, &(A[ 4]), "IO225" );
|
|
|
|
|
failed |= attach_sig( bus, &(A[ 5]), "IO194" );
|
|
|
|
|
failed |= attach_sig( bus, &(A[ 6]), "IO188" );
|
|
|
|
|
failed |= attach_sig( bus, &(A[ 7]), "IO186" );
|
|
|
|
|
failed |= attach_sig( bus, &(A[ 8]), "IO184" );
|
|
|
|
|
failed |= attach_sig( bus, &(A[ 9]), "IO182" );
|
|
|
|
|
failed |= attach_sig( bus, &(A[10]), "IO183" );
|
|
|
|
|
failed |= attach_sig( bus, &(A[11]), "IO185" );
|
|
|
|
|
failed |= attach_sig( bus, &(A[12]), "IO187" );
|
|
|
|
|
failed |= attach_sig( bus, &(A[13]), "IO193" );
|
|
|
|
|
failed |= attach_sig( bus, &(A[14]), "IO195" );
|
|
|
|
|
failed |= attach_sig( bus, &(A[15]), "IO234" );
|
|
|
|
|
failed |= attach_sig( bus, &(A[16]), "IO236" );
|
|
|
|
|
failed |= attach_sig( bus, &(A[17]), "IO238" );
|
|
|
|
|
A[18] = NULL;
|
|
|
|
|
|
|
|
|
|
failed |= attach_sig( bus, &(D[ 0]), "IO219" );
|
|
|
|
|
failed |= attach_sig( bus, &(D[ 1]), "IO217" );
|
|
|
|
|
failed |= attach_sig( bus, &(D[ 2]), "IO215" );
|
|
|
|
|
failed |= attach_sig( bus, &(D[ 3]), "IO213" );
|
|
|
|
|
failed |= attach_sig( bus, &(D[ 4]), "IO207" );
|
|
|
|
|
failed |= attach_sig( bus, &(D[ 5]), "IO203" );
|
|
|
|
|
failed |= attach_sig( bus, &(D[ 6]), "IO201" );
|
|
|
|
|
failed |= attach_sig( bus, &(D[ 7]), "IO197" );
|
|
|
|
|
failed |= attach_sig( bus, &(D[ 8]), "IO200" );
|
|
|
|
|
failed |= attach_sig( bus, &(D[ 9]), "IO202" );
|
|
|
|
|
failed |= attach_sig( bus, &(D[10]), "IO206" );
|
|
|
|
|
failed |= attach_sig( bus, &(D[11]), "IO208" );
|
|
|
|
|
failed |= attach_sig( bus, &(D[12]), "IO214" );
|
|
|
|
|
failed |= attach_sig( bus, &(D[13]), "IO216" );
|
|
|
|
|
failed |= attach_sig( bus, &(D[14]), "IO218" );
|
|
|
|
|
failed |= attach_sig( bus, &(D[15]), "IO222" );
|
|
|
|
|
|
|
|
|
|
failed |= attach_sig( bus, &(nCS), "IO223" );
|
|
|
|
|
failed |= attach_sig( bus, &(nOE), "IO228" );
|
|
|
|
|
failed |= attach_sig( bus, &(nWE), "IO196" );
|
|
|
|
|
failed |= attach_sig( bus, &(nLB), "IO224" );
|
|
|
|
|
failed |= attach_sig( bus, &(nUB), "IO226" );
|
|
|
|
|
nCS2 = NULL;
|
|
|
|
|
nRDY = NULL;
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Setup FLASH
|
|
|
|
|
*/
|
|
|
|
|
comp = COMP_FLASH;
|
|
|
|
|
comp->ctype = FLASH;
|
|
|
|
|
comp->cname = "FLASH";
|
|
|
|
|
|
|
|
|
|
failed |= attach_sig( bus, &(A[ 0]), "IO47" );
|
|
|
|
|
failed |= attach_sig( bus, &(A[ 1]), "IO48" );
|
|
|
|
|
failed |= attach_sig( bus, &(A[ 2]), "IO49" );
|
|
|
|
|
failed |= attach_sig( bus, &(A[ 3]), "IO50" );
|
|
|
|
|
failed |= attach_sig( bus, &(A[ 4]), "IO125" );
|
|
|
|
|
failed |= attach_sig( bus, &(A[ 5]), "IO127" );
|
|
|
|
|
failed |= attach_sig( bus, &(A[ 6]), "IO131" );
|
|
|
|
|
failed |= attach_sig( bus, &(A[ 7]), "IO133" );
|
|
|
|
|
failed |= attach_sig( bus, &(A[ 8]), "IO158" );
|
|
|
|
|
failed |= attach_sig( bus, &(A[ 9]), "IO16" );
|
|
|
|
|
failed |= attach_sig( bus, &(A[10]), "IO20" );
|
|
|
|
|
failed |= attach_sig( bus, &(A[11]), "IO14" );
|
|
|
|
|
failed |= attach_sig( bus, &(A[12]), "IO135" );
|
|
|
|
|
failed |= attach_sig( bus, &(A[13]), "IO156" );
|
|
|
|
|
failed |= attach_sig( bus, &(A[14]), "IO144" );
|
|
|
|
|
failed |= attach_sig( bus, &(A[15]), "IO137" );
|
|
|
|
|
failed |= attach_sig( bus, &(A[16]), "IO139" );
|
|
|
|
|
failed |= attach_sig( bus, &(A[17]), "IO143" );
|
|
|
|
|
failed |= attach_sig( bus, &(A[18]), "IO141" );
|
|
|
|
|
|
|
|
|
|
failed |= attach_sig( bus, &(D[ 0]), "IO46" );
|
|
|
|
|
failed |= attach_sig( bus, &(D[ 1]), "IO45" );
|
|
|
|
|
failed |= attach_sig( bus, &(D[ 2]), "IO44" );
|
|
|
|
|
failed |= attach_sig( bus, &(D[ 3]), "IO165" );
|
|
|
|
|
failed |= attach_sig( bus, &(D[ 4]), "IO164" );
|
|
|
|
|
failed |= attach_sig( bus, &(D[ 5]), "IO17" );
|
|
|
|
|
failed |= attach_sig( bus, &(D[ 6]), "IO18" );
|
|
|
|
|
failed |= attach_sig( bus, &(D[ 7]), "IO19" );
|
|
|
|
|
D[ 8] = NULL;
|
|
|
|
|
D[ 9] = NULL;
|
|
|
|
|
D[10] = NULL;
|
|
|
|
|
D[11] = NULL;
|
|
|
|
|
D[12] = NULL;
|
|
|
|
|
D[13] = NULL;
|
|
|
|
|
D[14] = NULL;
|
|
|
|
|
D[15] = NULL;
|
|
|
|
|
|
|
|
|
|
failed |= attach_sig( bus, &(nWE), "IO15" );
|
|
|
|
|
failed |= attach_sig( bus, &(nOE), "IO24" );
|
|
|
|
|
failed |= attach_sig( bus, &(nCS), "IO37" );
|
|
|
|
|
failed |= attach_sig( bus, &(nCS2), "IO23" );
|
|
|
|
|
|
|
|
|
|
/* CLK1 is not observable :-(
|
|
|
|
|
failed |= attach_sig( bus, &(nRDY), "CLK1" );
|
|
|
|
|
*/
|
|
|
|
|
nRDY = NULL;
|
|
|
|
|
|
|
|
|
|
nLB = NULL;
|
|
|
|
|
nUB = NULL;
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Setup Serial Port
|
|
|
|
|
*/
|
|
|
|
|
failed |= attach_sig( bus, &(SER_RXD), "CLK2" );
|
|
|
|
|
failed |= attach_sig( bus, &(SER_NRTS), "IO177" );
|
|
|
|
|
failed |= attach_sig( bus, &(SER_TXD), "IO178" );
|
|
|
|
|
failed |= attach_sig( bus, &(SER_NCTS), "CLK0" );
|
|
|
|
|
|
|
|
|
|
if (failed) {
|
|
|
|
|
free( bus->params );
|
|
|
|
|
free( bus );
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return bus;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* bus->driver->(*printinfo)
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
static void
|
|
|
|
|
jopcyc_bus_printinfo( bus_t *bus )
|
|
|
|
|
{
|
|
|
|
|
int i;
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < CHAIN->parts->len; i++)
|
|
|
|
|
if (PART == CHAIN->parts->parts[i])
|
|
|
|
|
break;
|
|
|
|
|
printf( _("JOP.design Cyclone Board compatible bus driver via BSR (JTAG part No. %d)\n"), i );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
setup_address( bus_t *bus, uint32_t a, component_t *comp )
|
|
|
|
@ -208,27 +442,10 @@ setup_data( bus_t *bus, uint32_t d, component_t *comp )
|
|
|
|
|
part_set_signal( p, D[i], 1, (d >> i) & 1 );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static int comp_bus_area( bus_t *bus, uint32_t adr, bus_area_t *area, component_t **comp );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* ***************************************************************************
|
|
|
|
|
* jopcyc_printinfo
|
|
|
|
|
* ***************************************************************************/
|
|
|
|
|
static void
|
|
|
|
|
jopcyc_bus_printinfo( bus_t *bus )
|
|
|
|
|
{
|
|
|
|
|
int i;
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < CHAIN->parts->len; i++)
|
|
|
|
|
if (PART == CHAIN->parts->parts[i])
|
|
|
|
|
break;
|
|
|
|
|
printf( _("JOP.design Cyclone Board compatible bus driver via BSR (JTAG part No. %d)\n"), i );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* ***************************************************************************
|
|
|
|
|
* jopcyc_bus_prepare
|
|
|
|
|
* ***************************************************************************/
|
|
|
|
|
/**
|
|
|
|
|
* bus->driver->(*prepare)
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
static void
|
|
|
|
|
jopcyc_bus_prepare( bus_t *bus )
|
|
|
|
|
{
|
|
|
|
@ -281,18 +498,62 @@ jopcyc_bus_prepare( bus_t *bus )
|
|
|
|
|
chain_shift_instructions( chain );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* ***************************************************************************
|
|
|
|
|
* jopcyc_bus_read_start
|
|
|
|
|
* ***************************************************************************/
|
|
|
|
|
static void
|
|
|
|
|
jopcyc_bus_read_start( bus_t *bus, uint32_t adr )
|
|
|
|
|
static int
|
|
|
|
|
comp_bus_area( bus_t *bus, uint32_t adr, bus_area_t *area, component_t **comp )
|
|
|
|
|
{
|
|
|
|
|
part_t *p = PART;
|
|
|
|
|
chain_t *chain = CHAIN;
|
|
|
|
|
bus_area_t area;
|
|
|
|
|
component_t *comp;
|
|
|
|
|
|
|
|
|
|
if (adr < RAMB_START) {
|
|
|
|
|
area->description = "RAMA Component";
|
|
|
|
|
area->start = RAMA_START;
|
|
|
|
|
area->length = RAM_LENGTH;
|
|
|
|
|
area->width = RAM_DATA_WIDTH;
|
|
|
|
|
*comp = COMP_RAMA;
|
|
|
|
|
} else if (adr < FLASH_START) {
|
|
|
|
|
area->description = "RAMB Component";
|
|
|
|
|
area->start = RAMB_START;
|
|
|
|
|
area->length = RAM_LENGTH;
|
|
|
|
|
area->width = RAM_DATA_WIDTH;
|
|
|
|
|
*comp = COMP_RAMB;
|
|
|
|
|
} else if (adr < FLASH_START + FLASH_LENGTH) {
|
|
|
|
|
area->description = "FLASH Component";
|
|
|
|
|
area->start = FLASH_START;
|
|
|
|
|
area->length = FLASH_LENGTH;
|
|
|
|
|
area->width = FLASH_DATA_WIDTH;
|
|
|
|
|
*comp = COMP_FLASH;
|
|
|
|
|
} else {
|
|
|
|
|
area->description = "Dummy";
|
|
|
|
|
area->start = 2 * RAM_LENGTH + FLASH_LENGTH;
|
|
|
|
|
area->length = UINT64_C(0x100000000);
|
|
|
|
|
area->width = 0;
|
|
|
|
|
*comp = NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* bus->driver->(*area)
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
static int
|
|
|
|
|
jopcyc_bus_area( bus_t *bus, uint32_t adr, bus_area_t *area )
|
|
|
|
|
{
|
|
|
|
|
component_t *comp;
|
|
|
|
|
|
|
|
|
|
return comp_bus_area( bus, adr, area, &comp );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* bus->driver->(*read_start)
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
static void
|
|
|
|
|
jopcyc_bus_read_start( bus_t *bus, uint32_t adr )
|
|
|
|
|
{
|
|
|
|
|
part_t *p = PART;
|
|
|
|
|
chain_t *chain = CHAIN;
|
|
|
|
|
bus_area_t area;
|
|
|
|
|
component_t *comp;
|
|
|
|
|
|
|
|
|
|
comp_bus_area( bus, adr, &area, &comp );
|
|
|
|
|
if (!comp) {
|
|
|
|
|
printf( _("Address out of range\n") );
|
|
|
|
@ -314,10 +575,10 @@ jopcyc_bus_read_start( bus_t *bus, uint32_t adr )
|
|
|
|
|
chain_shift_data_registers( chain, 0 );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* ***************************************************************************
|
|
|
|
|
* jopcyc_bus_read_next
|
|
|
|
|
* ***************************************************************************/
|
|
|
|
|
/**
|
|
|
|
|
* bus->driver->(*read_next)
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
static uint32_t
|
|
|
|
|
jopcyc_bus_read_next( bus_t *bus, uint32_t adr )
|
|
|
|
|
{
|
|
|
|
@ -344,10 +605,10 @@ jopcyc_bus_read_next( bus_t *bus, uint32_t adr )
|
|
|
|
|
return d;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* ***************************************************************************
|
|
|
|
|
* jopcyc_bus_read_end
|
|
|
|
|
* ***************************************************************************/
|
|
|
|
|
/**
|
|
|
|
|
* bus->driver->(*read_end)
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
static uint32_t
|
|
|
|
|
jopcyc_bus_read_end( bus_t *bus )
|
|
|
|
|
{
|
|
|
|
@ -379,10 +640,10 @@ jopcyc_bus_read_end( bus_t *bus )
|
|
|
|
|
return d;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* ***************************************************************************
|
|
|
|
|
* jopcyc_bus_read
|
|
|
|
|
* ***************************************************************************/
|
|
|
|
|
/**
|
|
|
|
|
* bus->driver->(*read)
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
static uint32_t
|
|
|
|
|
jopcyc_bus_read( bus_t *bus, uint32_t adr )
|
|
|
|
|
{
|
|
|
|
@ -390,10 +651,10 @@ jopcyc_bus_read( bus_t *bus, uint32_t adr )
|
|
|
|
|
return jopcyc_bus_read_end( bus );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* ***************************************************************************
|
|
|
|
|
* jopcyc_bus_write
|
|
|
|
|
* ***************************************************************************/
|
|
|
|
|
/**
|
|
|
|
|
* bus->driver->(*write)
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
static void
|
|
|
|
|
jopcyc_bus_write( bus_t *bus, uint32_t adr, uint32_t data )
|
|
|
|
|
{
|
|
|
|
@ -432,269 +693,6 @@ jopcyc_bus_write( bus_t *bus, uint32_t adr, uint32_t data )
|
|
|
|
|
chain_shift_data_registers( chain, 0 );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* ***************************************************************************
|
|
|
|
|
* jopcyc_bus_area
|
|
|
|
|
* ***************************************************************************/
|
|
|
|
|
|
|
|
|
|
static int
|
|
|
|
|
comp_bus_area( bus_t *bus, uint32_t adr, bus_area_t *area, component_t **comp )
|
|
|
|
|
{
|
|
|
|
|
if (adr < RAMB_START) {
|
|
|
|
|
area->description = "RAMA Component";
|
|
|
|
|
area->start = RAMA_START;
|
|
|
|
|
area->length = RAM_LENGTH;
|
|
|
|
|
area->width = RAM_DATA_WIDTH;
|
|
|
|
|
*comp = COMP_RAMA;
|
|
|
|
|
} else if (adr < FLASH_START) {
|
|
|
|
|
area->description = "RAMB Component";
|
|
|
|
|
area->start = RAMB_START;
|
|
|
|
|
area->length = RAM_LENGTH;
|
|
|
|
|
area->width = RAM_DATA_WIDTH;
|
|
|
|
|
*comp = COMP_RAMB;
|
|
|
|
|
} else if (adr < FLASH_START + FLASH_LENGTH) {
|
|
|
|
|
area->description = "FLASH Component";
|
|
|
|
|
area->start = FLASH_START;
|
|
|
|
|
area->length = FLASH_LENGTH;
|
|
|
|
|
area->width = FLASH_DATA_WIDTH;
|
|
|
|
|
*comp = COMP_FLASH;
|
|
|
|
|
} else {
|
|
|
|
|
area->description = "Dummy";
|
|
|
|
|
area->start = 2 * RAM_LENGTH + FLASH_LENGTH;
|
|
|
|
|
area->length = UINT64_C(0x100000000);
|
|
|
|
|
area->width = 0;
|
|
|
|
|
*comp = NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static int
|
|
|
|
|
jopcyc_bus_area( bus_t *bus, uint32_t adr, bus_area_t *area )
|
|
|
|
|
{
|
|
|
|
|
component_t *comp;
|
|
|
|
|
|
|
|
|
|
return comp_bus_area( bus, adr, area, &comp );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static int
|
|
|
|
|
attach_sig( bus_t *bus, signal_t **sig, char *id )
|
|
|
|
|
{
|
|
|
|
|
int failed = 0;
|
|
|
|
|
|
|
|
|
|
*sig = part_find_signal( PART, id );
|
|
|
|
|
if (!*sig) {
|
|
|
|
|
printf( _("signal '%s' not found\n"), id );
|
|
|
|
|
failed = 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return failed;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static bus_t *
|
|
|
|
|
jopcyc_bus_new( chain_t *chain, char *cmd_params[] )
|
|
|
|
|
{
|
|
|
|
|
bus_t *bus;
|
|
|
|
|
int failed = 0;
|
|
|
|
|
component_t *comp;
|
|
|
|
|
|
|
|
|
|
if (!chain || !chain->parts || chain->parts->len <= chain->active_part || chain->active_part < 0)
|
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
|
|
bus = calloc( 1, sizeof (bus_t) );
|
|
|
|
|
if (!bus)
|
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
|
|
bus->driver = &jopcyc_bus;
|
|
|
|
|
bus->params = calloc( 1, sizeof (bus_params_t) );
|
|
|
|
|
if (!bus->params) {
|
|
|
|
|
free( bus );
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
CHAIN = chain;
|
|
|
|
|
PART = chain->parts->parts[chain->active_part];
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Setup RAMA
|
|
|
|
|
*/
|
|
|
|
|
comp = COMP_RAMA;
|
|
|
|
|
comp->ctype = RAM;
|
|
|
|
|
comp->cname = "RAMA";
|
|
|
|
|
|
|
|
|
|
failed |= attach_sig( bus, &(A[ 0]), "IO64" );
|
|
|
|
|
failed |= attach_sig( bus, &(A[ 1]), "IO66" );
|
|
|
|
|
failed |= attach_sig( bus, &(A[ 2]), "IO68" );
|
|
|
|
|
failed |= attach_sig( bus, &(A[ 3]), "IO74" );
|
|
|
|
|
failed |= attach_sig( bus, &(A[ 4]), "IO76" );
|
|
|
|
|
failed |= attach_sig( bus, &(A[ 5]), "IO107" );
|
|
|
|
|
failed |= attach_sig( bus, &(A[ 6]), "IO113" );
|
|
|
|
|
failed |= attach_sig( bus, &(A[ 7]), "IO115" );
|
|
|
|
|
failed |= attach_sig( bus, &(A[ 8]), "IO117" );
|
|
|
|
|
failed |= attach_sig( bus, &(A[ 9]), "IO119" );
|
|
|
|
|
failed |= attach_sig( bus, &(A[10]), "IO118" );
|
|
|
|
|
failed |= attach_sig( bus, &(A[11]), "IO116" );
|
|
|
|
|
failed |= attach_sig( bus, &(A[12]), "IO114" );
|
|
|
|
|
failed |= attach_sig( bus, &(A[13]), "IO108" );
|
|
|
|
|
failed |= attach_sig( bus, &(A[14]), "IO106" );
|
|
|
|
|
failed |= attach_sig( bus, &(A[15]), "IO67" );
|
|
|
|
|
failed |= attach_sig( bus, &(A[16]), "IO65" );
|
|
|
|
|
failed |= attach_sig( bus, &(A[17]), "IO63" );
|
|
|
|
|
A[18] = NULL;
|
|
|
|
|
|
|
|
|
|
failed |= attach_sig( bus, &(D[ 0]), "IO82" );
|
|
|
|
|
failed |= attach_sig( bus, &(D[ 1]), "IO84" );
|
|
|
|
|
failed |= attach_sig( bus, &(D[ 2]), "IO86" );
|
|
|
|
|
failed |= attach_sig( bus, &(D[ 3]), "IO88" );
|
|
|
|
|
failed |= attach_sig( bus, &(D[ 4]), "IO94" );
|
|
|
|
|
failed |= attach_sig( bus, &(D[ 5]), "IO98" );
|
|
|
|
|
failed |= attach_sig( bus, &(D[ 6]), "IO100" );
|
|
|
|
|
failed |= attach_sig( bus, &(D[ 7]), "IO104" );
|
|
|
|
|
failed |= attach_sig( bus, &(D[ 8]), "IO101" );
|
|
|
|
|
failed |= attach_sig( bus, &(D[ 9]), "IO99" );
|
|
|
|
|
failed |= attach_sig( bus, &(D[10]), "IO95" );
|
|
|
|
|
failed |= attach_sig( bus, &(D[11]), "IO93" );
|
|
|
|
|
failed |= attach_sig( bus, &(D[12]), "IO87" );
|
|
|
|
|
failed |= attach_sig( bus, &(D[13]), "IO85" );
|
|
|
|
|
failed |= attach_sig( bus, &(D[14]), "IO83" );
|
|
|
|
|
failed |= attach_sig( bus, &(D[15]), "IO79" );
|
|
|
|
|
|
|
|
|
|
failed |= attach_sig( bus, &(nCS), "IO78" );
|
|
|
|
|
failed |= attach_sig( bus, &(nOE), "IO73" );
|
|
|
|
|
failed |= attach_sig( bus, &(nWE), "IO105" );
|
|
|
|
|
failed |= attach_sig( bus, &(nLB), "IO77" );
|
|
|
|
|
failed |= attach_sig( bus, &(nUB), "IO75" );
|
|
|
|
|
nCS2 = NULL;
|
|
|
|
|
nRDY = NULL;
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Setup RAMB
|
|
|
|
|
*/
|
|
|
|
|
comp = COMP_RAMB;
|
|
|
|
|
comp->ctype = RAM;
|
|
|
|
|
comp->cname = "RAMB";
|
|
|
|
|
|
|
|
|
|
failed |= attach_sig( bus, &(A[ 0]), "IO237" );
|
|
|
|
|
failed |= attach_sig( bus, &(A[ 1]), "IO235" );
|
|
|
|
|
failed |= attach_sig( bus, &(A[ 2]), "IO233" );
|
|
|
|
|
failed |= attach_sig( bus, &(A[ 3]), "IO227" );
|
|
|
|
|
failed |= attach_sig( bus, &(A[ 4]), "IO225" );
|
|
|
|
|
failed |= attach_sig( bus, &(A[ 5]), "IO194" );
|
|
|
|
|
failed |= attach_sig( bus, &(A[ 6]), "IO188" );
|
|
|
|
|
failed |= attach_sig( bus, &(A[ 7]), "IO186" );
|
|
|
|
|
failed |= attach_sig( bus, &(A[ 8]), "IO184" );
|
|
|
|
|
failed |= attach_sig( bus, &(A[ 9]), "IO182" );
|
|
|
|
|
failed |= attach_sig( bus, &(A[10]), "IO183" );
|
|
|
|
|
failed |= attach_sig( bus, &(A[11]), "IO185" );
|
|
|
|
|
failed |= attach_sig( bus, &(A[12]), "IO187" );
|
|
|
|
|
failed |= attach_sig( bus, &(A[13]), "IO193" );
|
|
|
|
|
failed |= attach_sig( bus, &(A[14]), "IO195" );
|
|
|
|
|
failed |= attach_sig( bus, &(A[15]), "IO234" );
|
|
|
|
|
failed |= attach_sig( bus, &(A[16]), "IO236" );
|
|
|
|
|
failed |= attach_sig( bus, &(A[17]), "IO238" );
|
|
|
|
|
A[18] = NULL;
|
|
|
|
|
|
|
|
|
|
failed |= attach_sig( bus, &(D[ 0]), "IO219" );
|
|
|
|
|
failed |= attach_sig( bus, &(D[ 1]), "IO217" );
|
|
|
|
|
failed |= attach_sig( bus, &(D[ 2]), "IO215" );
|
|
|
|
|
failed |= attach_sig( bus, &(D[ 3]), "IO213" );
|
|
|
|
|
failed |= attach_sig( bus, &(D[ 4]), "IO207" );
|
|
|
|
|
failed |= attach_sig( bus, &(D[ 5]), "IO203" );
|
|
|
|
|
failed |= attach_sig( bus, &(D[ 6]), "IO201" );
|
|
|
|
|
failed |= attach_sig( bus, &(D[ 7]), "IO197" );
|
|
|
|
|
failed |= attach_sig( bus, &(D[ 8]), "IO200" );
|
|
|
|
|
failed |= attach_sig( bus, &(D[ 9]), "IO202" );
|
|
|
|
|
failed |= attach_sig( bus, &(D[10]), "IO206" );
|
|
|
|
|
failed |= attach_sig( bus, &(D[11]), "IO208" );
|
|
|
|
|
failed |= attach_sig( bus, &(D[12]), "IO214" );
|
|
|
|
|
failed |= attach_sig( bus, &(D[13]), "IO216" );
|
|
|
|
|
failed |= attach_sig( bus, &(D[14]), "IO218" );
|
|
|
|
|
failed |= attach_sig( bus, &(D[15]), "IO222" );
|
|
|
|
|
|
|
|
|
|
failed |= attach_sig( bus, &(nCS), "IO223" );
|
|
|
|
|
failed |= attach_sig( bus, &(nOE), "IO228" );
|
|
|
|
|
failed |= attach_sig( bus, &(nWE), "IO196" );
|
|
|
|
|
failed |= attach_sig( bus, &(nLB), "IO224" );
|
|
|
|
|
failed |= attach_sig( bus, &(nUB), "IO226" );
|
|
|
|
|
nCS2 = NULL;
|
|
|
|
|
nRDY = NULL;
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Setup FLASH
|
|
|
|
|
*/
|
|
|
|
|
comp = COMP_FLASH;
|
|
|
|
|
comp->ctype = FLASH;
|
|
|
|
|
comp->cname = "FLASH";
|
|
|
|
|
|
|
|
|
|
failed |= attach_sig( bus, &(A[ 0]), "IO47" );
|
|
|
|
|
failed |= attach_sig( bus, &(A[ 1]), "IO48" );
|
|
|
|
|
failed |= attach_sig( bus, &(A[ 2]), "IO49" );
|
|
|
|
|
failed |= attach_sig( bus, &(A[ 3]), "IO50" );
|
|
|
|
|
failed |= attach_sig( bus, &(A[ 4]), "IO125" );
|
|
|
|
|
failed |= attach_sig( bus, &(A[ 5]), "IO127" );
|
|
|
|
|
failed |= attach_sig( bus, &(A[ 6]), "IO131" );
|
|
|
|
|
failed |= attach_sig( bus, &(A[ 7]), "IO133" );
|
|
|
|
|
failed |= attach_sig( bus, &(A[ 8]), "IO158" );
|
|
|
|
|
failed |= attach_sig( bus, &(A[ 9]), "IO16" );
|
|
|
|
|
failed |= attach_sig( bus, &(A[10]), "IO20" );
|
|
|
|
|
failed |= attach_sig( bus, &(A[11]), "IO14" );
|
|
|
|
|
failed |= attach_sig( bus, &(A[12]), "IO135" );
|
|
|
|
|
failed |= attach_sig( bus, &(A[13]), "IO156" );
|
|
|
|
|
failed |= attach_sig( bus, &(A[14]), "IO144" );
|
|
|
|
|
failed |= attach_sig( bus, &(A[15]), "IO137" );
|
|
|
|
|
failed |= attach_sig( bus, &(A[16]), "IO139" );
|
|
|
|
|
failed |= attach_sig( bus, &(A[17]), "IO143" );
|
|
|
|
|
failed |= attach_sig( bus, &(A[18]), "IO141" );
|
|
|
|
|
|
|
|
|
|
failed |= attach_sig( bus, &(D[ 0]), "IO46" );
|
|
|
|
|
failed |= attach_sig( bus, &(D[ 1]), "IO45" );
|
|
|
|
|
failed |= attach_sig( bus, &(D[ 2]), "IO44" );
|
|
|
|
|
failed |= attach_sig( bus, &(D[ 3]), "IO165" );
|
|
|
|
|
failed |= attach_sig( bus, &(D[ 4]), "IO164" );
|
|
|
|
|
failed |= attach_sig( bus, &(D[ 5]), "IO17" );
|
|
|
|
|
failed |= attach_sig( bus, &(D[ 6]), "IO18" );
|
|
|
|
|
failed |= attach_sig( bus, &(D[ 7]), "IO19" );
|
|
|
|
|
D[ 8] = NULL;
|
|
|
|
|
D[ 9] = NULL;
|
|
|
|
|
D[10] = NULL;
|
|
|
|
|
D[11] = NULL;
|
|
|
|
|
D[12] = NULL;
|
|
|
|
|
D[13] = NULL;
|
|
|
|
|
D[14] = NULL;
|
|
|
|
|
D[15] = NULL;
|
|
|
|
|
|
|
|
|
|
failed |= attach_sig( bus, &(nWE), "IO15" );
|
|
|
|
|
failed |= attach_sig( bus, &(nOE), "IO24" );
|
|
|
|
|
failed |= attach_sig( bus, &(nCS), "IO37" );
|
|
|
|
|
failed |= attach_sig( bus, &(nCS2), "IO23" );
|
|
|
|
|
|
|
|
|
|
/* CLK1 is not observable :-(
|
|
|
|
|
failed |= attach_sig( bus, &(nRDY), "CLK1" );
|
|
|
|
|
*/
|
|
|
|
|
nRDY = NULL;
|
|
|
|
|
|
|
|
|
|
nLB = NULL;
|
|
|
|
|
nUB = NULL;
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Setup Serial Port
|
|
|
|
|
*/
|
|
|
|
|
failed |= attach_sig( bus, &(SER_RXD), "CLK2" );
|
|
|
|
|
failed |= attach_sig( bus, &(SER_NRTS), "IO177" );
|
|
|
|
|
failed |= attach_sig( bus, &(SER_TXD), "IO178" );
|
|
|
|
|
failed |= attach_sig( bus, &(SER_NCTS), "CLK0" );
|
|
|
|
|
|
|
|
|
|
if (failed) {
|
|
|
|
|
free( bus->params );
|
|
|
|
|
free( bus );
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return bus;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const bus_driver_t jopcyc_bus = {
|
|
|
|
|
"jopcyc",
|
|
|
|
|
N_("JOP.design Cyclone Board compatible bus driver via BSR"),
|
|
|
|
|