R
rickman
Moved from "stumped on syntax yet again!"
One of the bad things of being a "jack of all trades" is that I tend
to forget a lot of details between jacking any given trade. I think
it has been at least two years since I have written any VHDL and I
have forgotten a lot of my style.
I get a bit tired of all the typing that is needed to do things in
VHDL and I thought that using integers might be a bit simpler than
using slv. So instead of typing...
DataWr <= DataWr(DataWr'high-Scfg_Din'width downto 0) &
AddrReg(AddrReg'high downto AddrReg'high-Scfg_Din'width);
I was thinking about
DataWr <= sllbar(DataWr, CTPDATAWDTH) + srlbar(AddrReg, AddrRegWidth-
CTPDATAWDTH);
where sllbar is a function that returns an unconstrained integer.
I guess the missing information the width of the data field which is
one of the things that makes the slv version so long. I assume that
if DataWr is a constrained integer, it would be an error in simulation
if the value of sllbar was outside the range of DataWr. How might
this synthesize? Or would it also be a synthesis error because of the
mismatch in range of DataWr and the sllbar result?
If I create a separate sllbar for each data width, sllnib, sllbyte,...
and used the mod operator to restrict the range of the result, that
should cure things, no?
I was hoping to use an overloaded operator so that each one would have
the same name and the correct one would be picked based on the subtype
of the operands. But I believe that this won't work. Is that
correct?
Rick
function, and to_integer(my_uns) as needed.
One of the bad things of being a "jack of all trades" is that I tend
to forget a lot of details between jacking any given trade. I think
it has been at least two years since I have written any VHDL and I
have forgotten a lot of my style.
I get a bit tired of all the typing that is needed to do things in
VHDL and I thought that using integers might be a bit simpler than
using slv. So instead of typing...
DataWr <= DataWr(DataWr'high-Scfg_Din'width downto 0) &
AddrReg(AddrReg'high downto AddrReg'high-Scfg_Din'width);
I was thinking about
DataWr <= sllbar(DataWr, CTPDATAWDTH) + srlbar(AddrReg, AddrRegWidth-
CTPDATAWDTH);
where sllbar is a function that returns an unconstrained integer.
I guess the missing information the width of the data field which is
one of the things that makes the slv version so long. I assume that
if DataWr is a constrained integer, it would be an error in simulation
if the value of sllbar was outside the range of DataWr. How might
this synthesize? Or would it also be a synthesis error because of the
mismatch in range of DataWr and the sllbar result?
If I create a separate sllbar for each data width, sllnib, sllbyte,...
and used the mod operator to restrict the range of the result, that
should cure things, no?
I was hoping to use an overloaded operator so that each one would have
the same name and the correct one would be picked based on the subtype
of the operands. But I believe that this won't work. Is that
correct?
Rick