Sub drawEllipse(ByVal x0 As Integer, ByVal y0 As Integer, ByVal x1 As Integer, ByVal y1 As Integer, ByVal colour as Integer, ByVal filled As Boolean = FALSE)
Dim As Integer a = Abs(x1-x0), b = Abs(y1-y0), b1, x : Rem values of diameter
Dim As Integer dx = 4*(1-a)*b*b, dy = 4*(b1+1)*a*a : Rem error increment
Dim As Integer errd = dx + dy + b1 * a * a, e2 : Rem error of 1.step
b1 = b And 1
if (x0 > x1) then
x0 = x1
x1 = x1 + a : Rem if called with swapped points
End If
if (y0 > y1) Then
y0 = y1 : Rem .. exchange them
End If
y0 = y0 + (b + 1) / 2
y1 = y0 - b1 : Rem starting pixel
a = a*(8*a)
b1 = 8*b*b
While (x0 <= x1)
draw_pixel(x1, y0, colour) : Rem I. Quadrant
draw_pixel(x0, y0, colour) : Rem II. Quadrant
draw_pixel(x0, y1, colour) : Rem III. Quadrant
draw_pixel(x1, y1, colour) : Rem IV. Quadrant
If (filled) Then
For x=x0 to x1
draw_pixel (x, y0, colour)
draw_pixel (x, y1, colour)
Next x
EndIf
e2 = 2*errd
If (e2 <= dy) Then
y0 = y0 + 1
y1 = y1 - 1
dy = dy + a
errd = errd + dy : rem y Step
End If
If (e2 >= dx Or 2*errd > dy) Then
x0 = x0 + 1
x1 = x1 - 1
dx = dx + b1
errd = errd + dx : rem x Step
End If
Wend
While (y0 - y1 < b) : Rem too early stop of flat ellipses a=1
draw_pixel(x0 - 1, y0, colour) : Rem -> finish tip of Ellipse
y0 = y0 + 1
draw_pixel(x1 + 1, y0, colour)
draw_pixel(x0 - 1, y1, colour)
y1 = y1 - 1
draw_pixel(x1 + 1, y1, colour)
Wend
End Sub
Okay, it's been a busy week and next it's just getting busier. I don't have the time to sit and work out how to massage the Bezier code into something compatible with FreeBasic or HDL, so I'm going with the ellipse code:Code: [Select]Sub drawEllipse(ByVal x0 As Integer, ByVal y0 As Integer, ByVal x1 As Integer, ByVal y1 As Integer, ByVal colour as Integer, ByVal filled As Boolean = FALSE)
Dim As Integer a = Abs(x1-x0), b = Abs(y1-y0), b1, x : Rem values of diameter
Dim As Integer dx = 4*(1-a)*b*b, dy = 4*(b1+1)*a*a : Rem error increment
Dim As Integer errd = dx + dy + b1 * a * a, e2 : Rem error of 1.step
b1 = b And 1
if (x0 > x1) then
x0 = x1
x1 = x1 + a : Rem if called with swapped points
End If
if (y0 > y1) Then
y0 = y1 : Rem .. exchange them
End If
y0 = y0 + (b + 1) / 2
y1 = y0 - b1 : Rem starting pixel
a = a*(8*a)
b1 = 8*b*b
While (x0 <= x1)
draw_pixel(x1, y0, colour) : Rem I. Quadrant
draw_pixel(x0, y0, colour) : Rem II. Quadrant
draw_pixel(x0, y1, colour) : Rem III. Quadrant
draw_pixel(x1, y1, colour) : Rem IV. Quadrant
If (filled) Then
For x=x0 to x1
draw_pixel (x, y0, colour)
draw_pixel (x, y1, colour)
Next x
EndIf
e2 = 2*errd
If (e2 <= dy) Then
y0 = y0 + 1
y1 = y1 - 1
dy = dy + a
errd = errd + dy : rem y Step
End If
If (e2 >= dx Or 2*errd > dy) Then
x0 = x0 + 1
x1 = x1 - 1
dx = dx + b1
errd = errd + dx : rem x Step
End If
Wend
While (y0 - y1 < b) : Rem too early stop of flat ellipses a=1
draw_pixel(x0 - 1, y0, colour) : Rem -> finish tip of Ellipse
y0 = y0 + 1
draw_pixel(x1 + 1, y0, colour)
draw_pixel(x0 - 1, y1, colour)
y1 = y1 - 1
draw_pixel(x1 + 1, y1, colour)
Wend
End Sub
It works fine in FreeBasic, so if you have no objections I'll start translating this into Verilog as a separate function, though it's likely to take a while due to work.
I've also attached my first version of the schematic for the Cyclone V GPU card for comment if anyone is interested.
I've also attached my first version of the schematic for the Cyclone V GPU card for comment if anyone is interested.
Check page 27 of the TFP410 datasheet, you might not have enough decoupling capacitors.
I've also attached my first version of the schematic for the Cyclone V GPU card for comment if anyone is interested.
Change your audio dac to a PCM5101A.
https://www.ti.com/store/ti/en/p/product/?p=PCM5101APWR&HQS=OCB-tistore-invf-storeinv-invf-store-findchips-wwe
PCM5100A is also compatible, little lower quality, but, Farnell currently has stock of this one.
Use the dac supply with filter choke for the analog 3.3v & use optionally use vccio 3.3v for the digital.
What's the improvement using the PCM5101A? I haven't got time to look tonight, but a quick glance at the datasheet indicates it uses I2S and doesn't look quite as straightforward as the MAX part?
Okay, it's been a busy week and next it's just getting busier. I don't have the time to sit and work out how to massage the Bezier code into something compatible with FreeBasic or HDL, so I'm going with the ellipse code:Code: [Select]Sub drawEllipse(ByVal x0 As Integer, ByVal y0 As Integer, ByVal x1 As Integer, ByVal y1 As Integer, ByVal colour as Integer, ByVal filled As Boolean = FALSE)
Dim As Integer a = Abs(x1-x0), b = Abs(y1-y0), b1, x : Rem values of diameter
Dim As Integer dx = 4*(1-a)*b*b, dy = 4*(b1+1)*a*a : Rem error increment
Dim As Integer errd = dx + dy + b1 * a * a, e2 : Rem error of 1.step
b1 = b And 1
if (x0 > x1) then
x0 = x1
x1 = x1 + a : Rem if called with swapped points
End If
if (y0 > y1) Then
y0 = y1 : Rem .. exchange them
End If
y0 = y0 + (b + 1) / 2
y1 = y0 - b1 : Rem starting pixel
a = a*(8*a)
b1 = 8*b*b
While (x0 <= x1)
draw_pixel(x1, y0, colour) : Rem I. Quadrant
draw_pixel(x0, y0, colour) : Rem II. Quadrant
draw_pixel(x0, y1, colour) : Rem III. Quadrant
draw_pixel(x1, y1, colour) : Rem IV. Quadrant
If (filled) Then
For x=x0 to x1
draw_pixel (x, y0, colour)
draw_pixel (x, y1, colour)
Next x
EndIf
e2 = 2*errd
If (e2 <= dy) Then
y0 = y0 + 1
y1 = y1 - 1
dy = dy + a
errd = errd + dy : rem y Step
End If
If (e2 >= dx Or 2*errd > dy) Then
x0 = x0 + 1
x1 = x1 - 1
dx = dx + b1
errd = errd + dx : rem x Step
End If
Wend
While (y0 - y1 < b) : Rem too early stop of flat ellipses a=1
draw_pixel(x0 - 1, y0, colour) : Rem -> finish tip of Ellipse
y0 = y0 + 1
draw_pixel(x1 + 1, y0, colour)
draw_pixel(x0 - 1, y1, colour)
y1 = y1 - 1
draw_pixel(x1 + 1, y1, colour)
Wend
End Sub
It works fine in FreeBasic, so if you have no objections I'll start translating this into Verilog as a separate function, though it's likely to take a while due to work.
I've also attached my first version of the schematic for the Cyclone V GPU card for comment if anyone is interested.
*************Part1
int a2 = a*a , b2 = b*b , fa2 = 4*a2 ;
int x, y, sigma;
for ( x = 0, y = b, sigma = 2*b2+a2*(1-2*b) ; b2*x <= a2*y ; x++)
{
DrawPixel ( xc+x , yc+y ) ;
DrawPixel ( xc-x , yc+y ) ;
DrawPixel ( xc+x , yc-y ) ;
DrawPixel ( xc-x , yc-y ) ;
if ( sigma >= 0 )
{
sigma += f a 2 *(1-y ) ;
y--;
}
sigma += b2*(4*x+6);
}
*************Part2
int a2 = a*a , b2 = b*b , fb2 = 4*b2 ;
int x, y, sigma ;
for ( x = a, y = 0, sigma = 2*a2+b2*(1-2*a) ; a2*y <= b2*x ; y++)
{
DrawPixel ( xc+x , yc+y ) ;
DrawPixel ( xc-x , yc+y ) ;
DrawPixel ( xc+x , yc-y ) ;
DrawPixel ( xc-x , yc-y ) ;
if ( sigma >= 0 )
{
sigma += fb2 *(1-x ) ;
x--;
}
sigma += a2*(4*y+6);
}
Okay, it's been a busy week and next it's just getting busier. I don't have the time to sit and work out how to massage the Bezier code into something compatible with FreeBasic or HDL, so I'm going with the ellipse code:Code: [Select]Sub drawEllipse(ByVal x0 As Integer, ByVal y0 As Integer, ByVal x1 As Integer, ByVal y1 As Integer, ByVal colour as Integer, ByVal filled As Boolean = FALSE)
Dim As Integer a = Abs(x1-x0), b = Abs(y1-y0), b1, x : Rem values of diameter
Dim As Integer dx = 4*(1-a)*b*b, dy = 4*(b1+1)*a*a : Rem error increment
Dim As Integer errd = dx + dy + b1 * a * a, e2 : Rem error of 1.step
b1 = b And 1
if (x0 > x1) then
x0 = x1
x1 = x1 + a : Rem if called with swapped points
End If
if (y0 > y1) Then
y0 = y1 : Rem .. exchange them
End If
y0 = y0 + (b + 1) / 2
y1 = y0 - b1 : Rem starting pixel
a = a*(8*a)
b1 = 8*b*b
While (x0 <= x1)
draw_pixel(x1, y0, colour) : Rem I. Quadrant
draw_pixel(x0, y0, colour) : Rem II. Quadrant
draw_pixel(x0, y1, colour) : Rem III. Quadrant
draw_pixel(x1, y1, colour) : Rem IV. Quadrant
If (filled) Then
For x=x0 to x1
draw_pixel (x, y0, colour)
draw_pixel (x, y1, colour)
Next x
EndIf
e2 = 2*errd
If (e2 <= dy) Then
y0 = y0 + 1
y1 = y1 - 1
dy = dy + a
errd = errd + dy : rem y Step
End If
If (e2 >= dx Or 2*errd > dy) Then
x0 = x0 + 1
x1 = x1 - 1
dx = dx + b1
errd = errd + dx : rem x Step
End If
Wend
While (y0 - y1 < b) : Rem too early stop of flat ellipses a=1
draw_pixel(x0 - 1, y0, colour) : Rem -> finish tip of Ellipse
y0 = y0 + 1
draw_pixel(x1 + 1, y0, colour)
draw_pixel(x0 - 1, y1, colour)
y1 = y1 - 1
draw_pixel(x1 + 1, y1, colour)
Wend
End Sub
It works fine in FreeBasic, so if you have no objections I'll start translating this into Verilog as a separate function, though it's likely to take a while due to work.
I've also attached my first version of the schematic for the Cyclone V GPU card for comment if anyone is interested.
You cheated! That old code was already there and it is not a center ellipse, it is drawing an ellipse inside a box!
I'm curious as to why you didn't use this code:Code: [Select]*************Part1
int a2 = a*a , b2 = b*b , fa2 = 4*a2 ;
int x, y, sigma;
for ( x = 0, y = b, sigma = 2*b2+a2*(1-2*b) ; b2*x <= a2*y ; x++)
{
DrawPixel ( xc+x , yc+y ) ;
DrawPixel ( xc-x , yc+y ) ;
DrawPixel ( xc+x , yc-y ) ;
DrawPixel ( xc-x , yc-y ) ;
if ( sigma >= 0 )
{
sigma += f a 2 *(1-y ) ;
y--;
}
sigma += b2*(4*x+6);
}
*************Part2
int a2 = a*a , b2 = b*b , fb2 = 4*b2 ;
int x, y, sigma ;
for ( x = a, y = 0, sigma = 2*a2+b2*(1-2*a) ; a2*y <= b2*x ; y++)
{
DrawPixel ( xc+x , yc+y ) ;
DrawPixel ( xc-x , yc+y ) ;
DrawPixel ( xc+x , yc-y ) ;
DrawPixel ( xc-x , yc-y ) ;
if ( sigma >= 0 )
{
sigma += fb2 *(1-x ) ;
x--;
}
sigma += a2*(4*y+6);
}
From the document in my above post ' https://www.eevblog.com/forum/fpga/fpga-vga-controller-for-8-bit-computer/msg3267128/#msg3267128 '. It doesn't have that pesky flat ellipse issue. And since it separates the are into 2-45degree segments, you can make my 90 degree bot corners into 45 degree edges if you like.
This is not important. And for flat ellipses, ignore that portion when coding the verilog. There is a better place within my code to bypass the ellipse all together and go straight to the draw line function.
If you get your PCB made by JLPCB, they will place the components for you if the parts are available at https://lcsc.com/ , the place where I found your Cyclone V for 18$.
Also, for your caps, use 10uf XR7 1206 or 1210 ceramic. For 22uf, just use 2x10uf in parallel.
Do not use 0805 10uf ceramic. Their capacitance really drops with voltage.
As for the DAC filter and boot caps, might as well use the same 10uf unless you do not want to consolidate parts.
Okie dokie, will use them - I take it these 1210 XR7 MLCC caps are fine and replacing polar caps with non-polar ones won't cause any issues?
But just don't take it that the Cyclone V is cheaper at LCSC, so is everything else. Take a look at the cap price there:
https://lcsc.com/product-detail/Multilayer-Ceramic-Capacitors-MLCC-SMD-SMT_Samsung-Electro-Mechanics-CL31B106KQHNNNE_C318761.html
https://lcsc.com/product-detail/Multilayer-Ceramic-Capacitors-MLCC-SMD-SMT_Samsung-Electro-Mechanics-CL31B106MOHNNNE_C730480.html
You are throwing out 8x the money...
Or 4x for the 1210s:
https://lcsc.com/product-detail/Multilayer-Ceramic-Capacitors-MLCC-SMD-SMT_SAMSUNG_CL32B106KAJNNNE_10uF-106-10-25V_C39232.html
Same goes for almost every part on your PCB.
If you get your PCB made by JLPCB, they will place the components for you if the parts are available at https://lcsc.com/ , the place where I found your Cyclone V for 18$.
Yes, that's an option as I use JLCPCB for my boards. I'm seriously considering it, even though it's expensive (e.g. I don't need five boards made up but that would be the minimum if I use their assembly process), but it would save me a LOT of headaches trying to solder BGA and QFN parts.Also, for your caps, use 10uf XR7 1206 or 1210 ceramic. For 22uf, just use 2x10uf in parallel.
Do not use 0805 10uf ceramic. Their capacitance really drops with voltage.
As for the DAC filter and boot caps, might as well use the same 10uf unless you do not want to consolidate parts.
Okie dokie, will use them - I take it these 1210 XR7 MLCC caps are fine and replacing polar caps with non-polar ones won't cause any issues?
The 10uF and 22uF caps on the Power sheet are 3216 tantalum capacitors - these are the same as what I've used on the current GPU board.
As much as I like being lazy, and copy stuff instead of actually doing it, the layout you posted will not pass a basic DFM review.
Have a look at the reference design, especially if you are going to try higher resolutions.
Are your IO optimized based on IO Bank and pin location for routing?
Or, will you do pin-swapping during layout?
A single DDR2 dram will use 43 IOs, half will need to be in the top or bottom IO banks.
A single Hyperbus PSRAM will use 13 IOs, all in the top or bottom IO banks. You will want 2 which means 26-2 = 24 IOs.
A single or dual ZBT Sync SRam will use 40 IOs, all in the top or bottom IO banks.
Choose your poison.