N
nivparsons
I have a package that declares an array of STD_LOGIC, so I can use a
generic to declare the port width and internal signal width(s).
However, this is used on a 32 bit processor bus with separate byte
enables.
So, how can assign writes (& reads) to signals on a byte by byte
allocation when the width is generic?
I thought of something like: (ignoring write & read strobes etc).
IF byte_en_0 THEN
IF generic > 7 THEN
my_signal(7:0) <= cpu_bus(7:0);
ELSE
my_signal(generic - 1:0) <= cpu_bus(generic-1 :0);
END IF;
IF byte_en_1 THEN
IF generic > 15 THEN
my_signal(15:8) <= cpu_bus(15:8);
ELSIF generic > 8 THEN
my_signal(generic - 1:8) <= cpu_bus(generic-1 :8);
ELSE
NULL;
END IF;
-- and similarly for byte_enable 2 & 3.
I believe the above works, but seems very messy, is there a neater way
please?
generic to declare the port width and internal signal width(s).
However, this is used on a 32 bit processor bus with separate byte
enables.
So, how can assign writes (& reads) to signals on a byte by byte
allocation when the width is generic?
I thought of something like: (ignoring write & read strobes etc).
IF byte_en_0 THEN
IF generic > 7 THEN
my_signal(7:0) <= cpu_bus(7:0);
ELSE
my_signal(generic - 1:0) <= cpu_bus(generic-1 :0);
END IF;
IF byte_en_1 THEN
IF generic > 15 THEN
my_signal(15:8) <= cpu_bus(15:8);
ELSIF generic > 8 THEN
my_signal(generic - 1:8) <= cpu_bus(generic-1 :8);
ELSE
NULL;
END IF;
-- and similarly for byte_enable 2 & 3.
I believe the above works, but seems very messy, is there a neater way
please?