( ESNUG 322 Item 6 ) ---------------------------------------------- [6/15/99]
Subject: Log, Square Roots, & Other Advanced Mathematics In Verilog Sims
> I would like some mathematical functions within a verilog simulation.
> For example, my verilog model has data values in a linear scale. I would
> like to display those values at various times throughout the simulation in
> a logarithmic scale. Ideally, something like this:
>
> always @(eventWhatever)
> $display(" The log of %d is %d", x, log(x) );
>
> The verilog simulator I am using is Cadence Verilog-XL. Is there a set
> of verilog extensions out there somewhere which I can use to do this type
> of thing? Square Root would be nice also ...
>
> - Jeff Streznetcky
> Lockheed Martin Federal Systems
From: andi_carmon@my-deja.com
Jeff,
You need a PLI function to solve your mathematical functions. All the
mathematical functions, including those you mention are gathered in one of
the ready-to-run examples in http://www.angelfire.com/ca/verilog
- Andi Carmon
|
|