6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Sat Nov 23, 2024 2:47 am

All times are UTC




Post new topic Reply to topic  [ 155 posts ]  Go to page Previous  1 ... 5, 6, 7, 8, 9, 10, 11  Next
Author Message
PostPosted: Sun Oct 21, 2012 7:08 am 
Offline
User avatar

Joined: Tue Nov 16, 2010 8:00 am
Posts: 2353
Location: Gouda, The Netherlands
You could make a test pattern with wide alternating bars at the top, say 64 pixels of each color, followed by rows with 32 pixel bars, all the way down to single pixel alternating at the bottom.


Top
 Profile  
Reply with quote  
PostPosted: Sun Oct 21, 2012 1:05 pm 
Offline

Joined: Mon Mar 02, 2009 7:27 pm
Posts: 3258
Location: NC, USA
This may be abit off-topic, but have you ever seen the ORSOC Graphics Accelerator @opencores.org? Looks very impressive, says it is to be used with another VGA/LCD core for RGB output. I'm currently looking it over...

_________________
65Org16:https://github.com/ElEctric-EyE/verilog-6502


Top
 Profile  
Reply with quote  
PostPosted: Sun Oct 21, 2012 1:22 pm 
Offline
User avatar

Joined: Tue Nov 16, 2010 8:00 am
Posts: 2353
Location: Gouda, The Netherlands
ElEctric_EyE wrote:
This may be abit off-topic, but have you ever seen the ORSOC Graphics Accelerator @opencores.org? Looks very impressive, says it is to be used with another VGA/LCD core for RGB output. I'm currently looking it over...

Haven't seen it before, but it looks impressive, both in the features as in size.


Top
 Profile  
Reply with quote  
PostPosted: Sun Oct 21, 2012 9:07 pm 
Offline

Joined: Mon Mar 02, 2009 7:27 pm
Posts: 3258
Location: NC, USA
Yes, I see it takes 10,000 slice LUTs and was made for a XC6SLX45 on the Digilent Atlys board. This 320-pin Spartan 6 that Digilent uses, is the smallest BGA package version of the XC6SLX45 (27,288 slice LUTs). Our little XC6SLX9 only has 5720.

But it still may be a design worth referring to, and removing some extras in order to take advantage of the overall design of triangle plotting. Too much may have to be removed though, because it must work in unison with the VGA_LCD core previously mentioned, and this would take even more space in the FPGA. Not to mention the CPU core.

May be best to stay on course with humble beginnings, but with an eye towards what can be achieved...

I thought I'd mention an article I happened across today, a very recent article dated June 4, 2012 regarding the 'ORGFXSoC' effort is here.
And here on ProjectVGA.

_________________
65Org16:https://github.com/ElEctric-EyE/verilog-6502


Top
 Profile  
Reply with quote  
PostPosted: Mon Oct 22, 2012 12:43 pm 
Offline

Joined: Mon Mar 02, 2009 7:27 pm
Posts: 3258
Location: NC, USA
And another similar project, although it uses a Spartan 3, called openVGA with verilog HDL available on sourceforge. Associated homepage is here.

EDIT: Tomorrow, I need to do some reading on the 'VGA/LCD Core v2.0 Specifications'. It has info I need to learn about video bandwidth...

_________________
65Org16:https://github.com/ElEctric-EyE/verilog-6502


Top
 Profile  
Reply with quote  
PostPosted: Tue Oct 23, 2012 3:59 pm 
Offline

Joined: Mon Mar 02, 2009 7:27 pm
Posts: 3258
Location: NC, USA
Such a struggle, but I finally made a successful test to alternate black and white pixels straight from the FPGA to the videoDAC. So far I just tested 320x200 resolution. I don't see anything out of order. I've attached the zipped ISE 13.4 project file.
Code:
module VDACif( input clk108,
               input hstart,
               input vstart,               
               input hblank,
               output reg [4:0] Red_data,
               output reg [5:0] Green_data,
               output reg [4:0] Blue_data,
               output reg DACBLANKn = 1
               );

reg countflag;
reg [8:0] Hcount;
reg [7:0] Vcount;

always @(posedge clk108)
      if ( !hblank )
         Hcount <= Hcount + 1;
      else if ( hblank )
         Hcount <= 0;
      
always @(posedge clk108)
      if ( hstart )
         countflag <= 1;   //countflag active in display area
      else if ( hblank )
         countflag <= 0;
      
always @(posedge clk108)
   if ( countflag )
      begin
         Red_data <= hblank ? 0 :
               Hcount[0] ? 0 :
               5'b11111;
         Green_data <= hblank ? 0 :
                 Hcount[0] ? 0 :
                 6'b111111;
         Blue_data <= hblank ? 0 :
                Hcount[0] ? 0 :
                5'b11111;
   end
      
endmodule


EDIT: Seeing a moire pattern side effect at 1280x1024 resolution. Also, 320x200 not such a square pixel. Might have to go for 320x240 as a lower resolution.


Attachments:
PVBSSOtest.zip [1.07 MiB]
Downloaded 72 times

_________________
65Org16:https://github.com/ElEctric-EyE/verilog-6502
Top
 Profile  
Reply with quote  
PostPosted: Tue Oct 23, 2012 6:03 pm 
Offline
User avatar

Joined: Tue Nov 16, 2010 8:00 am
Posts: 2353
Location: Gouda, The Netherlands
Now try a blue border around the pattern.


Top
 Profile  
Reply with quote  
PostPosted: Tue Oct 23, 2012 7:01 pm 
Offline

Joined: Mon Mar 02, 2009 7:27 pm
Posts: 3258
Location: NC, USA
Arlet wrote:
Now try a blue border around the pattern.

I tried my best, but it doesn't work for some reason. My brain is burnt, so I am pretty much done for today, but here is my code. I took your previous advice and divided up the RGB signals for manipulation. There is no difference in the output, still alt black/white pixels w/black borders:
Code:
module VDACif( input clk108,
               input hstart,
               input vstart,               
               input hblank,
               output reg [4:0] Red_data,
               output reg [5:0] Green_data,
               output reg [4:0] Blue_data,
               output reg DACBLANKn = 1
               );

reg countflag;
reg [8:0] Hcount;
reg [7:0] Vcount;

always @(posedge clk108)
      if ( !hblank )
         Hcount <= Hcount + 1;
      else if ( hblank )
         Hcount <= 0;
      
always @(posedge clk108)
      if ( hstart )
         countflag <= 1;   //countflag active in display area
      else if ( hblank )
         countflag <= 0;
      
always @(posedge clk108)
   if ( countflag )
         Red_data <= hblank ? 0 :
                     Hcount[0] ? 0 :
                     5'b11111;
   else if ( hblank )
         Red_data <= 0;
                     
always @(posedge clk108)
   if ( countflag )
         Green_data <= hblank ? 0 :
                       Hcount[0] ? 0 :
                       6'b111111;
   else if ( hblank )
         Green_data <= 0;
                      
always @(posedge clk108)
   if ( countflag )
         Blue_data <= hblank ? 0 :
                      Hcount[0] ? 0 :
                      5'b11111;
   else if ( hblank )
         Blue_data <= 5'b11111;   
      
endmodule


EDIT: 1 SEC I think I see my prob. I must remove the hblank MUX now that it is defined by the else-if statements...

_________________
65Org16:https://github.com/ElEctric-EyE/verilog-6502


Top
 Profile  
Reply with quote  
PostPosted: Tue Oct 23, 2012 7:22 pm 
Offline
User avatar

Joined: Tue Nov 16, 2010 8:00 am
Posts: 2353
Location: Gouda, The Netherlands
Try running a simulation. It will show you the timing diagrams, and then it should be easier to understand what's going wrong. But this is tricky stuff. I still remember the first designs I made. It took days before it finally worked, and then I looked at the design and wondered why it took so long to write 50 lines :)


Top
 Profile  
Reply with quote  
PostPosted: Tue Oct 23, 2012 7:32 pm 
Offline

Joined: Mon Mar 02, 2009 7:27 pm
Posts: 3258
Location: NC, USA
Ok, I fixed my code to the following which seems like it should work but it still has the same action:
Code:
module VDACif( input clk108,
               input hstart,
               input vstart,               
               input hblank,
               output reg [4:0] Red_data,
               output reg [5:0] Green_data,
               output reg [4:0] Blue_data,
               output reg DACBLANKn = 1
               );

reg countflag;
reg [8:0] Hcount;
reg [7:0] Vcount;

always @(posedge clk108)
      if ( !hblank )
         Hcount <= Hcount + 1;
      else if ( hblank )
         Hcount <= 0;
      
always @(posedge clk108)
      if ( hstart )
         countflag <= 1;   //countflag active in display area
      else if ( hblank )
         countflag <= 0;
      
always @(posedge clk108)
   if ( countflag )
         Red_data <= Hcount[0] ? 0 :
                     5'b11111;
   else if ( hblank )
         Red_data <= 0;
                     
always @(posedge clk108)
   if ( countflag )
         Green_data <= Hcount[0] ? 0 :
                       6'b111111;
   else if ( hblank )
         Green_data <= 0;
                      
always @(posedge clk108)
   if ( countflag )
         Blue_data <= Hcount[0] ? 0 :
                      5'b11111;
   else if ( hblank )
         Blue_data <= 5'b11111;   
      
endmodule

Arlet wrote:
Try running a simulation. It will show you the timing diagrams, and then it should be easier to understand what's going wrong. But this is tricky stuff. I still remember the first designs I made. It took days before it finally worked, and then I looked at the design and wondered why it took so long to write 50 lines :)

Sim's on these video circuits are so long... I will continue tomorrow.

_________________
65Org16:https://github.com/ElEctric-EyE/verilog-6502


Top
 Profile  
Reply with quote  
PostPosted: Tue Oct 23, 2012 7:39 pm 
Offline
User avatar

Joined: Tue Nov 16, 2010 8:00 am
Posts: 2353
Location: Gouda, The Netherlands
Quote:
Sim's on these video circuits are so long... I will continue tomorrow.

What I usually do is make the screen size smaller in simulation. Say 32x20 pixels, and then it won't take so long. Also, initialize the counters so that you're just above the visible part of the screen, so you don't have to wait for the blanking intervals.


Top
 Profile  
Reply with quote  
PostPosted: Tue Oct 23, 2012 8:01 pm 
Offline

Joined: Mon Mar 02, 2009 7:27 pm
Posts: 3258
Location: NC, USA
Arlet wrote:
Quote:
Sim's on these video circuits are so long... I will continue tomorrow.

What I usually do is make the screen size smaller in simulation. Say 32x20 pixels, and then it won't take so long...

Excellent advice, thanks!

_________________
65Org16:https://github.com/ElEctric-EyE/verilog-6502


Top
 Profile  
Reply with quote  
PostPosted: Wed Oct 24, 2012 5:51 pm 
Offline

Joined: Mon Mar 02, 2009 7:27 pm
Posts: 3258
Location: NC, USA
Well this was the best I could do without help:
Code:
module VDACif( input clk108,
               input hstart,
               input vstart,               
               input hblank,
               input vblank,
               output reg [4:0] Red_data = 0,
               output reg [5:0] Green_data = 0,
               output reg [4:0] Blue_data = 0,
               output reg DACBLANKn = 1
               );

reg countflag;
reg Alt;                                    //

always @(posedge clk108)
      if ( hstart )
         countflag <= 1;                  //countflag active in display area
      else if ( hblank | vblank )
         countflag <= 0;
      
always @(posedge clk108)                  //Alternate on-off pixel value
   //if ( countflag )
      Alt <= ~Alt;         
      
always @(posedge clk108)                  //outgoing data to videoDAC
      if ( countflag ) begin
         if ( Alt ) begin                               //white pixel
            Red_data <= 5'b11111;      
            Green_data <= 6'b111111;
            Blue_data <= 5'b11111;
         end
            else begin                            //black pixel
               Red_data <= 0;
               Green_data <= 0;
               Blue_data <= 0;
            end
      end
      else if ( vblank | hblank ) begin               //border
            Red_data <= 0;
            Green_data <= 0;
            Blue_data <= 5'b11111;
         end
   
endmodule

And the result:
Image

_________________
65Org16:https://github.com/ElEctric-EyE/verilog-6502


Top
 Profile  
Reply with quote  
PostPosted: Wed Oct 24, 2012 6:09 pm 
Offline
User avatar

Joined: Tue Nov 16, 2010 8:00 am
Posts: 2353
Location: Gouda, The Netherlands
Instead of picking colors based on countflag and hblank/vblank, you could make a x/y counter.

Restart x = 0 at htstart, and increment x when countflag = 1. If you get it right, x should go from 0 to 639 (for normal VGA). Then, you can select a pixel color based on x value.


Top
 Profile  
Reply with quote  
PostPosted: Wed Oct 24, 2012 6:59 pm 
Offline

Joined: Mon Mar 02, 2009 7:27 pm
Posts: 3258
Location: NC, USA
Counters, yes I started with counters earlier. So I modified my code and have this now, with same action in previous pic:
Code:
module VDACif( input clk108,
               input hstart,
               input vstart,               
               input hblank,
               input vblank,
               output reg [4:0] Red_data = 0,
               output reg [5:0] Green_data = 0,
               output reg [4:0] Blue_data = 0,
               output reg DACBLANKn = 1
               );

reg countflag;
reg [8:0] X = 0;
reg [7:0] Y = 0;

always @(posedge clk108)
      if ( hstart )
         countflag <= 1;                  //countflag active in display area
      else if ( hblank | vblank )
         countflag <= 0;
         
always @(posedge clk108)
   if ( countflag )
      X <= X + 1;
      else
         X <= 0;
         
always @(posedge clk108)                  //outgoing data to videoDAC
      if ( vblank | hblank ) begin
         Red_data <= 0;
         Green_data <= 0;
         Blue_data <= 5'b11111;
      end
         else if ( X[0] ) begin
            Red_data <= 5'b11111;      
            Green_data <= 6'b111111;
            Blue_data <= 5'b11111;
         end
            else begin
               Red_data <= 0;
               Green_data <= 0;
               Blue_data <= 0;
            end
               
endmodule

Much easier to see in sim now I can see the X counter, it is resetting properly...
Now that nasty retrace going across the back of the screen, how do we get rid of it? Is it possible for a different colored border without using the videoDAC DACBLANK signal? or will we be forced to use black borders?

EDIT: video is presently 320x200.

_________________
65Org16:https://github.com/ElEctric-EyE/verilog-6502


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 155 posts ]  Go to page Previous  1 ... 5, 6, 7, 8, 9, 10, 11  Next

All times are UTC


Who is online

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