Timothy Normand Miller wrote:
> I'm trying to design an area-minimal circuit that computes the minimum of 8
> values. This is the smallest I've come up with so far. Any suggestions on
> making it smaller?
Ok, it's the weekend, and I had time to play around.
The inputs have the form of an 8 x W grid, and we always need at least one
signal in each direction: between input words to compare them with each other,
and from MSB to LSB of each input word to search for the differences when
higher bits are equal. The key to minimize the circuit is to combine the
computation of the output with one of those signals (the first one, since it'
the one with the correct width).
Note: To simplify the code for me, I made the output as wide as the inputs.
Cutting it off again shouldn't change much.
module min8(a, b, c, d, e, f, g, h, out);
parameter W = 12+3;
input [W-1:0] a, b, c, d, e, f, g, h;
output reg[W-1:0] out;
integer i;
reg [0:7] off, v; // off is ~sel
always @(a, b, c, d, e, f, g, h) begin
off = 0;
for (i=W-1; i>=0; i=i-1) begin
v = off | {a[i], b[i], c[i], d[i], e[i], f[i], g[i], h[i]};
out[i] = &v;
if (out[i] == 0) off = v;
end
end
endmodule
--
Viktor Pracht
_______________________________________________
Open-graphics mailing list
[email protected]
http://lists.duskglow.com/mailman/listinfo/open-graphics
List service provided by Duskglow Consulting, LLC (www.duskglow.com)