"For" loop node assignments 
Author Message
 "For" loop node assignments

I'm using Cadence veriloga and can't seem to assign an array of node
voltages using a variable as the array designator. For example, A[i]=5,
where A is a node array (bus) and "i" is a variable integer used in a
for loop.

The following message arrives when I try using the A[i] syntax:
Error: node arrays need a constant or the generate index as their
deference index.

Any thoughts would be appreciated. I don't really have time to go buy a
book and this seems like a simple exercise.

- William



Fri, 30 Aug 2002 03:00:00 GMT  
 "For" loop node assignments

Quote:

> --------------84A3612C50AACA5DEFB6FBB9
> Content-Type: text/plain; charset=us-ascii
> Content-Transfer-Encoding: 7bit

> I'm using Cadence veriloga and can't seem to assign an array of node
> voltages using a variable as the array designator. For example,
A[i]=5,
> where A is a node array (bus) and "i" is a variable integer used in a
> for loop.

> The following message arrives when I try using the A[i] syntax:
> Error: node arrays need a constant or the generate index as their
> deference index.

> Any thoughts would be appreciated. I don't really have time to go buy
a
> book and this seems like a simple exercise.

> - William

> --------------84A3612C50AACA5DEFB6FBB9
> Content-Type: text/html; charset=us-ascii
> Content-Transfer-Encoding: 7bit

> <!doctype html public "-//w3c//dtd html 4.0 transitional//en">
> <html>
> I'm using Cadence veriloga and can't seem to assign an array of node
voltages
> using a variable as the array designator. For example, A[i]=5, where A
> is a node array (bus) and "i" is a variable integer used in a for
loop.
> <p>The following message arrives when I try using the A[i] syntax:
> <br><b>Error: node arrays need a constant or the generate index as
their
> deference index.</b>
> <p>Any thoughts would be appreciated. I don't really have time to go
buy
> a book and this seems like a simple exercise.
> <p>- William</html>

> --------------84A3612C50AACA5DEFB6FBB9--

I assume you are trying to write to a two-dimention array and the
follwing is an example where you have depth of 10 cell and each cell can
have value up to 1023.

Just as an example I wrote to those 10 cell the value of 200+the cell
number

reg [9:0] mem [9:0];
integer i;

initial
begin
for (i=0;i<=9;i=i+1)
   mem[i] = i+200 ;
end

have a nice day

   Illan

Sent via Deja.com http://www.deja.com/
Before you buy.



Sun, 01 Sep 2002 03:00:00 GMT  
 "For" loop node assignments

Quote:
> I assume you are trying to write to a two-dimention array and the
> follwing is an example where you have depth of 10 cell and each cell can
> have value up to 1023.

> Just as an example I wrote to those 10 cell the value of 200+the cell
> number

> reg [9:0] mem [9:0];
> integer i;

> initial
> begin
> for (i=0;i<=9;i=i+1)
>    mem[i] = i+200 ;
> end

Actually, I get the impression that the original poster was running
into this problem :

reg [31:0] temp;
integer i;


begin
  for ( i =0; i < 29; i = i + 2 )
    begin
      temp[ (i+1) : (i) ] <= temp[ (i+3) : (i+2) ];
    end
end

Verilog-XL complains because the bit-selectors for the
reg temp[] are non-constants ( i, i+1, i+2 )

In the above case, the obvious solution is to
substitute a bitwise-shift (>>) operation.  But I'm guessing
some logical operations are more easily expressed bit-by-bit
(using variables within the bit-selection.)



Sat, 02 Nov 2002 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. variable assignment in "while" loop

2. string.join(["Tk 4.2p2", "Python 1.4", "Win32", "free"], "for")

3. "Square" function in formula node

4. "definition" rather than assignment (lazy evaluation)

5. "multiple assignment in conditional"

6. popup window with "anchor" node

7. Transform Node's "center" field

8. Script node: parse error: line 6 "}"

9. "Blocking and non-blocking" assignments

10. question about signal assignment in "case"

11. "help"=cheating on assignment

12. Breaking out of a "loop"

 

 
Powered by phpBB® Forum Software