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.

8bit Adder troubles simulating

Status
Not open for further replies.

jla2804

Newbie level 1
Joined
Apr 2, 2015
Messages
1
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
14
Hey guys, Im having trouble getting my 8 bit adder to simulate. Can you see if I have a logic error or just **** at quartus?


Code Verilog - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
module full_adder(a,b,cin ,s ,C);
  
  input a, b, cin;
  output s, C;
  wire w1, w2, w3;
  
  and A1(w1, a, b), A2(w2, a, cin), A3(w3, b, cin);
  or O1(cout, w1, w2, w3);
  xor X1(s, a, b, cin);
endmodule
 
 
module adder(a ,b ,cin ,s ,status, C);
  input [7:0] a,b;
  input cin;
  output [7:0] s;
  output C;
  wire c1, c2, c3, c4, c5, c6, c7;
  output [3:0] status;
  
  full_adder add0(a[0],b[0],cin, s[0], c1);
  full_adder add1(a[1],b[1],c1, s[1], c2);
  full_adder add2(a[2],b[2],c2, s[2], c3);
  full_adder add3(a[3],b[3],c3, s[3], c4);
  full_adder add4(a[4],b[4],c4, s[4], c5);
  full_adder add5(a[5],b[5],c5, s[5], c6);
  full_adder add6(a[6],b[6],c6, s[6], c7);
  full_adder add7(a[7],b[7],c7, s[7], C);
 
  assign status[3] = c7 & C;
  nor zero(status[2], s[0], s[1], s[2], s[3], s[4], s[5], s[6], s[7]);
  assign status[1] = C;
  assign status[0] = s[7]&1;
endmodule
 
module testAdd(a, b, cin ,status,s, C);
 
input [7:0] a,b;
  input cin;
  output [7:0] s;
  output [3:0] status;
  output C;
  
  adder add0(a, b, cin, s, C, status);
endmodule

 
Last edited by a moderator:

ads-ee

Super Moderator
Staff member
Joined
Sep 10, 2013
Messages
7,805
Helped
1,809
Reputation
3,628
Reaction score
1,768
Trophy points
1,393
Location
USA
Activity points
58,917
can you tell me what error you are getting

Probably U's, X's, or Z's because they aren't applying any stimulus to the DUT. Notice there isn't any testbench that I can see, but there is a testAdd module, which doesn't test anythnig?

- - - Updated - - -

Hey guys, Im having trouble getting my 8 bit adder to simulate. Can you see if I have a logic error or just **** at quartus?

I found your problems, one of them is because you're using positional association of your ports. Use named association for your ports.


Code Verilog - [expand]
1
2
3
4
5
6
// adder is defined with the following port ordering:
module adder(a ,b ,cin ,s ,status, C);
// you instantiate adder with the C and status swapped.
  adder add0(a, b, cin, s, C, status);
// you should always use named association to avoid the above problem.
  adder add0 (.a(a), .b(b), .cin(cin), .C(C), .status(status));



Your other error is due to using the wrong name for the output signal of your full_adder.

Code Verilog - [expand]
1
2
3
4
// cout doesn't exist
  or O1(cout, w1, w2, w3);
// C does exist and is the carry out
  or O1(C, w1, w2, w3);

 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top