Hi guys,
I've been trying to implement a simple configuration memory kind of module - basically you'd have N registers (8 in this case), you'd select them by the appropriate RWAddress and if you wished to write in the selected one you would assert RegisterWriteDataValid. The register array should be the output as well, in order to directly be able to connect the things that are to be configured by the registers.
I know that this could be done by means of a bunch of case statements, but I was hoping for something more elegant and easier to expand. The code below does not compile, giving the errors even further down.
Is there any simple way of doing this, or will I have to use case?
module ConfigurationRegisterManager(
input Clock, //Main input clock
input NReset, //Global negative reset
input [2:0] RWAddress, //7 = 1write, 0 read, 6:0 = address
input [15:0] NewValue,
output [15:0] Registers[0:3],
input RegisterWriteDataValid
);
reg [15:0] RegisterCurrentValue = 0;
reg [15:0] rRegisters[0:3];
assign Registers = rRegisters;
always @(posedge Clock) begin
if(RegisterWriteDataValid == 1) begin
RegisterCurrentValue[15:0] <= rRegisters[15:0][RWAddress];
end
end
endmodule
[HDLCompiler 1335] Port Registers must not be declared to be an array ["xxxxConfigurationRegisterManager.v":9]
[HDLCompiler 255] Cannot assign to memory Registers directly ["xxxxConfigurationRegisterManager.v":16]
[HDLCompiler 251] Cannot access memory rRegisters directly ["xxxxConfigurationRegisterManager.v":16]
[HDLCompiler 747] Range is not allowed in a prefix ["xxxxConfigurationRegisterManager.v":19]
[HDLCompiler 252] Cannot assign an unpacked type to a packed type ["xxxxConfigurationRegisterManager.v":19]
[HDLCompiler 598] Module <ConfigurationRegisterManager> ignored due to previous errors. ["xxxx/ConfigurationRegisterManager.v":3]
Thanks,
David