3 ms·
> Hardware programming is THE area where you need static types always on. It's not "hardware programming". It's hardware design. It's no different from conne
by robomartin 13y ago
> Hardware programming is THE area where you need static types always on.
It's not "hardware programming". It's hardware design. It's no different from connecting raw gates and chips on a breadboard. This is a very important distinction that is often glossed-over in HN conversations.
Verilog is a tool with which you explicitly or by inference DESCRIBE hardware. You are not programming hardware. That's software.
At some level this concept of static types is nonsensical. You have registers made up of flip-flops that move data around from circuit block to circuit block. That's it. Data types, in many ways, are software constructs, they don't really exist in hardware.
One would not look at a breadboard full of chips or an old-school PCB with latch and flip-flop chips and discuss static data types. Maybe you'll talk about fixed with data busses that implement this or that encoding, but that's about it.
One could argue that a specialized floating point processor has a data type. That's one way to interpret it. Another way is to say that it has a, say, 64 bit architecture that, by convention, is interpreted in order to be able to represent floating point numbers within certain constraints. If by that we mean "static data type" then, well, I suppose I can go with that.
- thesz 13y agoTake, for example, Avalon streaming interfaces: http://www.altera.com/literature/manual/mnl_avalon_spec.pdf http://www.altera.com/literature/manual/mnl_avalon_spec.pdf Yes, it is a bunch of flip-flops and gates, but in the end the interface with "empty" signal is different from interface without it. The same is for error signal. To connect those sinks and sources properly you have to match types. E.g., you have to deal with the absence of "empty" on one end. Otherwise you will surely make some obvious mistake. And, finally, Avalon streaming interface is a tuple: type ASI a = (SOP, EOP, a) data SOP = NoSOP | SOP -- SOP and EOP equivalent to boolean data EOP = NoEOP | EOP And parameter "a" can be anything - raw value without empty or error, tuple of value and empty, tuple of value and error, triple of value, empty and error. They all are different. Even if their connection is no-op, like inventing "always good" value for error field, this no-op should be specified. Otherwise, you make discovery of the error very distant.