How to share Video-RAM between VGA Controller and CPU ?

P

psihodelia

I have only one SRAM IC and one FPGA.

Low addresses of SRAM are used to keep video buffer that should be
updated very rapidly, but the same IC has to keep also CPU
instructions in the area of the upper addresses. Global clock of FPGA
is 50 MHz. VGA Controller reads video buffer on 25 MHz. At the same
time, CPU has to have enough time to fetch instructions, process
program's memory, and update video memory - without big lag.

VGA Controller reads hole video buffer 60 times per sec. It remains a
bit time for CPU on back/front vertical porch+sync and very short time
on back/front horizontal porch+sync.

What could be the smartest solution in such situation?
 
M

MikeShepherd564

I have only one SRAM IC and one FPGA.
Low addresses of SRAM are used to keep video buffer that should be
updated very rapidly, but the same IC has to keep also CPU
instructions in the area of the upper addresses. Global clock of FPGA
is 50 MHz. VGA Controller reads video buffer on 25 MHz. At the same
time, CPU has to have enough time to fetch instructions, process
program's memory, and update video memory - without big lag.

VGA Controller reads hole video buffer 60 times per sec. It remains a
bit time for CPU on back/front vertical porch+sync and very short time
on back/front horizontal porch+sync.

What could be the smartest solution in such situation?

If the RAM cycle time is under 20ns and the video needs to read it
only once every 40ns, I'd suggest that you allocate alternate 20ns
periods to the video and CPU. This will give predictable CPU response
times (independent of the position in the video line or field cycle).

If you need to squeeze out maximum performance then you could allocate
all 20ns periods to the CPU during line or field blanking. I'd guess
that this would make only about 15% more RAM cycles available to the
CPU and the consequent increase in CPU throughput must be less than
that (especially if it has a cache inside the FPGA), so it won't
usually be worth the extra complexity.

How does this concern VHDL?

Mike
 
M

MikeShepherd564

I have only one SRAM IC and one FPGA.
Low addresses of SRAM are used to keep video buffer that should be
updated very rapidly, but the same IC has to keep also CPU
instructions in the area of the upper addresses. Global clock of FPGA
is 50 MHz. VGA Controller reads video buffer on 25 MHz. At the same
time, CPU has to have enough time to fetch instructions, process
program's memory, and update video memory - without big lag.

VGA Controller reads hole video buffer 60 times per sec. It remains a
bit time for CPU on back/front vertical porch+sync and very short time
on back/front horizontal porch+sync.

What could be the smartest solution in such situation?

If the RAM cycle time is under 20ns and the video needs to read it
only once every 40ns, I'd suggest that you allocate alternate 20ns
periods to the video and CPU. This will give predictable CPU response
times (independent of the position in the video line or field cycle).

If you need to squeeze out maximum performance then you could allocate
all 20ns periods to the CPU during line or field blanking. I'd guess
that this would make only about 15% more RAM cycles available to the
CPU and the consequent increase in CPU throughput must be less than
that (especially if it has a cache inside the FPGA), so it won't
usually be worth the extra complexity.

How does this concern VHDL?

Mike
 
J

james

On Thu, 10 Jan 2008 07:49:05 -0800 (PST), "(e-mail address removed)"

|I have only one SRAM IC and one FPGA.
|
|Low addresses of SRAM are used to keep video buffer that should be
|updated very rapidly, but the same IC has to keep also CPU
|instructions in the area of the upper addresses. Global clock of FPGA
|is 50 MHz. VGA Controller reads video buffer on 25 MHz. At the same
|time, CPU has to have enough time to fetch instructions, process
|program's memory, and update video memory - without big lag.
|
|VGA Controller reads hole video buffer 60 times per sec. It remains a
|bit time for CPU on back/front vertical porch+sync and very short time
|on back/front horizontal porch+sync.
|
|What could be the smartest solution in such situation?
|
|-------------

There is an old technique used years ago with slower CPUs and RAM that
was called IDMA(Interleaved Direct Memory Access??). You can
interleave the reads to the ram by the video section and the CPU by
using half the machine cycle. Example would be to have the CPU access
the ram during the second half of the clock cycle and the video during
the first half. You would have to multiplex the video and CPU
addresses and synch them with the CPU clock cycle, especially if it is
slower than the video read clock. This would keep you from having to
halt the CPU during video ram buffer reads.

This technique though does have its limits. Your access time for the
SRAM will need to be at least half that of the CPU clock period or
faster. 20nS SRAM access time will dictate a minimum CPU machine cycle
time of 40nS(25 MHz).

james
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,819
Latest member
masterdaster

Latest Threads

Top