🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.verilog
Article #104

Concantenation Problems

#104
From: Elliot H. Mednick
Date: Sat, 10 Oct 1992 15:03
27 lines
1588 bytes
In article <1992Oct9.185221.10612@tamsun.tamu.edu> kuttanna@eemips.tamu.edu writes:
 > I have been trying to model the shift right/left operations wherein I
 > shift a register by a variable amount (specified within the instruction).
 > [...]
 >  result = {{`SHAMT{op2[WIDTH-1]}},temp[WIDTH - `SHAMT - 1:0]};
 > 
 > I keep getting the following error message :
 > 
 > Error!    Non-constant part-select index                    [Verilog-NCPSI]
 >           "r2k.v", 560: temp[WIDTH - IR[10 : 6] - 1:0]
 > 
 > The manual says that you cannot concantenate with non-constant widths.

It not just that -- you can't have a variable part select _anywhere_.

Left shift:
result = op2 << `SHAMT;

Right shift with fill:
result = ({{`WIDTH {op2[`WIDTH - 1]}}, op2} >> `SHAMT);
//         ^^^^^^^^^^^^^^^^^^^^^^^^^ prepend lots of high bits before the shift

The is or may not Do The Right Thing in synthesis, but you get the idea.
--
Elliot H. Mednick                                        P.O. Box 150
Wellspring Solutions                                     Sutton, MA. 01590
elliot@Wellspring.com                                    +1 508 865 7271
Technical Details
Message-ID: <718729426snx@Wellspring.COM>
Path: arc1-ca.pugleaf.net!sparky!uunet!think.com!unixland!wellspring!elliot
References: <1992Oct9.185221.10612@tamsun.tamu.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!think.com!unixland!wellspring!elliot
From: elliot@Wellspring.COM (Elliot H. Mednick)
Newsgroups: comp.lang.verilog
Subject: Concantenation Problems
Distribution: world
Message-ID: <718729426snx@Wellspring.COM>
References: <1992Oct9.185221.10612@tamsun.tamu.edu>
Date: Sat, 10 Oct 92 15:03:46 GMT
Organization: Wellspring Solutions, Sutton, MA.
Reply-To: elliot@Wellspring.COM
Lines: 27