6502.org
http://forum.6502.org/

WinCUPL simulation-arghh!
http://forum.6502.org/viewtopic.php?f=10&t=3367
Page 1 of 1

Author:  banedon [ Sun Jul 12, 2015 10:16 am ]
Post subject:  WinCUPL simulation-arghh!

Ok, I might be just seeing the wood for the trees, but I cannot see why I'm getting a CSIM error complaining about the parameters in the .SI file.

Would anyone be willing to cast a fresh set of eyes over this for me?

This is the code:

Code:
Name       AddressDecoder1;
Partno     Lattice22V10B;
Date       11/07/15;
Revision   01;
Designer   shalewyn.com;
Company    shalewyn.com;
Assembly   1;
Location   1;
Device     g22v10;

/*
 * Lattice GAL 22V10B pinout, DIP, top view
 *
 * I/CLK.[ 1     24 ].VCC
 *     I.[ 2     23 ].I/O/Q
 *     I.[ 3     22 ].I/O/Q
 *     I.[ 4     21 ].I/O/Q
 *     I.[ 5     20 ].I/O/Q
 *     I.[ 6     19 ].I/O/Q
 *     I [ 7     18 ].I/O/Q
 *     I [ 8     17 ].I/O/Q
 *     I [ 9     16 ].I/O/Q
 *     I [ 10    15 ].I/O/Q
 *     I [ 11    14 ].I/O/Q
 *   GND.[ 12    13 ].I
 *
 */


/*
 * Inputs
 */

Pin 1 = phi2;
Pin 2 = cpuRW;
Pin [3..10] = [A15..8];
/*
 * Outputs
 */

Pin [16..23] = [S0..7];

/*
Pin [16] = s[0];   nROM select;
Pin [17] = s[1];   nRAM select;
Pin [18] = s[2];   nLatch1 select;
Pin [19] = s[3];   nVIA #1
Pin [20] = s[4];   nVIA #2
Pin [21] = s[5];   nACIA 
Pin [22] = s[6];   nWR;   
Pin [23] = s[7];   nRD;   
*/



/*
 * Main
 */

FIELD AddressBus = [A15..8];
FIELD Selects = [S7..0];


/* Note that each device which can be written to has 2 entries - one for reading and
 * one for writing. This is because writing should only ever happen when phi2 is HI
 * so we need one rule which allows read if cpuRW is HI and one rule which only
 * allows writes when cpuRW is LOW and phi2 is HI.
 * ADDENDUM: I've chnaged this so that both read & write need phi2 to be high. This is
 * to make it compatible with the 65C816. */



TABLE AddressBus => Selects {
   [0000..1FFF] => 'b'01000001 & cpuRW & phi2;       /* Non-swap RAM read */
   [0000..1FFF] => 'b'01000010 & !cpuRW & phi2;    /* Non-swap RAM write */

   [2000..7FFF] => 'b'01000001 & cpuRW & phi2;       /* Swap RAM read */
   [2000..7FFF] => 'b'01000010 & !cpuRW & phi2;    /* Swap RAM write */

   [8100..810F] => 'b'00010001 & cpuRW;          /* VIA #1 read */
   [8100..810F] => 'b'00010010 & !cpuRW;          /* VIA #1 write */

   [8200..820F] => 'b'00001001 & cpuRW;          /* VIA #2 read */
   [8200..820F] => 'b'00001010 & !cpuRW;          /* VIA #2 write */

   [8300..830F] => 'b'00000101 & cpuRW;          /* ACIA read */
   [8300..830F] => 'b'00000110 & !cpuRW;          /* ACIA write */
   
   [9000..FFFF] => 'b'10000001 & phi2;          /* ROM read*/
}


This is the SI file:
Code:
Name     AddressDecoder1;
PartNo   Lattice22V10B;
Date     11/07/15;
Revision 01;
Designer shalewyn.com;
Company  shalewyn.com;
Assembly 1;
Location 1;
Device   g22v10;


ORDER: phi2, cpuRW, A15..A8, S0, S1, S2, S3, S4, S5, S6, S7;


VECTORS:
/* each test comprises of a set of read and a set of writes.
* 1st test is for PHI2 being HI and the 2nd for PHI being LOW */
/* Base RAM test 2xRead, 2xW1rite */
1 1 '1000' ********
1 1 '3000' ********
1 1 '8100' ********
1 1 'A000' ********


The error that I'm getting:
Attachment:
wincupl_error.jpg
wincupl_error.jpg [ 17.79 KiB | Viewed 5077 times ]


The SO file is giving me '[0014sa] insufficient test values', but I cannot see where i'm goign wrong on the SI file. I've tried inserting a BASE=HEX statement, but this doesn't help.

Author:  BigEd [ Sun Jul 12, 2015 10:47 am ]
Post subject:  Re: WinCUPL simulation-arghh!

A15..8 is only one byte wide, but your values are four nibbles wide - is that relevant?

(I also note that sometimes you use S0..7 and sometimes S7..0 - not sure whether that would cause trouble but always using the same order might be a good idea)

Edit: also, I see both A15..A8 and A15..8 notations - are both valid?

Author:  banedon [ Sun Jul 12, 2015 11:14 am ]
Post subject:  Re: WinCUPL simulation-arghh!

Well spotted on the A15..A8 vs A15..8 in the SI file. I've corrected that, although I still get an error. i don't think the order of S7..0 vs S0..7 matters too much as I've already tried swapping these around. It definitely has issues with the ph2 and cpuRW as when I get subscrit out of range when going into the simulator along with the following:
Attachment:
wincupl_error2.jpg
wincupl_error2.jpg [ 64.72 KiB | Viewed 5069 times ]


WinCUPL is both a blessing and a curse! :mrgreen:

Author:  BigEd [ Sun Jul 12, 2015 11:18 am ]
Post subject:  Re: WinCUPL simulation-arghh!

What about the question of width? It looks like you've got 16-bit addresses and an 8-bit variable.

Author:  banedon [ Sun Jul 12, 2015 12:02 pm ]
Post subject:  Re: WinCUPL simulation-arghh!

If I chnage the SI file to relfect A15..A0 then it comes back with the same error. I've previously used partial address bus in another project like this and not had issues.'Tis very odd!

Author:  BigEd [ Sun Jul 12, 2015 12:47 pm ]
Post subject:  Re: WinCUPL simulation-arghh!

Does the SI file have to match the other file? The top byte of the address bus is only a byte, so I'm surprised to see you can match it with 16 bit values like 1FFF.

Author:  JenniferDigital [ Sun Jul 12, 2015 12:54 pm ]
Post subject:  Re: WinCUPL simulation-arghh!

If I remember correctly I found that assigning ranges that don't start at zero gave me issues with my address decoder. I ended up packing low order bits. So you have A15..A8 leaving A7..A0 nonexistent but the software doesn't see it that way.

I'm still new here but that's my ten pence worth. Give it a go. If I'm wrong it's easy to back out of.

Author:  banedon [ Sun Jul 12, 2015 2:15 pm ]
Post subject:  Re: WinCUPL simulation-arghh!

Ok, tried the following and now simply get a "CISM errors encountered" error but with no line showing which error.


Code:
Name       AddressDecoder1;
Partno     Lattice22V10B;
Date       11/07/15;
Revision   01;
Designer   shalewyn.com;
Company    shalewyn.com;
Assembly   1;
Location   1;
Device     g22v10;

/*
 * Lattice GAL 22V10B pinout, DIP, top view
 *
 * I/CLK.[ 1     24 ].VCC
 *     I.[ 2     23 ].I/O/Q
 *     I.[ 3     22 ].I/O/Q
 *     I.[ 4     21 ].I/O/Q
 *     I.[ 5     20 ].I/O/Q
 *     I.[ 6     19 ].I/O/Q
 *     I [ 7     18 ].I/O/Q
 *     I [ 8     17 ].I/O/Q
 *     I [ 9     16 ].I/O/Q
 *     I [ 10    15 ].I/O/Q
 *     I [ 11    14 ].I/O/Q
 *   GND.[ 12    13 ].I
 *
 */


/*
 * Inputs
 */

Pin 1 = phi2;
Pin 2 = cpuRW;
Pin [3..10] = [A7..0];
/*
 * Outputs
 */

Pin [16..23] = [S0..7];

/*
Pin [16] = s[0];   nROM select;
Pin [17] = s[1];   nRAM select;
Pin [18] = s[2];   nLatch1 select;
Pin [19] = s[3];   nVIA #1
Pin [20] = s[4];   nVIA #2
Pin [21] = s[5];   nACIA 
Pin [22] = s[6];   nWR;   
Pin [23] = s[7];   nRD;   
*/



/*
 * Main
 */

FIELD AddressBus = [A7..0];
FIELD Selects = [S7..0];


/* Note that each device which can be written to has 2 entries - one for reading and
 * one for writing. This is because writing should only ever happen when phi2 is HI
 * so we need one rule which allows read if cpuRW is HI and one rule which only
 * allows writes when cpuRW is LOW and phi2 is HI.
 * ADDENDUM: I've chnaged this so that both read & write need phi2 to be high. This is
 * to make it compatible with the 65C816. */



TABLE AddressBus => Selects {
   [00..1F] => 'b'01000001 & cpuRW & phi2;       /* Non-swap RAM read */
   [00..1F] => 'b'01000010 & !cpuRW & phi2;    /* Non-swap RAM write */

   [20..7F] => 'b'01000001 & cpuRW & phi2;       /* Swap RAM read */
   [20..7F] => 'b'01000010 & !cpuRW & phi2;    /* Swap RAM write */

   [81..81] => 'b'00010001 & cpuRW;          /* VIA #1 read */
   [81..81] => 'b'00010010 & !cpuRW;          /* VIA #1 write */

   [82..82] => 'b'00001001 & cpuRW;          /* VIA #2 read */
   [82..82] => 'b'00001010 & !cpuRW;          /* VIA #2 write */

   [83..83] => 'b'00000101 & cpuRW;          /* ACIA read */
   [83..83] => 'b'00000110 & !cpuRW;          /* ACIA write */
 
   [90..FF] => 'b'10000001 & phi2;          /* ROM read*/
}


The .SI file:

Code:
Name     AddressDecoder1;
PartNo   Lattice22V10B;
Date     11/07/15;
Revision 01;
Designer shalewyn.com;
Company  shalewyn.com;
Assembly 1;
Location 1;
Device   g22v10;


ORDER: phi2, cpuRW, A7..A0, S0, S1, S2, S3, S4, S5, S6, S7;


VECTORS:
/* each test comprises of a set of read and a set of writes.
* 1st test is for PHI2 being HI and the 2nd for PHI being LOW */
/* Base RAM test 2xRead, 2xW1rite */
1 1 '10' ********
1 1 '30' ********
1 1 '81' ********
1 1 'A0' ********

Author:  banedon [ Sun Jul 12, 2015 2:19 pm ]
Post subject:  Re: WinCUPL simulation-arghh!

Tried putting this test data into the .SI file, but stillnothing. I get no .SIM, .WO, .SO files

Code:
1 1 00010000 ********
1 1 00110000 ********
1 1 10000001 ********
1 1 10100000 ********

Author:  BigEd [ Sun Jul 12, 2015 2:40 pm ]
Post subject:  Re: WinCUPL simulation-arghh!

If 'b' is the right prefix for binary, is there a prefix for hex?

Author:  banedon [ Sun Jul 12, 2015 3:05 pm ]
Post subject:  Re: WinCUPL simulation-arghh!

I think I've gotten to the bottom of this. Desktop & My Documents. Weirldy, WinCUPL was having issues with these two locations. Existing projects were fine from there, but not new ones. As soon as I copied the base folder to another drive or to a folder within root, etc., it was fine. I'll take a look at the NTFS permissions in a sec (Non-NTFS Read flag was set ok when I checked earlier).
BTW I have no antivirus currently installed on that machine (just in case you're wondering).

What a massive waste of time. LOL.

Thanks for your help and advice, BigEd & DigitalDunc :).

Author:  banedon [ Sun Jul 12, 2015 3:15 pm ]
Post subject:  Re: WinCUPL simulation-arghh!

BTW, the following .SI file does work:

Code:
Name     AddressDecoder1;
PartNo   Lattice22V10B;
Date     11/07/15;
Revision 01;
Designer shalewyn.com;
Company  shalewyn.com;
Assembly 1;
Location 1;
Device   g22v10;


ORDER: phi2, cpuRW, A15..8, S0, S1, S2, S3, S4, S5, S6, S7;
BASE: Hex;

VECTORS:
11 '10' ********
11 '30' ********
11 '81' ********
11 'A0' ********


The BASE: Hex; line tells the simulator how to treat the values within the single quotes. You can also use OCT and DEC as well.

Author:  BigDumbDinosaur [ Mon Jul 13, 2015 3:49 am ]
Post subject:  Re: WinCUPL simulation-arghh!

banedon wrote:
I think I've gotten to the bottom of this. Desktop & My Documents.

NEVER, NEVER, NEVER, NEVER...NEVER store ANYTHING IMPORTANT on the desktop!!!

:lol:

I admonish my clients with that constantly, because when a user profile gets bunged up the desktop usually gets corrupted and files start vanishing. Store all your WinCUPL work in a separate directory.

Author:  banedon [ Mon Jul 13, 2015 12:08 pm ]
Post subject:  Re: WinCUPL simulation-arghh!

I totally agree as I'm always sorting other peoples as well :). I typically take a backup at the end of every day and pop it in a version folder on my Synology DS412+ NAS (RAID10).

The only time it's safe to use My Docs etc is if it's taken out of the profile and folder redirected to a server location which is backed up.

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/