B
Bernd Paysan
Guest
Brian Drummond wrote:
end up as process of their own. It is possible to get around that by using
a wire array, though, so
always @*
begin
bus_data = 0;
if(bus_enable)
case(bus_addr)
0: bus_data = xxx;
1: bus_data = yyy;
....
15: bus_data = zzz;
esac
end
converts to
wire [x:0] bus_data_array [0:15];
assign bus_data_array[0] = xxx;
assign bus_data_array[1] = yyy;
....
assign bus_data_array[15] = zzz;
assign bus_data = bus_enable ? bus_data_array[bus_addr] : 0;
but this has a severe simulation disadvantage (the simulator has to
recalculate all bus_data_array elements when the dependencies change, even
when the bus is not used at all).
--
Bernd Paysan
"If you want it done right, you have to do it yourself!"
http://www.jwdt.com/~paysan/
In my code, multiplexers (e.g. a number of registers driving the same bus)Where there are combinatorial outputs to be described, I agree, I'll
describe them outside the main process.
But I can't remember the last time I had one so complex it needed a
process of its own.
end up as process of their own. It is possible to get around that by using
a wire array, though, so
always @*
begin
bus_data = 0;
if(bus_enable)
case(bus_addr)
0: bus_data = xxx;
1: bus_data = yyy;
....
15: bus_data = zzz;
esac
end
converts to
wire [x:0] bus_data_array [0:15];
assign bus_data_array[0] = xxx;
assign bus_data_array[1] = yyy;
....
assign bus_data_array[15] = zzz;
assign bus_data = bus_enable ? bus_data_array[bus_addr] : 0;
but this has a severe simulation disadvantage (the simulator has to
recalculate all bus_data_array elements when the dependencies change, even
when the bus is not used at all).
--
Bernd Paysan
"If you want it done right, you have to do it yourself!"
http://www.jwdt.com/~paysan/