6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Wed Oct 02, 2024 1:24 pm

All times are UTC




Post new topic Reply to topic  [ 53 posts ]  Go to page Previous  1, 2, 3, 4  Next
Author Message
PostPosted: Sat Aug 18, 2018 3:25 pm 
Offline
User avatar

Joined: Fri Dec 11, 2009 3:50 pm
Posts: 3367
Location: Ontario, Canada
LIV2 wrote:
I could do that in the CPLD but the timing would be slightly different to the output '547 so I may as well pass them through the same latch as the video output.
No doubt there are several different ways that'll work. Any chance you could get the CPLD to update CURSOR and BLANK on the rising edge of clock (to match the '166 shift reg etc)? :) Adding external flipflops is an alternative solution.

Either way, you need to be mindful of the pipeline. Earlier I mentioned the color and pixel data that's loaded in the reg's, and the color and pixel data that's waiting to get loaded in the reg's. That's incomplete; really there are four things that occupy each stage: the color data, pixel data, CURSOR and BLANK. The obvious choice is to give them all identical delays in reaching the output. OTOH, I'm guessing CURSOR and BLANK simply indicate detection of a certain value in a counter. So, rather than altering the number of flipflops in the CURSOR and BLANK output path you could instead detect a different counter value.

_________________
In 1988 my 65C02 got six new registers and 44 new full-speed instructions!
https://laughtonelectronics.com/Arcana/ ... mmary.html


Top
 Profile  
Reply with quote  
PostPosted: Mon Aug 20, 2018 12:26 am 
Offline

Joined: Wed Feb 12, 2014 1:39 am
Posts: 172
Location: Sweden
Dr Jefyll wrote:
No doubt there are several different ways that'll work. Any chance you could get the CPLD to update CURSOR and BLANK on the rising edge of clock (to match the '166 shift reg etc)? :) Adding external flipflops is an alternative solution.


Yep for those I've changed it so they update on the rising edge of CLK whenever the LATCH signal is asserted, so that it is updated at the same time as the latch and shift register as cursor match & horizontal timings are all measured in character widths.

Quote:
Either way, you need to be mindful of the pipeline. Earlier I mentioned the color and pixel data that's loaded in the reg's, and the color and pixel data that's waiting to get loaded in the reg's. That's incomplete; really there are four things that occupy each stage: the color data, pixel data, CURSOR and BLANK. The obvious choice is to give them all identical delays in reaching the output. OTOH, I'm guessing CURSOR and BLANK simply indicate detection of a certain value in a counter. So, rather than altering the number of flipflops in the CURSOR and BLANK output path you could instead detect a different counter value.


That's correct, CURSOR & BLANK are just matches against counters inside the CPLD so they can easily be fixed easily

So presuming I do that, the best option for an output latch is the counter as it'll use less board space?

I was also wondering what the difference between using another '377 vs a '574? I can see the 574 can be tristated which might come in handy for blanking, is that why?


Top
 Profile  
Reply with quote  
PostPosted: Mon Aug 20, 2018 1:41 am 
Offline
User avatar

Joined: Fri Dec 11, 2009 3:50 pm
Posts: 3367
Location: Ontario, Canada
LIV2 wrote:
So presuming I do that, the best option for an output latch is the counter as it'll use less board space?
It seems that way to me, but remember this is driveby advice I'm offering you. I haven't studied all the details, nor thought things through as carefully as I'd do if the project were my own. :) If you want the extra space and you're certain 4 bits will be enough then yeah, use the counter. (Or a '173.)

Quote:
I was also wondering what the difference between using another '377 vs a '574? I can see the 574 can be tristated which might come in handy for blanking, is that why?
No, '377 would be fine. I only mentioned '574 because it's a little easier to obtain -- especially if you want a fast part such as 74AC. I wouldn't recommend using tri-state for blanking, because the VGA cable that connects to the monitor is a transmission line and should ideally be terminated at both ends to avoid ringing and reflections.

OTOH, the '163 counter we just mentioned *is* good for blanking because, in addition to synchronous load, it also offers synchronous clear.

_________________
In 1988 my 65C02 got six new registers and 44 new full-speed instructions!
https://laughtonelectronics.com/Arcana/ ... mmary.html


Last edited by Dr Jefyll on Mon Aug 20, 2018 2:07 am, edited 1 time in total.

Top
 Profile  
Reply with quote  
PostPosted: Mon Aug 20, 2018 1:58 am 
Offline

Joined: Wed Feb 12, 2014 1:39 am
Posts: 172
Location: Sweden
Awesome! I'll give it a try once the parts come in and update the thread

Thanks so much for the help!


Top
 Profile  
Reply with quote  
PostPosted: Mon Aug 20, 2018 2:09 am 
Offline
User avatar

Joined: Fri Dec 11, 2009 3:50 pm
Posts: 3367
Location: Ontario, Canada
You're welcome! And I hope you noticed a slight edit to my last post.

_________________
In 1988 my 65C02 got six new registers and 44 new full-speed instructions!
https://laughtonelectronics.com/Arcana/ ... mmary.html


Top
 Profile  
Reply with quote  
PostPosted: Mon Aug 20, 2018 2:53 am 
Offline

Joined: Wed Feb 12, 2014 1:39 am
Posts: 172
Location: Sweden
Dr Jefyll wrote:
OTOH, the '163 counter we just mentioned *is* good for blanking because, in addition to synchronous load, it also offers synchronous clear.


Nice, I can only find this in HC though is that a problem with a pixel clock of 25MHz? the mux is a 74AC157 so it'd respond much faster to BLANK.


Top
 Profile  
Reply with quote  
PostPosted: Mon Aug 20, 2018 3:33 am 
Offline
User avatar

Joined: Fri Dec 11, 2009 3:50 pm
Posts: 3367
Location: Ontario, Canada
Because we decided to add that final register downstream you don't need to worry about the '157 result being asynchronous. The XOR and blanking and the whole schmear will get run through the mill and will come out nice & tidy. So, my remark was superfluous -- sorry. In other circumstances it would be relevant, though. If the '157 weren't there you'd need some other way of doing blanking. And a 163 is good for that.

Quote:
Nice, I can only find this in HC though is that a problem with a pixel clock of 25MHz?
There used to be such a thing as 'AC163, but I haven't checked lately. 'HC may be marginal, timing-wise. Here's what needs to happen in 40 ns (one pixel-clock period):

- after a rising clock edge there's a propagation delay before the '166 Qh output updates
- the XOR then the '157 process that result, each adding propagation delay
- the output of the 157 must be valid in advance of the subsequent rising clock edge in order to satisfy the input setup time required by the final register.

If the '166, XOR and '157 are AC parts then maybe it's OK if the final register is only HC. If you need certainty then get the relevant figures and see if their sum exceeds 40 ns. Otherwise you can seat-of-the-pants it! :) Try whatever's easy (like HC) first -- it'll probably be OK. If not, you'll need AC for the final register.

_________________
In 1988 my 65C02 got six new registers and 44 new full-speed instructions!
https://laughtonelectronics.com/Arcana/ ... mmary.html


Top
 Profile  
Reply with quote  
PostPosted: Mon Aug 27, 2018 2:58 am 
Offline

Joined: Wed Feb 12, 2014 1:39 am
Posts: 172
Location: Sweden
The AC '377s have come in today so I'm going to try them out soon, since I don't have any 163s etc on hand I'll just try another 377 at the output
Since I could only get the 377 in SOIC-20 space is no huge concern
Does this look right?

I think BLANK and CURSOR will need to go through a flop in the cpld as they would otherwise come almost 1 character-time early, of course another option is to change the counter match values but the good thing about the CPLD is that I can change that quickly and easily.
:edit: Corrected the diagram, the '157 is AC and the 166 is unfortunately HC as I wasn't able to find any 166's in AC logic


Attachments:
Capture.PNG
Capture.PNG [ 75.86 KiB | Viewed 4590 times ]
Top
 Profile  
Reply with quote  
PostPosted: Mon Aug 27, 2018 3:40 am 
Offline
User avatar

Joined: Fri Dec 11, 2009 3:50 pm
Posts: 3367
Location: Ontario, Canada
LIV2 wrote:
I think BLANK and CURSOR will need to go through a flop in the cpld as they would otherwise come almost 1 character-time early, of course another option is to change the counter match values

Looks good! :)

Yet another option for BLANK and CURSOR is to delay them using the unused sections of the new '377.
Edit: oops, bad idea :oops: That '377 updates once per pixel. You want BLANK and CURSOR to update once per character.

Probably the best choice is to change the counter match values, as you say.

Quote:
I wasn't able to find any 166's in AC logic
How about 'AHC166 or 'AHCT166?

_________________
In 1988 my 65C02 got six new registers and 44 new full-speed instructions!
https://laughtonelectronics.com/Arcana/ ... mmary.html


Last edited by Dr Jefyll on Mon Aug 27, 2018 4:43 am, edited 1 time in total.

Top
 Profile  
Reply with quote  
PostPosted: Mon Aug 27, 2018 4:00 am 
Offline

Joined: Wed Feb 12, 2014 1:39 am
Posts: 172
Location: Sweden
Yeah actually I might route BLANK and CURSOR through the '377 because it'll use less resources in the CPLD and those flip-flops are free

I had a look for AHC,ACT etc on element14, mouser & Digikey but didn't find anything. I suppose if the HC isn't fast enough I can probably use a '299 which is available in AC but we will see how I go I guess


Top
 Profile  
Reply with quote  
PostPosted: Mon Aug 27, 2018 4:47 am 
Offline
User avatar

Joined: Fri Dec 11, 2009 3:50 pm
Posts: 3367
Location: Ontario, Canada
'AC299 is a good idea. But my suggestion about unused '377 sections isn't. See the edit to my previous post. :|

_________________
In 1988 my 65C02 got six new registers and 44 new full-speed instructions!
https://laughtonelectronics.com/Arcana/ ... mmary.html


Top
 Profile  
Reply with quote  
PostPosted: Mon Aug 27, 2018 11:49 pm 
Offline

Joined: Wed Feb 12, 2014 1:39 am
Posts: 172
Location: Sweden
It works! Looks really good too!
I had to swap the A/B inputs on the mux (I was using the inverted Q on the old shift register because it made for a cleaner schematic) but that's cool.


Top
 Profile  
Reply with quote  
PostPosted: Tue Aug 28, 2018 12:05 am 
Offline
User avatar

Joined: Fri Dec 11, 2009 3:50 pm
Posts: 3367
Location: Ontario, Canada
Nice to hear about your success! :)

Are you using 'HC166, then? And did the CURSOR and BLANK signals get sorted out?

_________________
In 1988 my 65C02 got six new registers and 44 new full-speed instructions!
https://laughtonelectronics.com/Arcana/ ... mmary.html


Top
 Profile  
Reply with quote  
PostPosted: Tue Aug 28, 2018 12:27 am 
Offline

Joined: Wed Feb 12, 2014 1:39 am
Posts: 172
Location: Sweden
Yeah using a HC166 and it looks good so far. I'll create some test characters with one pixel on the left/right etc to be sure but it's noticeably sharper and no edge artefacts like I was seeing before

CURSOR and BLANK are run through a flip-flop inside the cpld now as follows:
Code:
M_BLANK  <= (V_BLANK OR H_BLANK);
M_CURSOR <= '1' when (unsigned(REG_CURSORLOCATION) = unsigned(MA)) else '0';

FF:
process(clk)
begin
  if rising_edge(clk) then
    if LATCH = '0' then
        FF_CURSOR <= M_CURSOR;
        FF_BLANK <= M_BLANK;
    else
        FF_CURSOR <= FF_CURSOR;
        FF_BLANK <= FF_BLANK;
    end if;
  end if;
end process;
CURSOR <= FF_CURSOR;
BLANK <= FF_BLANK;


I'll be cleaning up the code to make the variable naming more consistent and uploading it to github soon


Top
 Profile  
Reply with quote  
PostPosted: Wed Aug 29, 2018 1:08 am 
Offline

Joined: Wed Feb 12, 2014 1:39 am
Posts: 172
Location: Sweden
Yep after doing some tests it appears to be working perfectly

Here's some shots from the monitor. I wish I had a CRT hanging around as I'm sure it'd look better without LCD scaling


Attachments:
IMG_9464.jpg
IMG_9464.jpg [ 131.87 KiB | Viewed 4467 times ]
IMG_9465.jpg
IMG_9465.jpg [ 90.66 KiB | Viewed 4467 times ]
IMG_9468.jpg
IMG_9468.jpg [ 81.89 KiB | Viewed 4467 times ]
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 53 posts ]  Go to page Previous  1, 2, 3, 4  Next

All times are UTC


Who is online

Users browsing this forum: No registered users and 40 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: