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.

Is this a code for left shifting ???

Status
Not open for further replies.

sree205

Advanced Member level 1
Joined
Mar 13, 2006
Messages
453
Helped
58
Reputation
116
Reaction score
25
Trophy points
1,308
Activity points
4,420
left shifting

Hi,
is this code the same as shifting to the left ?

reg [7:0] a;

always@(posedge clk)
a <= {a[6:0],1'b0};
 

left shifting

yes, the fuction is the same,
but the synthesis result maybe different.
 

Re: left shifting

sree205 said:
Hi,
is this code the same as shifting to the left ?

reg [7:0] a;

always@(posedge clk)
a <= {a[6:0],1'b0};

This code also shift left:

always @(posedge clk)
a <= a << 1;

Which code is more commonly used? and, why?
 

left shifting

a <= a << 1; is more common:

it's more readable & intuitive. i believe the DC can generate a better circuit by this syntax.

Added after 3 minutes:

in other programing langauge, such as VB & C, concatenation operation will cause memory & runtime penalty.

I guess it will cause the same effect on the simulation runtime & synthesis runtime as well
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top