Article View: comp.lang.verilog
Article #80Re: Variable width assignments?
From: Cindy Eisner
Date: Sun, 27 Sep 1992 06:23
Date: Sun, 27 Sep 1992 06:23
35 lines
1762 bytes
1762 bytes
In article <rfall-240992171955@andrich.mv.us.adobe.com>, rfall@mv.us.adobe.com (Richard Fall) writes:
> Does anyone know if there's an easy way of doing the following
> in Verilog?
>
> I would like to be able assign a fixed value (say, zero),
> declared as a single parameter ("zero") in assignment
> statements where the variable on the LHS of the statements
> may be of different bit width.
>
> ...
>
> Before you rush to tell me that Verilog already does that
> by zero-extending the RHS side to fit the LHS side, I'll point
> out that I may want to do the same thing with a parameter in
> which zero-extending is not the correct behavior. For
> example, I may want the value "5555...." to be assigned to
> registers that may be any multiple of 4 bits wide.
>
besides doing zero-extension, verilog also does automatic truncation.
thus you can define:
parameter fives = 64'h5555555555555555;
and then assign it to a lhs of any width <= 64. the extra bits will simply
be discarded.
--
Cindy Eisner, Tel: 972-4-551551
CAD group, Fax: 972-4-551550
Zoran Microelectronics LTD, E-mail: cindy@Zoran.HellNet.Org
Advanced Technology Center
Haifa 31204, Israel Could be my employer doesn't agree.
Technical Details
Message-ID:
<154@ca41.zoran.hellnet.org>Path:
arc1-ca.pugleaf.net!sparky!uunet!imp!ca41!cindyReferences:
<rfall-240992171955@andrich.mv.us.adobe.com>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!imp!ca41!cindy From: cindy@zoran.hellnet.org (Cindy Eisner) Newsgroups: comp.lang.verilog Subject: Re: Variable width assignments? Message-ID: <154@ca41.zoran.hellnet.org> Date: 27 Sep 92 06:23:59 GMT References: <rfall-240992171955@andrich.mv.us.adobe.com> Sender: news@ca41.zoran.hellnet.org Organization: Zoran Microelectronics LTD. Haifa, Israel. Lines: 35 Nntp-Posting-Host: ca45