Search Engine www.edaboard.com

Verilog Signed

Add Question

1000 Threads found on edaboard.com: Verilog Signed
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
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 [
Did you ever consider using the the verilog signed type?
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 (...)
He's asking about the Xilinx FPGA block that multiplies two signed (two's compliment) 18-bit integers giving a signed 36-bit product. Here's a verilog example that I created for a question regarding Spartan 3 multiplier speed:
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..
hi, Can someone suggest me a verilog code for fixed point signed multiplication using 8 bits pl.
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
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 unsigned 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 (...)
Hi there, Recently I was trying to write a verilog Code for Multiplication by 3. Condition-My Input is variable-Unsigned 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 (...)
Is $signed() /$unsigned() synthesizable in verilog?
Hi, How can I convert integer type to signed bit vector in verilog? Thanks
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.
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[
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
What compiler you use? Using verilog 2001 compatibility?
twocmplement and mul_unsigned don't exist in the verilog language. Why don't you simply let the compiler do the hard work for you? (assumes verilog 2001) reg signed a=123, b=-77; wire signed y = a * b; Gives result -9471
how to represent negative numbers without using two's compliment method in verilog? Obscure sneaky solution: use a real number! The IEEE 754 floating point format contains a sign bit, a positive exponent field (with implied bias), and a positive fraction field. It has no two's compliment parts.
Dear Sir, This example describes an 8-bit signed multiplier with registered I/O in verilog HDL. Synthesis tools detect multiplier designs in HDL code and infer lpm_mult megafunction. I hope it is useful for you. Best Regards
I need some solutions for signed floating point number processing by using VHDL or verilog like add, sub, and multiply. Is there anybody who can help me. Thank in advance
What software tools and language are you using? When compiling VHDL or verilog with XST, you can simply use the "*" multiply operator and signed operands. Refer to the "Arithmetic Operations" section in the XST User Guide. XST will automatically infer the multiplier. This makes your HDL easier to read and more portable than explicitly instantiat
Hi all, I am new to verilog and want to build a 2's Complement Shifter. I found %displayb(8'b0001_1000>>2); //Output 0000_0110 %displayb(8'b1001_1000>>2); //Output 0010_0110 So, ">>" is unsigned shift. How can I build a signed (2's Complement) shift based on >>? i.e. I want 8'b1001_1000>>2 //Output 1110_0110 Any suggestions (...)
im doing a project in which i need to add two signed numbers. how can i check for underflow and overflow? module stimulus; reg signed a,b; wire signed c; signed_adder my_adder(a,b,c); initial begin $monitor($time, " a = %d, b = %d, c = %d", a, b, c); end initial begin a = 127; b = 127; end (...)
Hi, I am wondering, how does a 8-bit signed adder work. there are 3 inputs a, b, cin and 2 outputs sum, cout normally for unsigned operation, the msb is sent to cout, but for signed operation, should the msb be sent to cout? how do we know which is carry bit? how do we propagate the sign (+ or -) to the next (...)
Hi all, I heard that verilog has integer type. Someone said integer can be signed or unsigned. How to declare signed integer? And what's the difference with integer and reg signed (2's complement) ? Any suggestions will be appreciated! Best regards, Davy
Hi, In fixed-point multiplication, we should add an extended sign bit in the multiplication process . Example below: 1.110 -0.25 B X 0.110 0.75 C ------------------------- 0000 111110 11110 0000 ----------------------------- 11110100 -0.1875 A I have try to do a ve
Hi, I am currently doing multiplication with 2 different value of Q which is from ROM. Below is an example of code of top module : top (....) .. .. assign tmpMult_1 = $signed(A) * $signed(Q); // Q=0.7071 assign tmpMult2_1 = tmpMult_1 - ($signed(B) * $signed(Q)); // Q= -0.7071 .. .. endmodule I (...)
while using the fwrite in verilog....... as mentioned below.... $fwrite(file,"a=%d @=%d",a,addr); if the value of a is negative i am getting the data in the file as.........for eg....-1 as 65535 but i need to print it as -1 in the file do any one know other format of writting the data so i colud write negative values as
when i refered to verilog book, i can generate only signed random no. is there any possibilty to generate unsigned random no in verilog. Not really true: reg unsigned a_reg; initial a_reg = $random; Should get you that. It might be true that the $random generates signed (...)
hi can anyone upload a software for implementing verilog code...
Hi all, I am reading "Coding Guidelines for Datapath Synthesis" from Synopsys. And confused with the example below, why split unsigned and signed + and *? //=====Unintended behavior====== input signed a; input signed b; output z; // product width is 8 bits (not 12!) assign z = (...)
I would like to design a first order IIR high filter with equeation y = x - x + a * y I wrote the following verilog code, but the result is not correct . Can any one tell me why? input wire signed Xn, output reg signed Yn, parameter a = 0.9; reg signed Xn-1; wire signed diff = Xn-Xn-1; a
Hi, In my opinion, I would say task n function is something like "assign" and "always" in verilog. Why? For example, we can model combinational circuit using both statement (assign or always). But why we still need assign then. I think it is still the same reason why we still have "function". As for me, the rule of thumb is I always u
Hi... I have been trying to a verilog code for 8 bit signed adder... To add the negative number we complement it and add it with the positive number with a carry in as '1'. However when we get the carry out of the above process as zeros then we have to compute the two's complement of the result. For this we have to complement the result and a
hi all, is it possible to use the "+" in verilog language and expect the compiler to make the logic for an adder. e.g input a; input b; output c; assign c = a + b; is code like this synthesizable or would i actually have to look at making an adder from logic gates etc. thanks
First: Your example of a VHDL integer in the following statement has only a 8 bit integer. Max_Time : in integer range 0 to 255 I dont quite understand what to you mean 'extend'. Extend beyond 32 bits? Then take a reg/wire type and have as many bits as you like in it. And in verilog you can use the reg type vectors just as you w
Is there any way that i can found out the minimum of N-Numbers with minimum effort using verilog or VHDL
verilog simulators provides a few format for data export, such as %b, %d (for decimal). However, in case the vector is a signed number, how we let simulator export utility aware of it and process it correctly? Added after 32 minutes: also, how to fdiaplay the vector representing a real value. How to
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
it is used for signed shifting in verilog 2001
Yes. And you can't use a for loop because verilog requires constant indexes in for loops.
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
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
Hi, The link( VHDL to verilog (verilog to VHDL) Code Conversion Translation Tools & Tips) may help you find more info on VHDL to verilog (verilog to VHDL) Code Conversion Translation Tools.
I want to write a verilog model of a pipelined circuit which its output is y = max{xi, 1signed 2?s-complement integers. plz help. thnx
y is not a constant. But I am very new ın verilog and I don't know could you help me?
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
assign statement in verilog is equivalent to writing the same thing in architecture body enclosed by begin and end.(however ,the word assign is to be removed ) and for instantiation use portmap.... this solves ur problem
First question, do you know the meaning of the concatenation operator {x,y,z} in verilog? It's simply assembling single bits or bit vectors to a result bit vector. sum5 is adding the original D2 vector and a right shifted D2 value. The right shift is performed by omitting one LSB and adding the MSB for sign extension. Assuming D2 is a signed ent
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 designed by yourself. A signed digit representation obviously requires a ternary bit type. You should tell your (...)