Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronic 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.

Register Log in

Help Needed in Making a 2 bit ALU

Status
Not open for further replies.

shafin

Newbie level 2
Joined
Apr 8, 2006
Messages
2
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,300
I need to build a ALU with the following operations:

Transfer
Increment
Addition
Add with Carry
Subtraction
Subtract with borrow
Decrement
OR
XOR
AND
NOT

I've got the Design from the Morris Mano book.But I need to reduce the number of gates to as small as possible.The design in the book uses 28 gates,counting the initial NOT gates.I succeeded in reducing it to 22 gates,but i've heard it has been implemented with lower number of gates.
Can you Help me,please?

Thanks in Advance.
 

deepu_s_s

Full Member level 5
Joined
Mar 24, 2007
Messages
305
Helped
15
Reputation
30
Reaction score
5
Trophy points
1,298
Activity points
3,021
can u post the code u used for the design!
 

shafin

Newbie level 2
Joined
Apr 8, 2006
Messages
2
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,300
The code is:

Code:
module alu(a,b,s,cin,f,cout,lc);
	parameter n=2;
	input [n-1:0]a,b;
	input [2:0]s;
	input cin;
	output [n-1:0]f;
	output cout;
	inout lc;
	assign lc=1;
	reg [n:0]c;
	reg [n-1:0]f;
	reg [n-1:0]x,y,z;
	reg cout;
	integer k;	

	always @(a or b or s[2] or s[1] or s[0] or cin)
	begin
		c[0]=cin;
		for (k=0;k<n;k=k+1)
		begin
			x[k]=a[k]|(s[2]&~s[0]&(b[k]^s[1]));
			y[k]=(s[0]&b[k])|(s[1]&(~b[k]));
			z[k]=(~s[2])&c[k];
			f[k]=x[k]^y[k]^z[k];
			c[k+1]=(x[k]&y[k])|(y[k]&z[k])|(z[k]&x[k]);
		end
		cout=c[n]&~s[2];
	end
endmodule

Now I need to decrease the No of gates to lowest possible.If you need,I can post an Image of the circuit.

Thanks
 

khaila

Full Member level 2
Joined
Jan 13, 2007
Messages
121
Helped
5
Reputation
10
Reaction score
1
Trophy points
1,298
Activity points
2,105
Could you plz post the block diagram of the design???
 

shafin

Newbie level 2
Joined
Apr 8, 2006
Messages
2
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,300
Forgive me for my horrible drawing,I had drawn this in a hurry,I just hope you can still recognize it.

The pic is for one of the cascading stages of the ALU.I hope you can help me decrease the number of gates.
 

Status
Not open for further replies.
Toggle Sidebar

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top