Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

some verilog operations ??

Status
Not open for further replies.

isra2

Newbie level 4
Joined
Apr 24, 2010
Messages
6
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Location
palestine
Activity points
1,314
the first Q is how can I differ arithematic shift and the logical shift..

and the 2nd one is how can I differ add from addi, and sub from subi ?

thanks in advance
 

This is explained better with an example:

Logical shift: Shift Right number 1010 several times:

1) 0101
2) 0010
3) 0001
4) 0000

MSB is always filled with zero.

Arithmetic Shift: Shift Right number 1010 several times:

1) 1101
2) 1110
3) 1111
4) 1111

MSB is always filled with the previous MSB value.

Another example of arithmetic shift

Shift Right number 0111 several times:

1) 0011
2) 0001
3) 0000
4) 0000

Arithmetic is very usefull when dealing with negative numbers represented in 2's complement. It allows to divide numbers by powers of two, both positive and negative, using shifts.

If you shifted right a negative number using logical shift, then the sign bit would change to zero thus making the number positive, which is wrong.

About Add and AddI:

Add = adds contents of two registers and stores result in one of them

AddI (add Imediate) = Adds content of one register and one constant, and stores result in the register.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top