Search Engine **www.edaboard.com**

74 Threads found on edaboard.com: **Verilog Signed**

HI,
I am new to system **verilog** and was trying to simulate the following simple program but am not able to understand how the output is beign generated:
module test ();
initial
begin
byte XYZ;
foreach(XYZ)
XYZ=i*100+j;
foreach (XYZ)
begin
$write("%d:",i);
f

PLD, SPLD, GAL, CPLD, FPGA Design :: 10-13-2014 16:36 :: maxxtorr723 :: Replies: **1** :: Views: **270**

Hi,
I'm trying to code a **signed** multiplier, and I used '**signed**' for the ports and wire, but when I run (ModelSim) simulation to check it, it doesn't work for me.
Below is the code and the simple testbench. The numbers are the most positive (0xFF) * most negative (0x2000). In simulation, I get 0x1FE000, which is not the correct answer. Any idea

PLD, SPLD, GAL, CPLD, FPGA Design :: 09-15-2014 18:16 :: oak_tree :: Replies: **6** :: Views: **404**

Then you need to read a book on VHDL (or **verilog**)...
c <= a*b;

PLD, SPLD, GAL, CPLD, FPGA Design :: 09-15-2014 12:41 :: ads-ee :: Replies: **2** :: Views: **333**

Hi,
I read the following about **verilog** expression:
Example 4-1
shows two ways to write the expression ?minus 12 divided by 3.? Note
that -12 and -d12 both evaluate to the same bit pattern, but in an
expression -d12 loses its identity as a **signed**, negative number.
108105
I do not know what [

PLD, SPLD, GAL, CPLD, FPGA Design :: 08-07-2014 19:29 :: ruwan2 :: Replies: **0** :: Views: **205**

You have to be very careful when using **signed** arithmetic in **verilog** and System **verilog**. Unless you really understand the way the language treats **signed** values, and especially the way it treats combinations of **signed** and un**signed** values, you can find many ways to hang yourself.
In your (...)

PLD, SPLD, GAL, CPLD, FPGA Design :: 07-10-2014 09:24 :: rberek :: Replies: **3** :: Views: **327**

I have written a **verilog** file that implements some arithmetic operations, I defined my signals as wire **signed** or reg **signed**. when I simulate that on isim simulator it does the operation as specified, with **signed** arithmetic. but when I simulate the same file in modelsim it behaves as if the signals are (...)

ASIC Design Methodologies and Tools (Digital) :: 05-23-2014 17:04 :: 3wais :: Replies: **1** :: Views: **239**

I have to multiply two fractional numbers of 42 bits in **verilog**. I am using the fixed point (Q12.30). Now my result is wrong.
part of my code:
module my_name (out,Clk);
input Clk;
output reg **signed** out; //(Q24.60)
reg **signed** in1; //(Q12.30)
reg **signed** in2; //(Q12.30)
alway

PLD, SPLD, GAL, CPLD, FPGA Design :: 12-23-2013 20:09 :: mohsen p :: Replies: **1** :: Views: **491**

Did you ever consider using the the **verilog** **signed** type?

PLD, SPLD, GAL, CPLD, FPGA Design :: 12-04-2013 12:36 :: FvM :: Replies: **5** :: Views: **532**

I have a hard time believing that. How did you come to that conclusion?
- - - Updated - - -
Also, you did notice the difference between a vector and a number, right?
I just gave you a single 8-bit **signed** number. No need to add the extra confusion of a vector of **signed** numbers if the problem of the day is "H

PLD, SPLD, GAL, CPLD, FPGA Design :: 07-07-2013 12:22 :: mrflibble :: Replies: **3** :: Views: **305**

Assuming the file in like :
.1
.12
.15
.2
.26
.3
and so on
write code like this
integer in,i,out;
real data;
initial begin
in = $fopen("input.txt,"rb");
out = $fopen("output","w");
if(!in) $display("File Open Error!");
if(!out) $display("File Open Error!");
i = $fscanf(in,"%f",data);
i

PLD, SPLD, GAL, CPLD, FPGA Design :: 05-23-2013 11:56 :: sherif123 :: Replies: **2** :: Views: **520**

Which file format do you refer to? Any HDL can represent negative numbers, in so far it's surely possible for binary files, if you interprete the data as **signed** numbers. VHDL textio package does support integer and real numbers, both can be negative. I presume, there's a similar option in **verilog**, but I didn't use it for testbenches yet.

PLD, SPLD, GAL, CPLD, FPGA Design :: 03-04-2013 10:49 :: FvM :: Replies: **4** :: Views: **582**

Hi I have de**signed** a 8-bit counter using **verilog**.
I simulated it using modelsim. counter is performing it's function correctly till the total event at the output reaches 127 (i.e after counting 127 clock cycles)
but after 127 I am getting a value of -128, then -127,126,-125 and so on for each additional clock cycle.
why it is going to -128, why

PLD, SPLD, GAL, CPLD, FPGA Design :: 01-30-2013 01:49 :: kpraneethin007 :: Replies: **2** :: Views: **456**

PLD, SPLD, GAL, CPLD, FPGA Design :: 01-20-2013 02:52 :: charantejvit :: Replies: **1** :: Views: **358**

i need a **verilog** code for 8bit **signed** carry look ahead adder.....
i dont know how to convert the following code... help me soon....:-(
module cla(sum,c_8,a,b,c0);
input a,b;
input c0;
outputsum;
output c_8;
wire p0,p1,p2,p3,p4,p5,p6,p7,g0,g1,g2,g3,g4,g5,g6,g7;
wire c1,c2,c3,c4,c5,c6,c7,c8;
assign p0=a^b,
p1=a^b[

Electronic Elementary Questions :: 12-16-2012 10:23 :: thir :: Replies: **0** :: Views: **2418**

i need to design a multiplier unit..
design idea: only binary inputs representation **signed** representation..can provide a sign bit input..
ie.. if we want to multiply 2 and -3.. input given should be 0010 and 0011(consider 4 bit numbers)..since sign of one of the number is negative..i can give a sign bit input as 1 here.. so i need a program

PLD, SPLD, GAL, CPLD, FPGA Design :: 12-04-2012 04:44 :: kannan1 :: Replies: **0** :: Views: **306**

Hi all,
I am learning **verilog** and this is a module used for read a character:
module file_read()
parameter EOF = -1;
integer file_handle,error,indx;
reg **signed** wide_char;
reg mem;
reg err_str;
initial begin
indx=0;
file_handle = $fopen(?text.txt?,?r?);
error = $ferror(file_handle,err_str);

ASIC Design Methodologies and Tools (Digital) :: 12-03-2012 09:30 :: anhnha :: Replies: **0** :: Views: **764**

Generally if I declare a variable as integer in **verilog**.. What hardware element the synthesis tool will take that variable.
Thanks in advance

PLD, SPLD, GAL, CPLD, FPGA Design :: 09-04-2012 00:35 :: rknmahesh :: Replies: **5** :: Views: **505**

Hi,
I'm new to **verilog** and have a question about **signed** multiplication. My program works for positive integers but fails for negative numbers.
Below is the code with test bench.
module multiplier(clk,X, h_0, h_1, h_2, h_3, h_4, Y);
input clk;
input X;
input h_0;
input h_1;
input h_2;
input h_3;
input [

PLD, SPLD, GAL, CPLD, FPGA Design :: 08-11-2012 20:38 :: mtantawy1 :: Replies: **4** :: Views: **822**

As far as I know, **verilog** 2001 has built-in support for this, just using **signed** nets and variables!
Cheers

ASIC Design Methodologies and Tools (Digital) :: 08-04-2012 07:40 :: kingslayer :: Replies: **2** :: Views: **442**

Pleas some one can explain me why in the below code, x0_eq is not equal to x1_eq?
`timescale 10ns/1ns
module test;
reg **signed** x0, x1, x0_shifted, x0_eq, x1_eq;
initial begin
x0 = -27;
x0_shifted = x0 >>> 3;
x0_eq = x0_shifted + x0;
x1 = -27;
x1_eq = (x1 >>> 3) + x1;
#10;
$finish;
end
endmodule

ASIC Design Methodologies and Tools (Digital) :: 06-06-2012 09:18 :: jmarcelold :: Replies: **2** :: Views: **570**

Dear all,
**verilog** 2001 have this functionality for **signed** reg(s) and wire(s).
They work as two's compliment hence are they also synthesizable and will work the same way in-circuit as they do in simulation.

PLD, SPLD, GAL, CPLD, FPGA Design :: 05-01-2012 09:08 :: syedshan :: Replies: **1** :: Views: **509**

hello amir,
In **verilog** 2001, you can now declare **signed** variable and it will automatically be 2's compliment **signed** variable.
wire **signed** inp1; //will take negative values as 2's compliment
reg **signed** inp2; //will take negative values as 2's compliment
assign inp1 = 10000000; // It means -128 (...)

PLD, SPLD, GAL, CPLD, FPGA Design :: 05-02-2012 07:51 :: syedshan :: Replies: **1** :: Views: **544**

check below pdf to work on **signed** and un**signed** in **verilog**.

ASIC Design Methodologies and Tools (Digital) :: 04-24-2012 07:20 :: shanmugaveld :: Replies: **21** :: Views: **2721**

Hi I am trying to do a synthesis of **verilog** code by using RTL compiler .. The code got correctly compiled in modelsim but is giving errors while rtl compilation .. I am using ..
parameter **signed** b0 = 8'b00000011 ;
.. lines in codes to supply constants.. The rtl synthesis is giving the error of b0 being an undeclared variable ! I tried to make

PLD, SPLD, GAL, CPLD, FPGA Design :: 04-19-2012 03:48 :: anishsingh :: Replies: **0** :: Views: **246**

Hi,
How can I convert integer type to **signed** bit vector in **verilog**?
Thanks

PLD, SPLD, GAL, CPLD, FPGA Design :: 04-17-2012 16:53 :: Alka Arora :: Replies: **0** :: Views: **554**

Hi ,
In VHDL we have a function to convert std_logic_vector to **signed** data we have anything like that in **verilog** to convert in to **signed** type in **verilog**.
for example i have wire diff;
I want to convert it into absolute value.
Thanks
Alka

PLD, SPLD, GAL, CPLD, FPGA Design :: 04-13-2012 18:51 :: Alka Arora :: Replies: **3** :: Views: **1252**

The usual number system to represent **signed** quantities in digital computing is two's complement. It's also the method provided by standard VHDL and **verilog** libraries. Other number representations have to be de**signed** by yourself. A **signed** digit representation obviously requires a ternary bit type.
You should tell your (...)

Electronic Elementary Questions :: 03-27-2012 06:35 :: FvM :: Replies: **2** :: Views: **502**

hello,
i need to implement fixed point **signed** addition of 16 bits at every clock edge for CORDIC algorithm. but the very first addition is overflowing, can anyone tell me how to correct overflow or the method to work with fixed point with overflow. i am using 1 sign bit, 1 integer bit, 14 fraction bits (Q2.14 format).

PLD, SPLD, GAL, CPLD, FPGA Design :: 06-13-2011 12:34 :: student13 :: Replies: **0** :: Views: **965**

Hi every one
iam looking for a piplined fixed point divider, a generic one that i can choose the size of the dividend and divisor , between 2-32 bits. I found a serial one in opencore, but having difficluty with a a piplined one.
If i generate a 32 bit divider using Xilinx coregenerator, will i be able to use it effectively with less than 32

PLD, SPLD, GAL, CPLD, FPGA Design :: 05-10-2011 13:59 :: Hallolo :: Replies: **1** :: Views: **694**

Is $**signed**() /$un**signed**() synthesizable in **verilog**?

ASIC Design Methodologies and Tools (Digital) :: 04-10-2011 17:03 :: gsdeshpande :: Replies: **4** :: Views: **2382**

I am not familiar with VHDL,from **verilog** view,in the "position",**signed** number would not be recognized.
And if you want to implement "abs" function ,here show you an example in **verilog**(16bit):
assign abs_num_diff = num_diff?
(~num_diff + 1'b1) : num_diff;

PLD, SPLD, GAL, CPLD, FPGA Design :: 02-25-2011 02:29 :: yadog :: Replies: **8** :: Views: **1144**

i have a problem to do one application about arithmetic logic calculator. I have to design, test and evaluate an arithmetic logic calculator that perform operation of addition and multiplication of two input number. the input number are 5-bit binary reprenting **signed** decimal number . the design should use **verilog** HDL and test in A

PLD, SPLD, GAL, CPLD, FPGA Design :: 02-19-2011 08:58 :: yard :: Replies: **4** :: Views: **2231**

Hi Digit0001,
I'm not so familiar with VHDL but in **verilog** I can use **signed** singals to do twos complement multiplication without checking the sign bit.
see example
module tb ();
reg **signed** mcand;
reg **signed** mplier;
wire **signed** result;
initial
begin
// -80 x (...)

PLD, SPLD, GAL, CPLD, FPGA Design :: 01-26-2011 01:09 :: qieda :: Replies: **5** :: Views: **3314**

y is not a constant. But I am very new ın **verilog** and I don't know could you help me?

PLD, SPLD, GAL, CPLD, FPGA Design :: 12-01-2010 02:48 :: damla61 :: Replies: **6** :: Views: **3718**

I want to write a **verilog** model of a pipelined circuit which its output is y = max{xi, 1*signed 2?s-complement integers.
plz help. thnx*

PLD, SPLD, GAL, CPLD, FPGA Design :: 11-10-2010 03:10 :: hokmabadi :: Replies: **0** :: Views: **394**

Hi there,
Recently I was trying to write a **verilog** Code for Multiplication by 3.
Condition-My Input is variable-Un**signed** or **signed**
My Multiplier is fixed-3
So if i have -20 as input in binary my output should by -60.
and 20 as input my output should be +60.
I want to declare only one output that is product and (...)

PLD, SPLD, GAL, CPLD, FPGA Design :: 11-05-2010 15:11 :: er.twi.fb :: Replies: **4** :: Views: **2301**

It should be noted, that **verilog** also has a **signed** data type. But in case of the add and sub operation, it doesn't change anything. The difference between un**signed** and two's complement **signed** is only in the interpretation of the result, the bitvector is the same. You may want to verify this by pencil and paper method.
In (...)

PLD, SPLD, GAL, CPLD, FPGA Design :: 08-02-2010 06:04 :: FvM :: Replies: **1** :: Views: **1474**

Hi All
In my code im using $readmemh to read hex values from a text file in which alot of the values are negative. **verilog** is treating them as positive and returning erroneous results. Can someone please help me deal with this problem? I really need to figure out a way to recognize these negative hex values.
Please help

PLD, SPLD, GAL, CPLD, FPGA Design :: 07-08-2010 14:14 :: UFK :: Replies: **2** :: Views: **1298**

Hi ,
I have 8 numbers like -398.1234 , -14.1898 etc and I have 8 signals generated in the design .
I need to compute
y = c1* x1 + c2 * x2 .... + c8 *x8 ,
where c1 , c2 etc are the constants and x1 , x2 are the signals to the block .
What is the best way to code this ?
since these are floating point numbers , shoul

PLD, SPLD, GAL, CPLD, FPGA Design :: 07-06-2010 04:35 :: yanzixuan :: Replies: **2** :: Views: **3831**

i synthesized my code (**verilog**) containing mainly additions and subtractions and am doing post synthesis simulation in modelsim
in modelsim wave i see,
instead to obtaining differences of two registers , i am now obtaining difference divide by 2
I am not able to figure out the problem.
i even tried re declaring wire resulted by subtraction

ASIC Design Methodologies and Tools (Digital) :: 05-21-2010 02:51 :: Aimerbhat :: Replies: **1** :: Views: **745**

hey
I am a student of B-tech . I am doing a project in which i have to use a parallel multiplier. I have to multiply two matrices of 8x8 size and each element is a 16 bit fractional number represented in binary format. I wrote a code in matlab and **verilog** both but when I matched the result of **verilog** with matlab, I found big difference between the

Digital Signal Processing :: 05-02-2010 10:52 :: magnanimus :: Replies: **4** :: Views: **8850**

Microcontrollers :: 03-13-2010 08:10 :: amraldo :: Replies: **9** :: Views: **1233**

it is used for **signed** shifting in **verilog** 2001

ASIC Design Methodologies and Tools (Digital) :: 03-09-2010 06:16 :: kalyansumankv :: Replies: **3** :: Views: **2141**

Hi, I am pretty new to **verilog** and was hoping someone could help me out.
I am having 2 problems, I am guessing both are related to poor logic.
1) In the example below I am getting warnings that "Warning (10235): **verilog** HDL Always Construct warning at xxx.v(15): variable "D2" is read inside the Always Construct but isn't in the Always Constr

PLD, SPLD, GAL, CPLD, FPGA Design :: 01-20-2010 23:46 :: chasef4 :: Replies: **3** :: Views: **1771**

Digital Signal Processing :: 01-05-2010 15:49 :: neoflash :: Replies: **1** :: Views: **1361**

hi,
Can someone suggest me a **verilog** code for fixed point **signed** multiplication using 8 bits pl.

PLD, SPLD, GAL, CPLD, FPGA Design :: 09-25-2009 02:06 :: aparnamit :: Replies: **0** :: Views: **1514**

hi..........
i need a **verilog** code 4 .......
4 a 16 multiplier of **signed** numbers by implementing the technique of correction vector(use only one 16bit carry look ahead adder)
plz help me out..

Professional Hardware and Electronics Design :: 07-11-2009 10:13 :: muneeb khan343 :: Replies: **0** :: Views: **1518**

Hi,
I have a brief question relating to some **verilog** for a sinc3 decimation filter.
In the code, I believe 2s complement is being used for the accumulation process, however, I cant quite understand what is going on. As I do not have a **verilog** simulator at the moment, I am hoping someone could explain it to me. The relative parts of the code

PLD, SPLD, GAL, CPLD, FPGA Design :: 06-06-2009 12:28 :: sammyt09 :: Replies: **6** :: Views: **6874**

Is there any way that i can found out the minimum of N-Numbers with minimum effort using **verilog** or VHDL

PLD, SPLD, GAL, CPLD, FPGA Design :: 11-13-2008 00:11 :: kalyansumankv :: Replies: **12** :: Views: **4480**

Xilinx XST supports several **verilog** system tasks during compile-time: $display $fclose $fdisplay $fgets $finish $fopen $fscanf $fwrite $readmemb $readmemh $**signed** $un**signed** $write. I use them in my **verilog** 'initial' blocks to create data files, and to input data files for initializing Block RAMs and other stuff. Yes, that (...)

PLD, SPLD, GAL, CPLD, FPGA Design :: 04-11-2008 22:53 :: echo47 :: Replies: **3** :: Views: **2842**

Last searching phrases:

spi function | memory testbench | simple frequency meter | veriloga and simulator | place route cadence | signal energy sampling | uwb cdma | common and centroid and layout | more pwm | gprs book

spi function | memory testbench | simple frequency meter | veriloga and simulator | place route cadence | signal energy sampling | uwb cdma | common and centroid and layout | more pwm | gprs book