4 ms·
> Once you have that stuff in your head you can turn to verilog (or vhdl or whatever) and learn how to map these ideas into the language Yes, and per the other
by pjc50 5y ago
> Once you have that stuff in your head you can turn to verilog (or vhdl or whatever) and learn how to map these ideas into the language
Yes, and per the other comment this is a huge limitation of them - you don't have Javascript authors saying "you need to work out what you want in this other paradigm and then translate it". You occasionally see people writing C this way though, by working out what they want from the assembly and working backwards, which tends to get wrecked by UB or the optimizer at some security-critical point.
If the main point of the language is to generate flops, flops should be an explicit primitive!
> Verilog is an early object oriented language - modules are objects
Maybe, but IMO a more useful place to apply object orientation would be interfaces, which are nets not modules. I should be able to instantiate "AXI bus" somewhere and connect things to it.
- gswdh 5y ago> "you need to work out what you want in this other paradigm and then translate it" Not really. You wouldn't expect good programs from someone who has no idea how a computer works. The language is the knobs and dials. You need to know what the knobs and dials do in the machine.
- stdbrouw 5y ago> Not really. You wouldn't expect good programs from someone who has no idea how a computer works. I wouldn't expect them to write a good operating system, but for the vast majority of code that is being written you can get pretty far with "your cpu is faster than your memory" as the only bit of knowledge about how computers work.
- _0ffh 5y agoI've once read a blog entry from a developer who was hired to speed up some piece of software. He achieved a few hundred fold speed up. Not primarily because he is so good (though he is), but because the original developer had a large matrix of numbers stored as a 2d-array of strings and converted them back and forth whenever he had to do an operation on that matrix. You simply can't make up the shit that some people will do.
- FPGAhacker 5y agoThe main point of verilog is to simulate digital logic, of which flip flops are just one part. As to the second point, you can do exactly what you said, instantiate a SystemVerilog “AXI bus” interface and connect things to it. With the interface being a single line item in the port map. This comes with its own set of headaches and I’m not always sure it’s worth it.
- tsmi 5y ago> The main point of verilog is to simulate digital logic I disagree. A HDL, which verilog is an instance of, provides a precise description of a digital machine. Once you have that description, many things can be done with it. For example you can simulate the machine which is to be produced. The problem is HDL looks like an algorithm, because it is. But it’s not a precise description of a computation, it’s a description of an object. Most people who I’ve observed program verilog badly do so because they confuse the two. Kinda like confusing giving directions with giving instructions to make a map. Directions and maps are highly related, but they’re not the same thing.
- nicoburns 5y ago> you don't have Javascript authors saying "you need to work out what you want in this other paradigm and then translate it" Senior JavaScript developers will. They'll be thinking in terms of types and allocations, even if the language doesn't enforce them. Even junior javascript developers will usually have some concept of async IO execution.
- pavlov 5y ago> 'you don't have Javascript authors saying "you need to work out what you want in this other paradigm and then translate it"' Well, React with the hooks API has basically become that. You need to imagine your code first as computational effects triggered by state dependencies in an implicit stack, and then you translate that into a language where all of that must be represented as either calling functions or passing functions around.
- fargle 5y agoThis article is really dated (2013?). Since it was written "Verilog" is now merged with "SystemVerilog". Pre-Verilog 2005 to me looks as crufty now as K&R (pre-ANSI C89). > I should be able to instantiate "AXI bus" somewhere and connect things to it There's a powerful concept called Interfaces which is pretty exactly what you just invented. You can create (and I have) an AXI Interface, even parameterized by address or data widths, etc. You can create these interfaces and connect them to modules very efficiently. SystemVerilog/Verilog has grown to a very excessive bulky language, but unless you are doing exclusively validation/simulation and want things like UVM, the "synthesizable subset" is pretty sensible and one can very productively stick to that.
- fargle 5y ago> If the main point of the language is to generate flops, flops should be an explicit primitive! Well, firstly it isn't, as others have explained. It's broader - describe a digital logic circuit - efficiently. Secondly, it's trivially possible to explicitly generate flip-flops and other hardware primitives using a more "structural" approach: DFF mydff( .clk (clk100), .rst, // means .rst(rst) .d (in), .q (out) ); Thirdly, the whole reason that we have "synthesis" is to allow a much higher-level description that is not so explicitly "structural". It gets really unwieldy otherwise: reg [127:0]out; always_ff @(posedge clk) out <= in; There - I just made 128 of those flip-flops. Also, told you it was a "128 bit register that was clocked on the positive edge". One can at once describe the meaning of the circuit, describe the circuit, and make a event-driven-simulator of the circuit. For really large numbers of elements in a terse but understandable format. It ain't perfect, but it's doing a lot more than I think a lot of people realize and a lot more than a lot of similar looking procedural languages do.