Page 1 of 1

WinCUPL question(s)

Posted: Sun Apr 08, 2018 8:59 am
by Jokse
I'm doing a FIELD in WinCUPL for a 22V10, but as soon as I want to use the .d flip flop part for synchronizing with a master clock on pin one, using something like out.d = input:[0..2FF] doesn't work... Do I really have to spell out the full logic equation or is there some way to get around that?

Code: Select all

Name Test;
PartNo 01;
Date 04-04-2018;
Revision 01;
Designer Flaf;
Company Flaf;
Assembly Flaf;
Location Flaf;
Device p22v10;

PIN 1 = clk;
PIN [2,3,4,5,6,7,8,9,10,11] = [in0..9];
PIN 22 = output;
FIELD input = [in9..0];
output.ar = 'b'0;
output.sp = 'b'0;
output.d = input:[0..2FF];

Code: Select all

  17:output.d = input:[0..2FF];
                           ^
[002ca] invalid number: 2FF
[002ca] invalid number: 2FF
[002ca] invalid number: 2FF
Total time: 0 secs 

Re: WinCUPL question(s)

Posted: Sun Apr 08, 2018 12:23 pm
by Martin A
It would appear to work if you use 'h'2ff instead of just 2ff. Not sure why the explicit hex definition is needed though.

Re: WinCUPL question(s)

Posted: Sun Apr 08, 2018 2:29 pm
by Jokse
Martin A wrote:
It would appear to work if you use 'h'2ff instead of just 2ff. Not sure why the explicit hex definition is needed though.
That certainly did the trick! Thanks!

Re: WinCUPL question(s)

Posted: Sun Apr 08, 2018 9:00 pm
by BigDumbDinosaur
Martin A wrote:
It would appear to work if you use 'h'2ff instead of just 2ff. Not sure why the explicit hex definition is needed though.
The hex reference is required because decimal is the default in CUPL. Without the 'h' prefix, the compiler might try to evaulate the 2ff part as a variable.

Re: WinCUPL question(s)

Posted: Mon Apr 09, 2018 8:02 am
by Martin A
I always thought hex was the default, the following code from one of my projects compiles correctly without any explicit 'h' declarations.

Code: Select all

Name     AtomGAL ;
PartNo   00 ;
Date     09/02/2018 ;
Revision 01 ;
Designer Engineer ;
Company  None ;
Assembly None ;
Location  ;
Device   p22v10 ;

/* *************** INPUT PINS *********************/
PIN   1  = A12                      ; /*                                 */ 
PIN   2  = A13                      ; /*                                 */ 
PIN   3  = A14                      ; /*                                 */ 
PIN   4  = A15                      ; /*                                 */ 
PIN   5  = A11                      ; /*                                 */ 
PIN   6  = A10                      ; /*                                 */ 
PIN   7  = A9                       ; /*                                 */ 
PIN   8  = rw                       ; /*                                 */ 
PIN   9  = phi2                     ; /*                                 */ 



/* *************** OUTPUT PINS *********************/
PIN  14   = wr                      ; /*                                 */ 
PIN  15   = rd                      ; /*                                 */ 
PIN  16   = ma2                     ; /*                                 */ 
PIN  17   = vram                    ; /*                                 */ 
PIN  18   = io6                     ; /*                                 */ 
PIN  19   = io4                     ; /*                                 */ 
PIN  20   = io2                     ; /*                                 */ 
PIN  21   = io0                     ; /*                                 */ 
PIN  22   = ramcs                   ; /*                                 */ 
PIN  23   = romcs                   ; /*                                 */ 


Field address = [A15..0];

!ramcs = address:[0000..7FFF] ;

!io0 =address:[B000..B3FF] ;

!io2 =address:[B400..B7FF] ;

!io4 =address:[B800..BBFF] ;

!io6 =address:[BC00..BFFF] ;

!romcs = address:[C000..FFFF] ;

!vram = address:[8000..97FF] ;

!ma2 = address:[A000..AFFF] ;

!rd =  rw & phi2  ;

!wr = !rw & phi2  ;


Re: WinCUPL question(s)

Posted: Mon Apr 09, 2018 8:29 am
by Tor
Maybe WinCUPL will understand [02FF] as hex, but not [2FF] (without the 'h')?

Re: WinCUPL question(s)

Posted: Mon Apr 09, 2018 10:39 am
by BigEd
Maybe a 10 bit number, not being an even number of nibbles, throws it.

Is it worth padding the zero to make the numbers the same length?

Code: Select all

output.d = input:[000..2FF];

Re: WinCUPL question(s)

Posted: Sun Apr 29, 2018 12:07 am
by cbscpe
The default is hex. But it is overwritten when using a prefix, like in your case you say

Code: Select all

output.ar = ´b´0
after that the default is binary.