Home

Awesome

Gem Version CI codecov

FLGen

FLGen provides a DSL to write filelists and generator tool to generate a filelist which is given to EDA tools.

Install

Ruby

FLGen is written in Ruby programing language and its required version is 3.0 or later. You need to install Ruby before using FLGen. See this page for further details.

Install FLGen

Use the command below to isntall FLGen.

$ gem install flgen

Filelist

FLGen prives APIs listed below to describe your filelists.

FLGen's filelist is designed as an inernal DSL with Ruby. Therefore you can use Ruby's syntax. For example:

if macro? :GATE_SIM
  source_file 'foo_top.v.gz' # synthsized netlist
else
  source_file 'foo_top.sv' # RTL
end

About the from argument

The from argument is to specify how to search the given file or directory. You can specify one of three below.

Default behaviors when the from argument is not spcified are listed below:

API nameDefault from argument
source_file:current
file_list:root
library_file:current
include_directory:current
library_directory:current
find_files:current
find_file:current

You can change the above default behaviors by using the default_search_path API. In addition, you can reset the default behaviors by using the reset_default_search_path API.

default_search_path source_file: :root, file_list: :current
source_file 'foo.sv'    # FLGen will search the 'foo.sv' file from the root directories.
file_list 'bar.list.rb' # FLGen will eaarch the 'bar.list.rb' file from the directory where this file list is.

reset_default_search_path :source_file, :file_list
source_file 'baz.sv'    # FLGen will search the 'baz.sv' file from the directory where this file list is.
file_list 'qux.list.rb' # FLGen will eaarch the 'qux.list.rb' file from  the root directories.

Example

This is an exmaple directory structure.

foo_project
+-- .git
+-- bar_project
|   +-- .git
|   +-- common
|   |   `-- common.sv
|   `-- src
|       + bar.list.rb
|       ` bar.sv
`-- common
    `-- common.sv

Generator command

flgen is the generator command and generate a filelist which is given to EDA tools from the given filelists. Command line options are listed below.

Example

You can find an exmpale from here.

$ flgen --output=filelist.f sample/foo.list.rb
$ cat filelist.f
//  flgen version 0.17.0
//  applied arguments
//    --output=filelist.f
//    sample/foo.list.rb
+define+BAR_0
+define+BAR_1=1
+incdir+/home/taichi/workspace/pezy/flgen/sample/bar
+incdir+/home/taichi/workspace/pezy/flgen/sample/bar/baz
-y /home/taichi/workspace/pezy/flgen/sample/bar/bar_lib
-v /home/taichi/workspace/pezy/flgen/sample/foo_lib.sv
-foo_0
/home/taichi/workspace/pezy/flgen/sample/foo.sv
/home/taichi/workspace/pezy/flgen/sample/bar/bar.sv
/home/taichi/workspace/pezy/flgen/sample/bar/baz/baz.sv

rggen-sample-testbench uses FLGen. This can be a practical example.

License

FLGen is licensed under the Apache-2.0 license. See LICNESE and below for further details.

Copyright 2022 PEZY Computing K.K.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.