element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
FPGA
  • Technologies
  • More
FPGA
Blog Getting started with the ARTY-S7 and the VGA PMOD expansion module.
  • Blog
  • Forum
  • Documents
  • Quiz
  • Events
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join FPGA to participate - click to join for free!
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: jugal
  • Date Created: 2 Aug 2022 8:15 PM Date Created
  • Views 2970 views
  • Likes 8 likes
  • Comments 8 comments
  • 7 Ways to Leave Your Spartan-6
  • fpga
  • vivado
  • fpga-project
  • spartan-7
  • Spartan_Migration
Related
Recommended

Getting started with the ARTY-S7 and the VGA PMOD expansion module.

jugal
jugal
2 Aug 2022
Getting started with the ARTY-S7 and the VGA PMOD expansion module.

image

Introduction:

Greetings everyone!

Over the next few days I will be posting blogs describing my project entry for the 7 Ways to leave your Spartan-6 challenge.

So what is my project? It is a Mandelbrot set "explorer" built around the Arty S7 FPGA board; the centerpiece of this competition.

imageOn the right is a rendered image of the Mandelbrot set, it is a pattern which is both, self-similar and infinitely detailed.

It is the most well known example of a fractal and was first visualized in 1980 by the mathematician named Benoit Mandelbrot. The set is generated by iterating a complex (yet simple!) equation for each pixel coordinate (x,y) of the image. The boundary of the Mandelbrot set shows more intricate detail on zooming into it, and sends you into an infinite spiral of breathtaking visuals. The next blog will dive into deeper detail on what this complex equation is and how exactly is it computed using our Spartan 7 FPGA. This is a great video about the topic if you would like to learn about it.

Key components:

  • The ARTY S7 FPGA board.
  • The VGA PMOD expansion module.
  • A PS2 mouse (will be used to dynamically zoom into the image!).
  • The PS2 PMOD expansion module (optional).

In this blog...

We will take a quick look at setting up the ARTY S7 with the VGA PMOD and display a test pattern on a monitor.

Note: Instead of explaining every topic from scratch, I have linked the online resource which helped me understand the said topic. Not every HDL module was written by me, and i will attach a link to the original source wherever appropriate. These blogs are intended to be simple reference guides which may help newcomers such as myself utilize all the information freely available online, and put together a fun FPGA project. I will also host the final project files on github in the end, for anyone that wishes to toy around with it or improve it.

If you are new to Vivado I would recommend following this wonderful blog by javagoza describing how to set up a simple project for the ARTY S7.

The VGA PMOD:

The Digilent VGA PMOD expansion module is a cheap and effective way to allow our FPGA board to drive a VGA monitor and display anything we want. For a primer on how VGA works I would recommend Nandland & the Project F blog. Project F is a comprehensive FPGA blog with open source projects and simple libraries which you can use to build your own designs. These libraries can be accessed from here. I will be making use of its VGA driver and framebuffer module (more on this later).

Before we start with the HDL, we need to add pin constraints to our XDC file so that we can drive the VGA PMOD pins in our design.

## PMOD Header JC
set_property -dict { PACKAGE_PIN U15   IOSTANDARD LVCMOS33 } [get_ports { VGA_RED[0] }];
set_property -dict { PACKAGE_PIN V16   IOSTANDARD LVCMOS33 } [get_ports { VGA_RED[1] }];
set_property -dict { PACKAGE_PIN U17   IOSTANDARD LVCMOS33 } [get_ports { VGA_RED[2] }];
set_property -dict { PACKAGE_PIN U18   IOSTANDARD LVCMOS33 } [get_ports { VGA_RED[3] }];
set_property -dict { PACKAGE_PIN U16   IOSTANDARD LVCMOS33 } [get_ports { VGA_BLUE[0] }];
set_property -dict { PACKAGE_PIN P13   IOSTANDARD LVCMOS33 } [get_ports { VGA_BLUE[1] }];
set_property -dict { PACKAGE_PIN R13   IOSTANDARD LVCMOS33 } [get_ports { VGA_BLUE[2] }];
set_property -dict { PACKAGE_PIN V14   IOSTANDARD LVCMOS33 } [get_ports { VGA_BLUE[3] }];

## PMOD Header JD
set_property -dict { PACKAGE_PIN V15   IOSTANDARD LVCMOS33 } [get_ports { VGA_GREEN[0] }];
set_property -dict { PACKAGE_PIN U12   IOSTANDARD LVCMOS33 } [get_ports { VGA_GREEN[1] }];
set_property -dict { PACKAGE_PIN V13   IOSTANDARD LVCMOS33 } [get_ports { VGA_GREEN[2] }];
set_property -dict { PACKAGE_PIN T12   IOSTANDARD LVCMOS33 } [get_ports { VGA_GREEN[3] }];
set_property -dict { PACKAGE_PIN T13   IOSTANDARD LVCMOS33 } [get_ports { VGA_HS }];
set_property -dict { PACKAGE_PIN R11   IOSTANDARD LVCMOS33 } [get_ports { VGA_VS }];

These constraints will map the pins of our PMOD headers JC & JD to the corresponding VGA signals of the VGA PMOD. For more details of the pin mappings refer to the reference manual of the VGA PMOD.

After adding these constraints we can use these appropriately named VGA signals in our top level module.

I have chosen 640x480 as the target resolution for our design which I believe is the sweet spot, to go any higher we would need more BRAM resources to store a full image on our FPGA. To achieve a 640x480 60Hz display operation we need our pixel clock frequency to be roughly 25Mhz.

800 horizontal counts (640 pixels + 160 blanking intervals) * 525 vertical counts (480 pixels + 45 blanking intervals) * 60 (frames per second) = 25.2 Mhz !

Here is a quick reference about timing information for different display resolutions.

To generate this pixel clock I will be using the clocking wizard IP which uses on-chip MMCM to generate a clock frequency requested by the user. This is a great video on how to set up and use this IP.

Here is what the top module definition will look like:

module arty_s7_top(
    input CLK_IN_100M,
    input [3:0] SW,
    output VGA_HS,
    output VGA_VS,
    output [3:0] VGA_RED,
    output [3:0] VGA_GREEN,
    output [3:0] VGA_BLUE
    );
    
wire clk_25M;
wire clk_100M;

clk_wiz_0 clk
 (
  // Clock out ports
  .clk_out1(clk_25M),
  .clk_out2(clk_100M),
  // Status and control signals
  .reset(SW[0]), 
 // Clock in ports
  .clk_in1(CLK_IN_100M),
  .locked()
 );
 
 
wire [15:0] x, y;

// start of frame (pulsed HIGH on each new frame)
// data enable (HIGH when counters are in active pixel region)
wire sof, de;
display_480p vga(
    .clk_pix(clk_25M),
    .rst(SW[0]),
    .hsync(VGA_HS),
    .vsync(VGA_VS),
    .sx(x),
    .sy(y),
    .frame(sof),
    .de(de),
    .line()
); 

endmodule

The display_480p module drives the hsync and vsync signals appropriately. The signal "de" is high when our VGA counters are in the active pixel drawing area and not in the blanking intervals. sx & sy indicate the coordinates of the pixel which is current being drawn on the monitor screen. We can use this information to draw some colours at specific locations on our screen.

We can use simple combinational logic to drive the VGA_<colour> signals, these assign statements will draw three horizontal bars of equal size across the screen.

assign VGA_RED   = (de && (y < 160))              ? 4'hF : 0;
assign VGA_GREEN = (de && (y > 160 && y < 320))   ? 4'hF : 0;
assign VGA_BLUE  = (de && (y > 320))              ? 4'hF : 0;

Fun fact: This technique of using combinational logic to generate graphics was used to make the famous arcade game PONG. It was made purely out of hardware.

For our final design we will look at a more modern method, which stores the colour information of each individual pixel in BRAM memory. We will simply fetch the colour value of each pixel from memory rather than generating the colour on the fly. This will allow us to draw any arbitrary image.

Result:

image

  • Sign in to reply
  • javagoza
    javagoza 1 month ago in reply to Aashking23

    https://digilent.com/reference/_media/reference/pmod/pmodvga/pmodvga_sch.pdf

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • Aashking23
    Aashking23 1 month ago

    What about we don't have Pmod VGA expansion module, so how would we map the connections with the board

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • jugal
    jugal over 2 years ago in reply to javagoza

    I did not use multiplier IP cores. As it stands, the design uses 12 DSP slices with pipelined output. I managed to clock the design at 150Mhz, post which some BRAM blocks produce timing violations. I will try to fix them soon. I'm curious to see how much faster can It run. According to the datasheet It should be possible to go up to 200/300mhz with all the pipeline registers enabled.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • javagoza
    javagoza over 2 years ago in reply to jugal

    It's a shame you couldn't finish. I was looking forward to seeing your implementation. It is a good project to test the 120 DSP slices 25 x 18 multiplier that the Spartan-7 of the Arty S7 has. Have you used the Xilinx Multiplier IP core or are you doing it from scratch?

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • jugal
    jugal over 2 years ago

    Despite of finishing the implementation of all tasks a while ago, I could not start writing the blogs on time due to some personal reasons. It seems that now there is no way to finish writing them before the deadline :( I am halfway through the second blog but I still plan to keep posting them even after the deadline so that the community can use/improve my project if they wish to do so. I will take a bit more time to finish the blogs since this project calls for a great amount of detail. Good luck to all the participants and thank you for the opportunity rscasny.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
>
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube