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.

Problem with a two bit fulladder homework for ISE Xilinx

Status
Not open for further replies.

bibidibabidibup

Newbie level 2
Joined
Mar 29, 2010
Messages
2
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Location
Turkey
Activity points
1,299
Hello everyone,
im newbie in here and this is my first question. here we go
this is a two bit fulladder homework for ise xilinx
when im trying to test with UUT i see summary 0 is ok but summary-1(s0 s1) is that Z because of never used a1 and b1
whats wrong with it?
note:this code works for 1 bit adder
Main programme:

Code:
module Add_full_0_delay(sum,c_out,a,b,c_in);
output [1:0]sum;
output c_out;
input  [1:0] a,b;
input c_in;
wire w1,w2,w3;
Add_half_0_delay M1(w1,w2,a,b);
Add_half_0_delay M2(sum,w3,w1,c_in);
or (c_out,w2,w3); 
endmodule
module Add_half_0_delay(sum,c_out,a,b);
output sum,c_out;
input a,b; 
xor M1(sum,a,b);
and M2(c_out,a,b);
endmodule
Test programme
Code:
module t_full();
wire [1:0] sum;
wire c_out;
reg [1:0] a;
reg [1:0] b;
reg c_in;
Add_full_0_delay(sum,c_out,a,b,c_in);
initial begin
#100 $finish;
end
initial begin
//run through a series of numbers
   a=2'b00;b=2'b00;c_in=1'b1;
#10a=2'b01;b=2'b00;c_in=1'b1;
#10a=2'b01;b=2'b11;c_in=1'b1;
#10a=2'b01;b=2'b11;c_in=1'b1;
#10a=2'b11;b=2'b11;c_in=1'b1;
#10a=2'b11;b=2'b11;c_in=1'b1;
#10a=2'b01;b=2'b00;c_in=1'b0;
#10a=2'b01;b=2'b11;c_in=1'b0;
#10a=2'b01;b=2'b11;c_in=1'b0;
#10a=2'b11;b=2'b11;c_in=1'b0;
#10a=2'b11;b=2'b11;c_in=1'b0;
#10$finish;
end
endmodule
 

2-bit fulladder

Well one problem is that you are connecting the two bit input a [1:0] and b [1:0] to the one bit input on your half adder.

Here's a four bit RCA for your reference. **broken link removed**
 
Re: 2-bit fulladder

According to me. First of all i think it is important to declare the outputs as reg. Which is missing in your code.

So, I think first try and correct it. Then post your observations.


good luck!
 

2-bit fulladder

There is no reason to declare an output as a reg unless it is being driven in an always block or initial block. It is not syntactically correct to declare the outputs to be a reg in this example.
 

2-bit fulladder

use
Add_half_0_delay M1(w1,w2,a[0],b[0]);

like this
It may work
 

2-bit fulladder

thx guys everone but it didnt work
@saurabhs i tried your way but again answer is a(1) b(1) not used
@vijayiyer i ve thought like mux_master
@muxmaster your site is very helpful but i cant deal with hiearchical design why we use [4:0] in sum instead of [3:0] like a or b??
if i solve this problem, then i'll write
Is there any different idea? Bye
 

2-bit fulladder

They use sum [4:0] for a carry out bit. u can use sum [3:0] and a different carryout bit.
For a 2 bit full adder u have to have 4 half adder. so i feel a[1] and b[1] will use in another half adder. Isn't it.I m getting u correct.
 

2-bit fulladder

It is [4:0] because if you add together two 4 bit numbers, you may get a 5 bit number. Consider the case of 0xF + 0x1. The solution to this is 0x10 which is 5 bits. There are a couple of ways of dealing with this. One way is to set an overflow bit. Another way is to have the output be one bit larger.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top