Electronics > FPGA

Best and Worst HDL Features

(1/3) > >>

Omega Glory:
I'm very interested in programming languages and HDLs, and I was curious as to which features of HDLs you find the most helpful/expressive, or the most frustrating. I only have experience with Verilog, but I'm also curious about your insights into languages like VHDL, Migen, SpinalHDL, etc. as well. I'm not asking this to start a flame war about which is the "best" language, but just to get a deeper insight into which syntactical features and idioms are particularly useful, and which make expressing a design awkward or difficult. I'm thinking of developing an HDL embedded in Racket (a lisp/scheme language), which is why I'm asking.

Bassman59:

--- Quote from: Omega Glory on July 19, 2021, 04:44:07 pm ---I'm not asking this to start a flame war about which is the "best" language
--- End quote ---

Too late!

SiliconWizard:
First question would be: have you looked at existing alternative HDLs, such as - as you mentioned - SpinalHDL, nMigen, Chisel, ...?

What do you think you could do better or at least differently, apart from using Racket? Also what's your rationale for using Racket here?

I understand that your topic is to help you answer at least the two first questions, but IMHO, if you're not skilled enough in existing HDLs to be able to answer this yourself, designing a new HDL might be a tricky endeavour. Now getting feedback from others is always good, but I think that would have helped if you had started by exposing what you intended on implementing and why.

I may add thoughts as the thread unfolds. Oh and you were well inspired to warn against starting a language war, but  - unless no one posts here - I think it has a good chance of happening anyway. ;D

cfbsoftware:

--- Quote from: Omega Glory on July 19, 2021, 04:44:07 pm ---to get a deeper insight into which syntactical features and idioms are particularly useful, and which make expressing a design awkward or difficult.

--- End quote ---
In that case, the following paper should be of interest to you: An Implementation of Lola-2 or Translating from Lola to Verilog by N.Wirth, 30.11.2014

https://people.inf.ethz.ch/wirth/Lola/LolaCompiler.pdf

Omega Glory:

--- Quote from: SiliconWizard on July 19, 2021, 07:27:55 pm ---First question would be: have you looked at existing alternative HDLs, such as - as you mentioned - SpinalHDL, nMigen, Chisel, ...?

--- End quote ---

I've looked at nMigen to some degree, however the documentation is rather limited at this phase so the learning curve feels pretty steep.


--- Quote from: SiliconWizard on July 19, 2021, 07:27:55 pm ---What do you think you could do better or at least differently, apart from using Racket? Also what's your rationale for using Racket here?

--- End quote ---

One advantage of nMigen is that it is embedded into Python, so that in addition to describing hardware with the nMigen libraries, you can make use of the rest of Python to allow for more automation and generation of your HDL. A really trivial example would be calculating filter coefficients and then inserting them into the design. Unfortunately the syntax nMigen uses for describing hardware is pretty awkward because it has to conform to Python's syntax. Racket allows you to extend its syntax pretty easily, and so I think it would be possible to create a really clean embedded HDL. The advantages would be having an elegant syntax for the HDL, while still having access to Racket as full featured programming language for automation and generation.


--- Quote from: SiliconWizard on July 19, 2021, 07:27:55 pm ---I understand that your topic is to help you answer at least the two first questions, but IMHO, if you're not skilled enough in existing HDLs to be able to answer this yourself, designing a new HDL might be a tricky endeavour. Now getting feedback from others is always good, but I think that would have helped if you had started by exposing what you intended on implementing and why.

--- End quote ---
I agree with you. For Verilog, some of the things that annoy me about its syntax is that you can't write to the same register in different always blocks, even if the logic is designed so that there will never be an issue with multiple drivers to a single register. For example:


--- Code: ---// let cond_a and cond_b be mutually exclusive events
// we may write write:
always @(posedge clk) begin
    if(cond_a) begin
        foo <= 2'b1;
    end
    else(cond_b) begin
        foo <= 2'b3;
    end
end

// but if cond_a and cond_b are generated by fairly unrelated portions of the design
// it might be nice to have separate always blocks in different parts of the code to
// write to foo. For example:

always @(posedge clk) begin
    if(cond_a) begin
        foo <= 2'b1;
    end
    // some more stuff here
end

// lots more stuff here

always @(posedge clk) begin
    if(cond_b) begin
        foo <= 2'b3;
    end
    // some more stuff here
end

// while in some cases this might be a lot more clear and readable,
// it is illegal in Verilog

--- End code ---

Another feature I think might be really nice in Verilog, is a way to group a set of signals together and refer to them as a single bus. There are certainly ways to do this quickly, but it might be nice to have something like the record type that VHDL has.

I certainly don't know enough about other HDLs to actually attempt to write one yet, but I was hoping that some people would point out things they liked in various languages, so I could go investigate them and learn about useful features/idioms.

Navigation

[0] Message Index

[#] Next page

There was an error while thanking
Thanking...
Go to full version