Hi,
I'm working on an implementation written in Go instead of HDL. That is, I defined nand() as
func nand(x, y bool) bool {
return !(x && y)
}
and proceeded to define the rest of the functions from there. However I'm now trying to implement the ALU - specifically, conditionally zeroing a function. I think I want something like this
func ALU(a, b [16]bool, zx, nx, zy, ny, f, no bool) ([16]bool, bool, bool) {
a = mux(zx, a, zero(a))
...
}
Where a is zeroed if zx is 1. However the semantics of Go mean that zero(a) will be evaluated before mux is called, zeroing the array whether zx is true or not...
Has anyone tried to implement the logic here in a higher level language? How should I structure the code to work around this problem? I suppose I could pass a function or use an if statement, but that doesn't seem true to the HDL implementation...