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.
You can refer to following sample chapter from "Digital Design Principles and Practices "
by John F. Wakerly www.ddpp.com/DDPP3_mkt/c06samp1.pdf
You try to describe it in verilog. If you face in difficulty let us know!
We will do it for you!! But its better you try first writing the code!
Hope this helps!
use case to synthesize a multipler. But it seems transistor array cannot be synthesized unless you use self-designed cells or plot the schematic and design it using analog method.
hi
simple code for barrel shifter is given in VHDL primer J. Bhaskar book but it is in VHDL . I think its logic can easily be converted to Verilog code
//////////////
module Barrel_shifter_main(A,C0,C1,C2,C3,Q);
input [7:0]A;
input C0,C1,C2,C3;
output [7:0]Q;
reg [2:0]S;
always @ (C0 or C1 or C2 or C3)
if(C0) S=3'b001;
else if(C1) S=3'b011;
else if(C2) S=3'b101;
else if(C3) S=3'b111;
else S=3'b000;
barrel_shifter shfter(A,S,Q);
end module
//
The code for the 4x1 MUX used in the Shifter;
module mux(y,d0,d1,d2,d3,s);
input d3,d2,d1,d0;
input [1:0]s;
output y;
reg y;
always @ (d0 or d1 or d2 or d3 or s)
case (s)
2'b00:y=d0;
2'b01:y=d1;
2'b10:y=d2;
2'b11:y=d3;
endcase
end module
//
module mux8x1(y,d0,d1,d2,d3,d4,d5,d6,d7,s);
input d0,d1,d2,d3,d4,d5,d6,d7;
input [2:0] s;
output y;
reg y;
always @(d0 or d1 or d2 or d3 or d4 or d5 or d6 or d7 or s)
case (s)
3'b000:y=d0;
3'b001:y=d1;
3'b010:y=d2;
3'b011:y=d3;
3'b100:y=d4;
3'b101:y=d5;
3'b110:y=d6;
3'b111:y=d7;
endcase
end module
If you are using a Xilinx chip, take a look at this application note from Xilinx :
Implementing Barrel Shifters Using Multipliers ( available @ **broken link removed** )
It explains how touse embedded multipliers to design an efficient 32 bit barrel shifter, a sample application in VHDL and verilog is available @ **broken link removed** .
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.