O
Olaf Petzold
Guest
Hi,
I've try to synthesize the following code in a package:
type bitwidth_t is ( -- config fields = 3
BIT_WIDTH_8,
BIT_WIDTH_16,
BIT_WIDTH_24,
BIT_WIDTH_32,
BIT_WIDTH_40,
BIT_WIDTH_48,
BIT_WIDTH_56,
BIT_WIDTH_64
);
type num_sram_t is ( -- config fields = 2
SRAM_N0, -- internal used (FPGA)
SRAM_N1, -- external sram = 1
SRAM_N2, -- external sram = 2
SRAM_N3 -- external sram = 3
);
subtype pcb_ver_t is std_logic_vector(2 downto 0);
type my_info_t is
record
bit_width : bitwidth_t; -- fields=3
num_of_sram : num_sram_t; -- fields=2
pcb_ver : pcb_ver_t; -- fields=3
end record;
constant MY_CONF_FIELD_WIDTH : positive := (bitwidth_t'high +
num_sram_t'high + pcb_ver_t'high); -- Line 51
and got the error:
Line 51. + can not have such operands in this context.
writing:
constant MY_CONF_FIELD_WIDTH : positive
:= unsigned(bitwidth_t'high) + unsigned(num_sram_t'high)
+ unsigned(pcb_ver_t'high);
doesn't solve it:
Line 51. The expression can not be converted to type unsigned.
Similar types (integer etc.) got the same results. How can I add these?
Thanks and Regards,
Olaf
I've try to synthesize the following code in a package:
type bitwidth_t is ( -- config fields = 3
BIT_WIDTH_8,
BIT_WIDTH_16,
BIT_WIDTH_24,
BIT_WIDTH_32,
BIT_WIDTH_40,
BIT_WIDTH_48,
BIT_WIDTH_56,
BIT_WIDTH_64
);
type num_sram_t is ( -- config fields = 2
SRAM_N0, -- internal used (FPGA)
SRAM_N1, -- external sram = 1
SRAM_N2, -- external sram = 2
SRAM_N3 -- external sram = 3
);
subtype pcb_ver_t is std_logic_vector(2 downto 0);
type my_info_t is
record
bit_width : bitwidth_t; -- fields=3
num_of_sram : num_sram_t; -- fields=2
pcb_ver : pcb_ver_t; -- fields=3
end record;
constant MY_CONF_FIELD_WIDTH : positive := (bitwidth_t'high +
num_sram_t'high + pcb_ver_t'high); -- Line 51
and got the error:
Line 51. + can not have such operands in this context.
writing:
constant MY_CONF_FIELD_WIDTH : positive
:= unsigned(bitwidth_t'high) + unsigned(num_sram_t'high)
+ unsigned(pcb_ver_t'high);
doesn't solve it:
Line 51. The expression can not be converted to type unsigned.
Similar types (integer etc.) got the same results. How can I add these?
Thanks and Regards,
Olaf