I've been programming in more functional-style languages and have gotten to appreciate things like tuples, and higher-order functions such as maps, and folds/aggregates. Do either VHDL or Verilog have any of these kinds of constructs?
It seems like an HDL would be the perfect application of these kinds of pure combinators—while these combinators are merely simulated by an imperative process in Haskell, F#, LINQ, etc., hardware actually is pure functionality between clock ticks.
An initial glance, both languages look oddly imperative. To me it seems so weird that imperative CPU applications are starting to be written in functional languages, while functional HDL code is written in an imperative-looking style.
Anyway, the question is, is there any way to do even simple things like
divByThreeCount = count (\x -> x `mod` 3 == 0) myArray
or
myArray2 = map (\x -> x `mod` 3) myArray
or even better yet let me define my own higher-level constructs recursively, in either of these languages? If not, which language is the closest?
Does either language seem to be planning on making progress in that direction? Or is this really not as useful as I, being a rookie in HDLs, would think?
Module
, and then you could easily define a module parameterized by whatever type you like. – Tanner Swett