FPGAGridGen

class util.FPGAGridGen.FPGAGridGen(design_name, arch_file, layout, release_root=None)[source]

This class generates the 2D lsit of the FPGA grid, based on the provided VPR architecture file. This class generate two grid

self.grid : This is logic blocks grid including IOs (NxM)

self.full_grid : This is complete grid with a logic and routing blocks (N-1)x(M-1)

Where NxM is width and height of the FPGA, including IO

Example execution:

python FPGAGridGen.py --design_name FPGA66_flex --layout dp
        --arch_file example_files/vpr_arch_render_demo.xml

Expected Output:

 EMPTY     io_top     io_top     io_top     io_top     io_top     io_top     EMPTY
io_left     clb        clb        clb        clb        clb        clb      io_right
io_left     clb        clb        clb        clb        clb        clb      io_right
io_left    ram9k        →        ram9k        →        ram9k        →       io_right
io_left     clb        clb        clb        clb        clb        clb      io_right
io_left     dsp         →         dsp         →         dsp         →       io_right
io_left     clb        clb        clb        clb        clb        clb      io_right
 EMPTY   io_bottom  io_bottom  io_bottom  io_bottom  io_bottom  io_bottom    EMPTY

Attributes:

design_name

Design name

fpga_arch

Instance of OpenFPGA_Arch class

grid

2-Dimentional grid for logic blocks grid[0] bottom most row

full_grid

2-Dimentional grid for logic block and routing elements

Methods:

get_width()

Get width of FPGA

get_height()

Get height of FPGA

print_grid([grid])

Prints logic block grid

get_block(x, y)

This method returns the module present in specific x and y cordinate.

get_top_instance(x, y)

This method generates the grid instance information given the cordinate points

add_fill(ele)

Fill the grid with given element

add_perimeter(ele)

Add given element on the periphery of the grid

add_corners(ele)

Add given element on the corners of the grid

add_single(ele)

Add given element to the specifica location of the grid

enumerate_grid()

Enumerates the FPGA grid

validate_grid()

Checks for the correctness of the grid

render_layout([filename, grid_io, markers])

Renders the given layout

design_name = ''

Design name

Type

str

fpga_arch = None

Instance of OpenFPGA_Arch class

Type

OpenFPGA_Arch

grid = None

2-Dimentional grid for logic blocks grid[0] bottom most row

Type

list(list)

full_grid = None

2-Dimentional grid for logic block and routing elements

Type

list(list)

get_width()[source]

Get width of FPGA

get_height()[source]

Get height of FPGA

print_grid(grid='grid')[source]

Prints logic block grid

get_block(x, y)[source]

This method returns the module present in specific x and y cordinate. The return value contains module name and adjusted X and Y cordianates

the cordiante origin starts from the first element of top most list and first element of the first element of list of list

get_top_instance(x, y)[source]

This method generates the grid instance information given the cordinate points

add_fill(ele)[source]

Fill the grid with given element

Parameters

ele (ET) – Accepts Element Tree (element) as a input

add_perimeter(ele)[source]

Add given element on the periphery of the grid

Parameters

ele (ET) – Accepts Element Tree (element) as a input

add_corners(ele)[source]

Add given element on the corners of the grid

Parameters

ele (ET) – Accepts Element Tree (element) as a input

add_single(ele)[source]

Add given element to the specifica location of the grid

Parameters
  • ele (ET) – Accepts Element Tree (element) as a input

  • ele.x (int) – x locations to insert

  • ele.y (int) – y locations to insert

enumerate_grid()[source]

Enumerates the FPGA grid

Returns

Returns 2D grid

Return type

(list(list(str)))

validate_grid()[source]
Checks for the correctness of the grid
  • if right and up arrows are placed correctly in the grid

  • if the boundry blocks has correct grid value

render_layout(filename=None, grid_io=False, markers=False)[source]

Renders the given layout