6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Thu Nov 21, 2024 11:07 pm

All times are UTC




Post new topic Reply to topic  [ 76 posts ]  Go to page Previous  1, 2, 3, 4, 5, 6  Next
Author Message
PostPosted: Sun May 15, 2022 3:47 pm 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10985
Location: England
If your little block of ROM at the top of bank 0 was 1k instead of 256 bytes, would that remove two terms from the calculations?


Top
 Profile  
Reply with quote  
PostPosted: Sun May 15, 2022 4:38 pm 
Offline

Joined: Sat Feb 19, 2022 10:14 pm
Posts: 147
BigEd wrote:
If your little block of ROM at the top of bank 0 was 1k instead of 256 bytes, would that remove two terms from the calculations?

Yes indeed, thanks! I didn't think of that. Using
Code:
ROM = Address:[FC00..1FFFF];
instead of
Code:
ROM = Address:[FF00..1FFFF];
uses 16 product terms for RAM_CS and fits in the PLD.

That's probably a good compromise to get over the problem of RAM being selected during writes to ROM to get the 256 byte version to work. And it gives me more ROM in bank 0 should the need arise.


Top
 Profile  
Reply with quote  
PostPosted: Sun May 15, 2022 4:47 pm 
Offline

Joined: Fri Jul 09, 2021 10:12 pm
Posts: 741
If you have spare output pins, you can also use them as intermediates to let you effectively use more product terms for an output you do care about. I don't think WinCUPL can do it for you though.

In your case you'd just have to give RAM and/or EXRAM pin assignments to make that happen. You'd still require them individually to fit within the product term limits of the device.

Also note that the product term limits per pin vary a bit, and sometimes you may get better results by not assigning pin numbers manually and letting WinCUPL do it for you. You need to pay attention though when you revise the code, as if it changes them around later then you'll need to update your circuit. Next time you run out it might be worth letting it pick the pins and seeing if that helps, then baking the arrangement it uses explicitly into your code to stop it varying later on.

Edit - another thought - this is very challenging:
Code:
EXRAM     = Address:[20100..7FFFF];

But given IO already exists, I think it's equivalent to:
Code:
EXRAM     = Address:[20000..7FFFF] & !IO_CS;

Similarly, these are equivalent I think:
Code:
RAM       = Address:[0000..FEFF];
RAM       = Address:[0000..FFFF] & !ROM_CS;


Top
 Profile  
Reply with quote  
PostPosted: Sun May 15, 2022 5:16 pm 
Offline

Joined: Sat Feb 19, 2022 10:14 pm
Posts: 147
gfoot wrote:
If you have spare output pins, you can also use them as intermediates ...

Unfortunately I've used all inputs and outputs for this PLD. Any change means adding a chip to my design, which I want to avoid (silly goal yes, but I want this to fit on a 100x100 mm PCB). Good to know this option though. I had heard it mentioned elsewhere but haven't seen any concrete examples.

gfoot wrote:
Also note that the product term limits per pin vary a bit, and sometimes you may get better results by not assigning pin numbers manually and letting WinCUPL do it for you.

Thanks, I didn't know WINCUPL could do that. I did rearrange my pin assignments and wiring to accommodate getting RAM_CS on a pin with the maximum number of product terms but it's good to know that WINCUPL will do that too. Probably best for a first cut though, for the reasons you mention as well as PCB layout and routing.

Edit:
gfoot wrote:
Edit - another thought - this is very challenging:
Code:
EXRAM     = Address:[20100..7FFFF];

But given IO already exists, I think it's equivalent to:
Code:
EXRAM     = Address:[20000..7FFFF] & !IO_CS;

Similarly, these are equivalent I think:
Code:
RAM       = Address:[0000..FEFF];
RAM       = Address:[0000..FFFF] & !ROM_CS;

This does compile and the resulting ROM_CS looks correct
Code:
!RAM_CS =>
    !A16 & !A17 & !A18 & !ROM_CS
  # !A17 & A18 & !IO_CS
  # A17 & !IO_CS

Interestingly, RAM_CS is down to 3 product terms! I'm going to test it on hardware, but think you won the challenge.


Top
 Profile  
Reply with quote  
PostPosted: Sun May 15, 2022 6:16 pm 
Offline

Joined: Fri Jul 09, 2021 10:12 pm
Posts: 741
tmr4 wrote:
gfoot wrote:
If you have spare output pins, you can also use them as intermediates ...

Unfortunately I've used all inputs and outputs for this PLD. Any change means adding a chip to my design, which I want to avoid (silly goal yes, but I want this to fit on a 100x100 mm PCB). Good to know this option though. I had heard it mentioned elsewhere but haven't seen any concrete examples.

If I remember correctly, all you do is remove the pin numbers - still declare them as pins, but without specific numbers. Then use the diagram it outputs to tell you which ended up where!

More advanced PLDs have internal macrocells just for this purpose, not connected to physical pins at all. For those you write "PinNode" I think instead of "Pin". I'm not sure, but this syntax might also work for the 22V10, just allocating a real pin instead. If it works then it'd make it clearer in the code that it's not intended as an actual output.

Quote:
Interestingly, RAM_CS is down to 3 product terms! I'm going to test it on hardware, but think you won the challenge.

The only thing to be a little wary of is there's potentially an extra propagation delay now. But hopefully the chip is fast enough that that doesn't matter for your case.


Top
 Profile  
Reply with quote  
PostPosted: Sun May 15, 2022 6:37 pm 
Offline

Joined: Sat Feb 19, 2022 10:14 pm
Posts: 147
gfoot wrote:
PinNode" I think instead of "Pin". I'm not sure, but this syntax might also work for the 22V10, just allocating a real pin instead. If it works then it'd make it clearer in the code that it's not intended as an actual output.

Ah. That's how that works. I'll give it a try. I'm definitely not using all of this PLD's capability on most pins. Perhaps they're available elsewhere if not used.

gfoot wrote:
Quote:
Interestingly, RAM_CS is down to 3 product terms! I'm going to test it on hardware, but think you won the challenge.

The only thing to be a little wary of is there's potentially an extra propagation delay now. But hopefully the chip is fast enough that that doesn't matter for your case.

Maybe that's the problem, becuase the code you suggested compiles but doesn't work on hardware. On the scope though it looks more fundamental than that. There are periods of several clock cycles where no device, RAM, or ROM have been selected. I think that's impossible with my memory map and very inconsistent with what I was observing yesterday in which something was always selected regardless of my PLD coding choice.

Edit:
I was hoping to use the logic info from WINCUPL's DOC file to do a sort of before and after comparison to see what was going on, but the logic your consolidated addressing isn't at all similar to that from my other tries, both working versions and ones that won't fit in the PLD, but with very plain addressing. I suppose, as indicated by my scope, something is missing.


Top
 Profile  
Reply with quote  
PostPosted: Sun May 15, 2022 7:29 pm 
Offline

Joined: Fri Jul 09, 2021 10:12 pm
Posts: 741
Could you post the updated code? And does it work in the simulator?


Top
 Profile  
Reply with quote  
PostPosted: Sun May 15, 2022 8:53 pm 
Offline

Joined: Sat Feb 19, 2022 10:14 pm
Posts: 147
gfoot wrote:
Could you post the updated code? And does it work in the simulator?

Here is the updated code. Perhaps I didn't properly translate your intent.
Code:
Device   g22V10 ;

/* Input */
Pin 1        = CLK;
Pin 2        = RW;
Pin [3..10]  = [A15..A8];
Pin 11       = A16;
Pin 22       = A17;
Pin 13       = VIA_IRQ1;
Pin 14       = A18;
Pin 15       = ACIAs_IRQ;

/* Output */
Pin 16 = CLKB;
Pin 17 = WE;
Pin 18 = ROM_CS;
Pin 19 = RAM_CS;
Pin 20 = OE;
Pin 21 = IO_CS;
Pin 23 = IRQ;

/* Local Variables */
FIELD Address = [A18..A8];

/* Logic */
RAM       = Address:[0000..FFFF] & !ROM_CS;
ROM       = Address:[FF00..1FFFF];
EXRAM     = Address:[20000..7FFFF] & !IO_CS;
IO        = Address:[20000..200FF];

CLKB      = !CLK;
!WE       = CLK & !RW;
!OE       = CLK & RW;
!RAM_CS   = RAM # EXRAM;
!ROM_CS   = ROM & RW;
!IO_CS    = IO;
IRQ       = VIA_IRQ1 & ACIAs_IRQ;

I didn't prepare a simulation file for the expanded memory map. But I suppose that would show me where this is going wrong. Oh the corners I cut when things appear to work.


Top
 Profile  
Reply with quote  
PostPosted: Sun May 15, 2022 10:29 pm 
Offline

Joined: Fri Jul 09, 2021 10:12 pm
Posts: 741
Ah I missed that !ROM_CS also involved RW so now writes to ROM addresses will actually activate the RAM. But it doesn't really sound like the bug you described.

Oh, the problem is with the inverting. ROM_CS and IO_CS are active low. So you should remove the '!' from the RAM and EXRAM lines. I usually put the inversion in the pin description like BDD suggested, for signals that are active low - I get what you mean though, that it might not make sense in your head with it done that way. But if you consistently follow the rule is that all variables are active high, it can get easier to intuitively understand the expressions.

Code:
RAM       = Address:[0000..FFFF] & ROM_CS;
ROM       = Address:[FF00..1FFFF];
EXRAM     = Address:[20000..7FFFF] & IO_CS;
IO        = Address:[20000..200FF];


Top
 Profile  
Reply with quote  
PostPosted: Sun May 15, 2022 11:52 pm 
Offline

Joined: Sat Feb 19, 2022 10:14 pm
Posts: 147
gfoot wrote:
Ah I missed that !ROM_CS also involved RW so now writes to ROM addresses will actually activate the RAM. But it doesn't really sound like the bug you described.

Oh, the problem is with the inverting. ROM_CS and IO_CS are active low. So you should remove the '!' from the RAM and EXRAM lines. I usually put the inversion in the pin description like BDD suggested, for signals that are active low - I get what you mean though, that it might not make sense in your head with it done that way. But if you consistently follow the rule is that all variables are active high, it can get easier to intuitively understand the expressions.

Code:
RAM       = Address:[0000..FFFF] & ROM_CS;
ROM       = Address:[FF00..1FFFF];
EXRAM     = Address:[20000..7FFFF] & IO_CS;
IO        = Address:[20000..200FF];

Yes, I noticed that after a while. This does work on my build, but,

and now, drumroll ...

I can chalk this all up to user error, or if we're being kind, user inexperience at the minimum. Researching your PinNode reference I came across a CUPL Language tutorial. It wasn't much help with PinNodes but when I searched it for "product term" it took me right to the page on logic minimizations. I'd been using Quick, a recommendation I'd read about when I first downloaded WINCUPL. Turns out that Quine McCluskey works with my desired memory map.
Code:
FIELD Address = [A18..A8];
RAM       = Address:[0000..FEFF];
ROM       = Address:[FF00..1FFFF];
EXRAM     = Address:[20100..7FFFF];
IO        = Address:[20000..200FF];


!RAM_CS   = RAM # EXRAM;
!ROM_CS   = ROM & RW;
!IO_CS    = IO;

RAM_CS uses 13 product terms, ROM_CS just 2. Some intermediate terms use a lot more. EXRAM for example uses 56, the same as before, but obviously WINCUPL is minimizing this away with the Quine McCluskey setting. Interestingly, the tutorial says to
Quote:
Use this only if necessary

Still, this was a good experience and I learned a lot.

Thanks to everyone for there help!


Top
 Profile  
Reply with quote  
PostPosted: Mon May 16, 2022 1:48 am 
Offline
User avatar

Joined: Thu May 28, 2009 9:46 pm
Posts: 8504
Location: Midwestern USA
tmr4 wrote:
Researching your PinNode reference I came across a CUPL Language tutorial.

You might find the attached useful. The material at the link you mentioned is quite out of date.

Attachment:
File comment: WinCUPL Reference
wincupl.pdf [349.68 KiB]
Downloaded 86 times
Attachment:
File comment: CUPL Programmer’s Reference
cupl_reference.pdf [814.53 KiB]
Downloaded 76 times

_________________
x86?  We ain't got no x86.  We don't NEED no stinking x86!


Top
 Profile  
Reply with quote  
PostPosted: Mon May 16, 2022 1:58 am 
Offline
User avatar

Joined: Thu May 28, 2009 9:46 pm
Posts: 8504
Location: Midwestern USA
gfoot wrote:
More advanced PLDs have internal macrocells just for this purpose, not connected to physical pins at all. For those you write "PinNode" I think instead of "Pin". I'm not sure, but this syntax might also work for the 22V10, just allocating a real pin instead.

PINNODE is meant for use with buried logic, which the 22V10 doesn’t have.

It appears this design has gotten “painted into a corner” due to the limitations of the 22V10.

_________________
x86?  We ain't got no x86.  We don't NEED no stinking x86!


Top
 Profile  
Reply with quote  
PostPosted: Mon May 16, 2022 8:13 am 
Offline

Joined: Sat Feb 19, 2022 10:14 pm
Posts: 147
BigDumbDinosaur wrote:
You might find the attached useful. The material at the link you mentioned is quite out of date.

Thanks. I'd like to say I wish I had these earlier, but I already had the user manual, but didn't think to look at it. The reference I linked to though covered the area I needed better. I don't think the user manual would have gotten me to the same point.

BigDumbDinosaur wrote:
It appears this design has gotten “painted into a corner” due to the limitations of the 22V10.

It seems the 22V10 still has a ways to go, at least with respect to my design, once I learned how to use the software properly. The following code compiles (and works) just fine with Quine McCluskey minimization. It's what I was originally trying to do but wouldn't compile with the Quick minimization setting I'd been using.
Code:
Device   g22V10 ;

/* Input */
Pin 1        = CLK;
Pin 2        = RW;
Pin [3..10]  = [A15..A8];
Pin 11       = A16;
Pin 22       = A17;
Pin 13       = VIA_IRQ1;
Pin 14       = A18;
Pin 15       = ACIAs_IRQ;

/* Output */
Pin 16 = CLKB;
Pin 17 = WE;
Pin 18 = ROM_CS;
Pin 19 = RAM_CS;
Pin 20 = OE;
Pin 21 = IO_CS;
Pin 23 = IRQ;

/* Local Variables */
FIELD Address = [A18..A8];

/* Logic */
/* This requires Quine-McCluskey minimization to compile */
RAM       = Address:[0000..FEFF];
ROM       = Address:[FF00..1FFFF];
IO        = Address:[20000..200FF];
EXRAM     = Address:[20100..7FFFF];

CLKB      = !CLK;
!WE       = CLK & !RW;
!OE       = CLK & RW;
!RAM_CS   = RAM # EXRAM;
!ROM_CS   = ROM & RW;
!IO_CS    = IO;
IRQ       = VIA_IRQ1 & ACIAs_IRQ;


Top
 Profile  
Reply with quote  
PostPosted: Mon May 16, 2022 8:25 am 
Offline
User avatar

Joined: Fri Aug 30, 2002 1:09 am
Posts: 8543
Location: Southern California
tmr4, check your PMs, and set PM notification in your User Control Panel --> Board preferences (on the left side of the screen). Click the "Yes" button beside "Notify me on new private messages:", also the ones beside "Pop up window on new private message:" and "Allow users to send you private messages:" The pop-up window will look something like this:
Attachment:
PMnotificationWindow.gif
PMnotificationWindow.gif [ 45.43 KiB | Viewed 23401 times ]

(I'm using the ProSilver forum background as opposed to the other one I think most users are on which is brown instead of blue.)

_________________
http://WilsonMinesCo.com/ lots of 6502 resources
The "second front page" is http://wilsonminesco.com/links.html .
What's an additional VIA among friends, anyhow?


Top
 Profile  
Reply with quote  
PostPosted: Mon May 16, 2022 9:57 am 
Offline
User avatar

Joined: Thu May 28, 2009 9:46 pm
Posts: 8504
Location: Midwestern USA
tmr4 wrote:
BigDumbDinosaur wrote:
It appears this design has gotten “painted into a corner” due to the limitations of the 22V10.

It seems the 22V10 still has a ways to go, at least with respect to my design, once I learned how to use the software properly. The following code compiles (and works) just fine with Quine McCluskey minimization...

If you have to monkey with minimization settings just to get the design to fit you are on the ragged edge with the GAL.

I said it earlier, but I’ll say it again. You are wasting GAL resources on unnecessary functions. There is no need whatsoever to use the GAL to handle a couple of IRQs. If you had eight or ten interrupt-driven I/O devices I could see it. You don't and would be better served with software polling. If you are using a -S VIA (totem-pole IRQ output), a small-signal Schottky diode can isolate it with virtually no impact on performance.

Another consideration is the GAL’s outputs when high will be at TTL levels, not CMOS. That is not high enough to make it unambiguous to the 816 that IRQ is quiescent. Can you say “spurious interrupts?”

Using the GAL to generate an out-of-phase clock is not a good idea. As I said in an earlier post, CLKB will be skewed relative to Ø2 by as much as the GAL's tPD. Additionally, CLKB’s high phase will be at TTL levels, not CMOS. I suggest you use a flop in your clock generator to produce Ø1 and Ø2 to get rid of the skew, as well as produce a CMOS level high phase.

You are stubbornly :D insisting on using negative logic in your output equations. That is costing you in PTs and is likely part of the reason why you are having to use QM minimization to get the design to fit. All internal logic is positive logic, no matter how you write the equations. Using negative logic in your equations forces CUPL to add PTs to invert each logic statement. With positive logic and an inverted output pin declaration, no extra PTs are necessary, and a simple inversion following the sum-of-products is all that is required to drive the output

Use of positive logic is recommended in the CUPL programmer's reference and I know from experience that their reasons for doing so are valid.

_________________
x86?  We ain't got no x86.  We don't NEED no stinking x86!


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 76 posts ]  Go to page Previous  1, 2, 3, 4, 5, 6  Next

All times are UTC


Who is online

Users browsing this forum: No registered users and 16 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: