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.

shift questions (arithmetic and logic)

Status
Not open for further replies.

Wild Life

Member level 1
Joined
May 4, 2011
Messages
34
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Activity points
1,565
Hello everybody, I have a little question, I know the differences between sll/srl and sla/sra, I need to have a shift arithmetic but sla/sra is only for bitvector types, I have insteade a std_logic_vector type to shift
i also can't use simple concatenation with zeros because I have to shift by a variable (not a constant value)

I could use SHL/SHR operator, this would work but it seemes this operators are good choices for std_logic_vector logical shift, non arithmetic!

Are there ways to use SHL/SHR for having arithmetic shifts? Or, If it's not possible, are there other ways to have them?

Thanx a lot!
 

you should not be using std_logic_vector for arithmatic. You should be using the signed/unsigned types from the numeric_std library. sll/srl are defined for these types. sla/sra are covered by the resize() function.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top