New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Lowlevel LLVM-like language as HDL middle layer #19
Comments
Related f4pga/prjxray#58 |
That's the medium-term goal for Gaffe after enough basic libraries exist to
do things like parse BLIF and serialize a graph. See also
https://github.com/rdaly525/coreir.
…On Fri, Nov 16, 2018 at 5:51 AM Anton Kochkov ***@***.***> wrote:
Related f4pga/prjxray#58
<f4pga/prjxray#58>
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#19 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AJBDl336Ug4ALYUIzXMA9714Klb3eaqcks5uvsLSgaJpZM4YmSht>
.
|
There is also https://bar.eecs.berkeley.edu/projects/firrtl.html
|
Edit: @mithro beat me by a few minutes! Original reply with more detail on FIRRTL below. Are you aware of FIRRTL? Chisel3 already compiles to FIRRTL (a flexible intermediate representation of RTL analogous to "LLVM IR for circuits"). There exists a Verilog to FIRRTL path through Yosys and some other frontends are compatible (Magma can target FIRRTL, an experimental version of HALIDE can target FIRRTL, and Spatial targets Chisel). The FIRRTL compiler is an optimizing compiler with a provided backend for Verilog. Any FPGA/ASIC tool vendor, if they so desire, can directly use FIRRTL for synthesis and place and route if they want to support it. Any user wanting to build a new frontend can target FIRRTL. Any user wanting to write a new backend (e.g., for VHDL) can consume FIRRTL. Additionally, FIRRTL uses an "annotation" concept for attaching metadata to specific components in a circuit. This quickly becomes necessary for controlling downstream FIRRTL transforms and for use by downstream ASIC/FPGA tools, e.g., pad placement, clock timing information, etc. Automatic operation of downstream tools using annotations is being developed in the HAMMER project. FIRRTL, through it's Verilog generation path, is battle tested, having been used to generate Verilog used for numerous tape outs at Berkeley and SiFive (Rocket Chip and BOOM RISC-V microprocessors) Google (Edge TPU), and other institutions/companies. It seems reasonable to cut out the Verilog/VHDL middle man in all this. That will require buy-in from closed source CAD vendors. (Note: this is an expanded copy/paste of a reply in the associated issue filed issue on the Chisel3 repo.) |
There is also coreir. The open hardware community really needs such a language, It is quite clear. I think that FIRRTL is good enough and already has large community. It would be great to have FIRRTL library for some languages like C++/Python/Java managed by creators of FIRRTL. If such a library exists for Python3 It would save me a lot of time and it will ensure the better compatibility in future. I have some "hdl transpiler" HWT (meta-HDL + verification env.) as you found and I will probably use FIRRTL as in backend in next release. There are many hardware generators, for example P4-to-VHDL. Problem is that the autors of such a tools have to implemented lots of same code over and over. The project are completely incompatible. It is not just FPGA-like assembly language and to VHDL/Verilog/SystemC conversions. There are graph algorithms which literary everyone has to implemented, like searching of isomorphic graphs etc. @XVilka I think that there is a great opportunity in abstract specification of interface functions rather than in next FPGA-like assembly language. I have experimented with automatically generated DMA engines. The results are promising. The goal is to allow transaction level description with some extra meta-information specified by user. Not entirely the HLS bus some kind of metalanguage and automatic pipeline generator. I think the first step is to create some consortium-like group for driving of the development of FIRRTL libraries in different programming languages and for management of libraries which are using FIRRTL. There is a very long road ahead (verifications, simulator-driver interfaces, analysis, HLS, architecture retargeting...), we need to act fast. What ever you end up doing I am ready to help. |
@Nic30: good points.
On the Chisel/FIRRTL side, we're trying to come up with some clear governance around Chisel/FIRRTL. We have Reviewer Guidelines upstreamed and a Constitution and Contributions PR'd. This is taking place on the chisel-lang-governance repo and all of this is open to issues/PRs. The intent is to eventually have a catching organization/consortium for these projects. This is in its nascent form as the Free Chips Project GitHub Organization. However, this primarily exists on GitHub at this time... We just wrapped up the first Chisel Community Conference in the Bay Area and are planning to send out a form to identify what areas of development or non-development (testing upstream on big internal projects, outreach, etc.) individuals would be willing to help out on. This is expected to be posted on the chisel-users and chisel-announce mailing lists, but we can publicize this more widely (i.e., here). |
@drom and I have started building out parsers for BLIF (
https://github.com/gaffe-logic/tree-sitter-blif) and Verilog (
https://github.com/drom/tree-sitter-verilog) based on
http://github.com/tree-sitter/tree-sitter. So far, tree-sitter feels
easier to develop a grammar and tests in. The result is a pure-C,
incremental parser that already has bindings to Rust, Haskell, JavaScript,
and Ruby. Higher-level libraries that convert the resulting ASTs into a
language-specific, semantic representation will still need to be built
after the parsers are ready.
If someone wrote a tree-sitter parser for FIRRTL, we'd be well on our way
toward having a reusable library that works both for toolchain components
as well as editors and language servers.
As for having a single organization, currently there are many: Free Chips
Project, SymbiFlow, YosysHQ, Gaffe Logic, FOSSi. Most of these are loose
affiliations related to a single tool or family of tools. I'm unclear on
any benefit to having a single governing body for these widely-varied
projects. Certainly having a focused place for community discussions would
be helpful. Some of the larger projects might benefit from clearer
governance. If someone wants to talk about different governance models,
licensing, and foundations, please get in touch. I spent ~1yr working with
Linux Foundation to get OpenBMC setup as an independent project with
contributors from IBM, Intel, Facebook, Google, and Microsoft. I can
definitely assist in getting everyone in touch with the major players in
the free and open software foundations.
Rick
…On Fri, Nov 16, 2018 at 1:11 PM Schuyler Eldridge ***@***.***> wrote:
@Nic30 <https://github.com/Nic30>: good points.
- Python/C/C++/MyLanguage libraries for FIRRTL seems to make sense to
improve the ease of frontend/backend development. The existing antlr and
protobuf specifications for FIRRTL may already ease this.
- Yes, the idea is to not have everyone write the same dead code
elimination/constant propagation passes...
On the Chisel/FIRRTL side, we're trying to come up with some clear
governance around Chisel/FIRRTL. We have Reviewer Guidelines upstreamed and
a Constitution and Contributions PR'd. This is taking place on the
chisel-lang-governance
<https://github.com/freechipsproject/chisel-lang-governance> repo and all
of this is open to issues/PRs. The intent is to eventually have a catching
organization/consortium for these projects. This is in its nascent form as
the Free Chips Project GitHub Organization
<https://github.com/freechipsproject/>. However, this primarily exists on
GitHub at this time...
We just wrapped up the first Chisel Community Conference in the Bay Area
and are planning to send out a form to identify what areas of development
or non-development (testing upstream on big internal projects, outreach,
etc.) individuals would be willing to help out on. This is expected to be
posted on the chisel-users
<https://groups.google.com/forum/#!forum/chisel-users> and chisel-announce
<https://groups.google.com/forum/#!forum/chisel-announce> mailing lists,
but we can publicize this more widely (i.e., here).
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#19 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AJBDl2ayq9ZMn6O5aXg09UEMsK5yVdNCks5uvyn7gaJpZM4YmSht>
.
|
Hmm it's been a while since I looked at the firrtl spec, but I seem to
recall that there is one implicit clock thereby not supporting multiple
clock domains and not making it very useful for FPGAs.
…On Fri, Nov 16, 2018, 22:25 Rick Altherr ***@***.*** wrote:
@drom and I have started building out parsers for BLIF (
https://github.com/gaffe-logic/tree-sitter-blif) and Verilog (
https://github.com/drom/tree-sitter-verilog) based on
http://github.com/tree-sitter/tree-sitter. So far, tree-sitter feels
easier to develop a grammar and tests in. The result is a pure-C,
incremental parser that already has bindings to Rust, Haskell, JavaScript,
and Ruby. Higher-level libraries that convert the resulting ASTs into a
language-specific, semantic representation will still need to be built
after the parsers are ready.
If someone wrote a tree-sitter parser for FIRRTL, we'd be well on our way
toward having a reusable library that works both for toolchain components
as well as editors and language servers.
As for having a single organization, currently there are many: Free Chips
Project, SymbiFlow, YosysHQ, Gaffe Logic, FOSSi. Most of these are loose
affiliations related to a single tool or family of tools. I'm unclear on
any benefit to having a single governing body for these widely-varied
projects. Certainly having a focused place for community discussions would
be helpful. Some of the larger projects might benefit from clearer
governance. If someone wants to talk about different governance models,
licensing, and foundations, please get in touch. I spent ~1yr working with
Linux Foundation to get OpenBMC setup as an independent project with
contributors from IBM, Intel, Facebook, Google, and Microsoft. I can
definitely assist in getting everyone in touch with the major players in
the free and open software foundations.
Rick
On Fri, Nov 16, 2018 at 1:11 PM Schuyler Eldridge <
***@***.***>
wrote:
> @Nic30 <https://github.com/Nic30>: good points.
>
> - Python/C/C++/MyLanguage libraries for FIRRTL seems to make sense to
> improve the ease of frontend/backend development. The existing antlr and
> protobuf specifications for FIRRTL may already ease this.
> - Yes, the idea is to not have everyone write the same dead code
> elimination/constant propagation passes...
>
> On the Chisel/FIRRTL side, we're trying to come up with some clear
> governance around Chisel/FIRRTL. We have Reviewer Guidelines upstreamed
and
> a Constitution and Contributions PR'd. This is taking place on the
> chisel-lang-governance
> <https://github.com/freechipsproject/chisel-lang-governance> repo and
all
> of this is open to issues/PRs. The intent is to eventually have a
catching
> organization/consortium for these projects. This is in its nascent form
as
> the Free Chips Project GitHub Organization
> <https://github.com/freechipsproject/>. However, this primarily exists
on
> GitHub at this time...
>
> We just wrapped up the first Chisel Community Conference in the Bay Area
> and are planning to send out a form to identify what areas of development
> or non-development (testing upstream on big internal projects, outreach,
> etc.) individuals would be willing to help out on. This is expected to be
> posted on the chisel-users
> <https://groups.google.com/forum/#!forum/chisel-users> and
chisel-announce
> <https://groups.google.com/forum/#!forum/chisel-announce> mailing lists,
> but we can publicize this more widely (i.e., here).
>
> —
> You are receiving this because you commented.
> Reply to this email directly, view it on GitHub
> <#19 (comment)>,
or mute
> the thread
> <
https://github.com/notifications/unsubscribe-auth/AJBDl2ayq9ZMn6O5aXg09UEMsK5yVdNCks5uvyn7gaJpZM4YmSht
>
> .
>
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#19 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAtRr3COwcw89RAajS5Fle4if1QvocjXks5uvy1bgaJpZM4YmSht>
.
|
@kc8apf why are you not using ANTRL4 C++ runtime? |
@dvc94ch Is it possible to have more than single clock domain in current FIRRTL? |
Also if someone is writing a hdl in xyz, they may not like introducing a
dependency on the jvm. It should be able to link statically or dynamically
to a compiler toolkit imo, but maybe that's just me...
…On Sat, Nov 17, 2018, 11:55 Nic30 ***@***.*** wrote:
@dvc94ch <https://github.com/dvc94ch> Is there really possible to have
only one clock domain ?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#19 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAtRr7-7B-B8XkOdOogx7pBK2iR6bm6wks5uv-sEgaJpZM4YmSht>
.
|
Agree, ideal implementation should be in C/C++, so every other
language/framework can link them very easily.
…On Sat, Nov 17, 2018, 7:15 PM David Craven ***@***.*** wrote:
Also if someone is writing a hdl in xyz, they may not like introducing a
dependency on the jvm. It should be able to link statically or dynamically
to a compiler toolkit imo, but maybe that's just me...
On Sat, Nov 17, 2018, 11:55 Nic30 ***@***.*** wrote:
> @dvc94ch <https://github.com/dvc94ch> Is there really possible to have
> only one clock domain ?
>
> —
> You are receiving this because you were mentioned.
> Reply to this email directly, view it on GitHub
> <#19 (comment)>,
or mute
> the thread
> <
https://github.com/notifications/unsubscribe-auth/AAtRr7-7B-B8XkOdOogx7pBK2iR6bm6wks5uv-sEgaJpZM4YmSht
>
> .
>
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#19 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAMZ_XYG-j2aiKyqWwkuI45YZKodWZZXks5uv-_PgaJpZM4YmSht>
.
|
@dvc94ch, @Nic30: FIRRTL supports arbitrary numbers of clocks and, consequently, you can use FIRRTL IR to write circuits with multiple clock domains. You may have been thinking of the default behavior of Chisel modules where one implicit clock and one implicit reset is included. However, there's now a type hierarchy of modules, allowing you to easily remove the implicit clock and reset if you want/need more control. If you want more clocks, you add them as IO and can use scoping to control how they get used. The wiki page for Chisel3 goes into some examples that may help explain what that API looks like: https://github.com/freechipsproject/chisel3/wiki/Multiple-Clock-Domains |
One of my goals is to use the same parsers for editor features such as
syntax highlighting, identifier renaming, etc. Those require as-you-type
performance and incremental parsing, precisely what tree-sitter was
designed for.
I'm also planning to write most of my tools in Rust which is not available
as an ANTLR target. I could use the C++ target and then wrap the API but
tree-sitter already offers Rust bindings.
Now that I've been using tree-sitter, I really appreciate how simple
writing test cases for the parser is. I see that as a big strength for
improving the quality of the parser over time as learning how to write a
new test is trivial.
Rick
…On Sat, Nov 17, 2018, 2:53 AM Nic30 ***@***.*** wrote:
@kc8apf <https://github.com/kc8apf> why are you not using ANTRL4 C++
runtime?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#19 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AJBDl-uoXP_91rqt2s91RUHYftTFJBTZks5uv-qtgaJpZM4YmSht>
.
|
Maybe we should split the topic of parsers and low level IR? While they are somewhat related I think there are definitely different goals here. |
Sure. Parsers are a somewhat later concern. Any IR will need a detailed
spec to enable a variety of implementations. An existing grammar (ANTLR or
otherwise) is insufficient as a spec though I expect an IR to have a very
solid parser and generator for widespread adoption to occur.
…On Sat, Nov 17, 2018, 11:24 AM Tim Ansell ***@***.*** wrote:
Maybe we should split the topic of parsers and low level IR? While they
are somewhat related I think there are definitely different goals here.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#19 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AJBDl9IDci787HuT91HgCDjnYuQ9X156ks5uwGJhgaJpZM4YmSht>
.
|
I have started putting together tree-sitter-firrtl |
|
After nearly a 0.75 year I do think that the HDL middle layer should have 4 separated components.
( This components are already implemented in most of the mentioned tools. However they are somehow tightly coupled with the original tool itself or the format can not be practically used without some restricting frontend etc, so it is not possible to share code. As I was not successful in convincing nearly any other project to keep this issue in mind. I am extracting things from our libraries so it is possible to swap it in future. Today I just saw in MyHDL gitter that they are going to take the same way, probably. |
Hi, I'm coming here due to a suggestion in the ghdl chat. |
@nuess0r thanks! This one is looking indeed quite promising. FIRRTL is good, but being written in Scala it makes embedding it somewhere close to impossible. @Nic30 was working on a more useful approach to implement such a standard in C++, but LLHD looks good from this point of view and quite complete to be usable right now (at least how it looks?). |
Small clarification: the extant implementation of the FIRRTL compiler is written in Scala, but the FIRRTL IR is just a specification and FIRRTL IR serializes to text. I do recognize that the former adds hurdles to people wanting to work with FIRRTL IR in languages which are not Scala (e.g., use of FIRRTL IR in a C++ project requires defining your own datastructures representing FIRRTL IR nodes). |
Seeing quite a lot of work done on LLHD/hdlConvertor/... makes me think that this issue was actually about avoiding of such a thing. At least @fabianschuiki was able to publish it. @XVilka There was no community for netlistDB and that is why there is no development in progress. However I am finishing hdlConvertor which can parse SV2017, VHDL2008 in universal AST which can also be converted back and small subset can also be interpreted. @seldridge Is there something which compares a FIRRTL with a Verilog equivalent FIRRTL? I need some argument, why not to use just simplified Verilog and why to use another text format which requires an additional library etc. I know that this questions applies to any other format as well, but that makes me interested in response even more. I am planing to integrate FIRRTL in to hdlConvertor which will basically brings the FIRRTL to python/c++ word, but as there is no request for it it takes 1y+. |
Directly, no. However, you can compile FIRRTL IR to Verilog and then LEC that with some other Verilog. This strategy is used in FIRRTL compiler regression tests to compare Verilog across compiler versions: (1) input FIRRTL is converted to Verilog using two versions of the compiler and (2) Yosys is used for equivalence checking. |
I think this is somewhat relevant since they use LLVM as the middle layer too: https://github.com/Xilinx/HLS
|
"for use with Xilinx Vitis HLS "
|
There is also llvm CIRCT, which aims at providing an llvm MLIR for hardware description. |
I gathered a list of 11 different projects which provide some kind of intermediate representation:
All of them have some minimal overlap, but many are designed for an specific purpose or ecosystem. Is anyone aware of a discussion/review/comparison? Most of the papers/references I find are focused on describing features in isolation. |
Not exactly a comparison, but circt uses FIRRTL and llhd as "dialects" to solve different problems. They have some documentation on what they ('d like to) use each dialect for. |
@umarcor I was considering writing the paper about this, but there are so many, the comparison of this is so subjective thing... and I do not want to write this kind of paper alone. ir centric:
hls centric
hcl centric
|
@Uroc327 can you please provide some specific reference? I had a look at the meeting notes, but I found no descriptive explanation. I'm also aware of work in progress for UHDM to RTLIL and UHDM to Verilator. However, rather than one to one bridges, I'd like to know the technical motivations for creating some of those projects, provided that others existed already. For instance, my understanding is:
From VHDL/GHDL's perspective, targeting UHDM seems like a sensible way forward, because it would potentially improve the synthesis and it would allow pre-synthesis mixed-language (VHDL + Verilog + System Verilog) simulation. It would also avoid having to write a ghdlator/vhdlator. Hence, I'd like to understand why target LLHD/CIRCT instead of UHDM, or whether UHDM is to be integrated into CIRCT, as LLHD seems to be. |
@Nic30, I do agree with the wish and not willing to write it alone. In my case, I don't feel confident/authoritative enough for authoring a paper in this area. However, most of the content in a review paper would be descriptive about how long has each project been alive, who are the main developers, which are their motivations and how do they envision the future. Only the last section(s) need to contain some more subjective conclusions. Unfortunately, I won't have time for doing a good writing in the following 3 months, at least. However, I would be interested in gathering the references and comments/descriptions. That is, having some place where I can add quotes and/or refs, when I find them.
The I assume that you did not write the list now, but you copied it from somewhere else. Would you mind pointing to the source (I guess, a repo of yours)? I would like to add the missing items to hdl.github.io/awesome? We can create a category named |
BTW I wouldn't put
Neither is designed to allow "transformations" to be performed on the represented data (like optimization passes and such). |
Impressive list of attempts and tools was gathered here. I agree that we should add everything that is not already in the awesome repo (This repo looks like a modern opencollector.org site :-) ). I'll do that with this tool as well: Original description: "HACKT is a project originally developed at Cornell University for aiding the design of asynchronous circuits. The project continues to be maintained by David Fang, the original author. Compiler -- the HAC input is compiled into object files, which are passed to other back-end tools As it is targeted for asynchronous designs it is based on a completely different strain of languages. HAC source is CHP. Which is a improvement of CACM and CSP (both from C.A.R. Hoare). In the paper "Alain J. Martin and Christopher D. Moore, CHP and CHPsim: A Language and Simulator for Fine-Grain Distributed Computation, 2011, Caltech Technical Report CS-TR-1-2011" I found once a rather short explanation of the development process.
|
I added ~10 new items: https://github.com/hdl/awesome/commits/develop. Enhancements are welcome! |
It's curious that the death rate among HLS solutions is the highest compared to the rest. |
Chisel/FIRRTL is working on adding the support of RTLIL backend, it seems: chipsalliance/firrtl#2331 |
mark |
Basic idea is to create something low-level, like LLVM Bitcode or WebAssembly, to create the HDL compilers emit the code in this format, which will be fed to the routers/synthesizers after. This will allow to add 1) targets easier 2) HDL frontends easier.
Criteria for selection:
- a text version with extracted symbol table?
- more tops per file?
- Include?
- process (Verilog like mux, reg... desc.) / netlist (mux, reg, ... descr. by instance) ?
- is Chisel3 FIRRTL/Yosys RTLIL structural enough?
- Support for strong/weak pull up/down?
Needs of the particular projects:
Chisel3
HWT
magma
MyHDL
SpinalHDL
Veriloggen
Yosys
Updates from #19 (comment) and #19 (comment)
The text was updated successfully, but these errors were encountered: