Re: BTF - B13 - Indexed part selects proposal

From: Adam Krolnik (adamk@cyrix.com)
Date: Wed Jul 22 1998 - 04:37:37 PDT


Karen writes:

>Adam, do we also need language that describes the behavior when the part
>select is out of range? Looking at the language, I'd guess it behaves as
>a number of individual statements, but we probably need to make that explicit.

And

>Peter would prefer the following performance:

>If any of the expressions evaluate to an undefined value or if
>the result is out of range or partially out of range, the
>behavior is not specified, but shall not include anything but
>the following:
> a) for RHS usage: return arbitrary values, constants, or
>
> portions of the vector;
> for LHS usage: set any, all, or no bits of the vector
> b) produce error or warning messages
>Note that doing nothing is also permitted.

>I'd prefer some explicit behavior be specified.

Assuming the LRM section 4.2.1 last sentence of third paragraph,
"If the part-select is out of the address bounds or the part-select is x or z,
then the value returned by the reference shall be x."

is not sufficient, I guess I would say,

"If the part-select is out of the address bounds completely, or partially, or the
part-select is x or z, then the value returned shall be x. If the part-select is
being assigned a value, only addressable bits in the defined range shall be modified."

<p>Alec Stanculescu writes:

>You should add:

>provided that there are no function calls in the expression.

Presumable you meant,
"Any common subexpression in a part select will be evaluated once to determine
the bits to be selected provided that there are no function calls in the expression."

The answer is no!

This example is has a function with a side effect - which does not affect
the part select.

reg [31:0] areg;
integer i;

begin
i = 2;
if (areg[f(i)+7:f(i)] == 8'b0) // This means, areg[31:24], not areg[31:32]
  ...
end

function [31:0] f;
  input [31:0] i;
  reg [31:0] a;
  begin
  if (a === 32'bx) a = 0;
  a = a + 1;
  f = 8*(i+a);
  end
endfunction



This archive was generated by hypermail 2.1.4 : Mon Jul 08 2002 - 12:52:58 PDT and
sponsored by Boyd Technology, Inc.