R
rickman
Guest
Moved from "stumped on syntax yet again!"
On May 10, 11:56 am, Mike Treseler <mtrese...@gmail.com> wrote:
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
On May 10, 11:56 am, Mike Treseler <mtrese...@gmail.com> wrote:
One of the bad things of being a "jack of all trades" is that I tendMike Treseler wrote:
rickman wrote:
function sllint (x, sh : natural) return natural is
begin
return x*(2**sh);
end sllint;
I am not clear on what happens when I shift the value of Addr left by
2 and significant bits extend beyond the defined range.
The function, as written, will return x*(2**sh)
up to the natural range. It knows nothing about
any other range unless you add a parameter
to to function.
I would use numeric_std.unsigned and the shift_left
function, and to_integer(my_uns, my_len) as needed.
function, and to_integer(my_uns) as needed.
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