English 中文(简体)
单体编码产出总是使用光头添加器进行zz。
原标题:Verilog code output is always zzz using carry lookahead adder
  • 时间:2024-04-26 04:12:13
  •  标签:
  • verilog

我正试图利用光头添加器提高乘数,但我的一半产出是<代码>zz<>。 这是我守则的一部分。 <代码>cla16是一个16比方载光头添加器。 该表在<代码>v16bit模块中生成<代码>zz。

module v16bit(a,b,p);
  input [15:0] a,b;
  output [31:0] p;
  wire [15:0] p1,p2,p3,p4;
  wire [17:0] s1,s2;
  v8bit adabudi(a[7:0],b[7:0],p1);
  v8bit sjubh(a[15:8],b[7:0],p2);
  v8bit csfc(a[7:0],b[15:8],p3);
  v8bit cucbu(a[15:8],b[15:8],p4);
  
  assign p[7:0]= p1[7:0];
  csa16bit bubsuf(p2,p3,{8 b0,p1[15:8]},s1);
  assign p[15:8]=s1[7:0];
 // cla16 consn(p4, s1[17:8],s2);
  cla16 consn(p4, {6 b0,s1[17:8]},s2); //////{THIS PART IS PRODUCING ZZZ AT OUTPUT}

  assign p[31:16]=s2[15:0];
endmodule

module cla16(a,b, cin, sum);
input [15:0] a,b;
input cin;
output [15:0] sum;
//output cout;
wire c1,c2,c3,c4;

cla4 cla1 ( a[3:0] , b[3:0], 1 b0,  sum[3:0] ,  c1)  ;
cla4 cla2 ( a[7:4] , b[7:4], c1,  sum[7:4] ,  c2)  ;
cla4 cla3( a[11:8] , b[11:8], c2,  sum[11:8] ,  c3)  ;
cla4 cla6( a[15:12] , b[15:12], c3,  sum[15:12] ,  c4)  ;
endmodule

module cla4(a,b, cin, sum,cout);
input [3:0] a,b;
input cin;
output [3:0] sum;
output cout;

wire [3:0] p,g,c;

assign p=a^b;//propagate
assign g=a&b; //generate

//carry=gi + Pi.ci

assign c[0]=cin;
assign c[1]= g[0]|(p[0]&c[0]);
assign c[2]= g[1] | (p[1]&g[0]) | p[1]&p[0]&c[0];
assign c[3]= g[2] | (p[2]&g[1]) | p[2]&p[1]&g[0] | p[2]&p[1]&p[0]&c[0];
assign cout= g[3] | (p[3]&g[2]) | p[3]&p[2]&g[1] | p[3]&p[2]&p[1]&g[0] | p[3]&p[2]&p[1]&p[0]&c[0];
assign sum=p^c;
endmodule

https://i.sstatic.net/nSgelJ0P.png”rel=“nofollow noreferer”> 这是产出

I don t understand why high impedance is showing at the output. Please help me if you can locate any error.

问题回答

你的法典在该行有一条港口连接错误。 你的模拟者本来应该把这一报告作为汇编的警告;检查你的记录。 如果没有的话,则考虑使用不同的模拟器,就像在“基地”上的模拟器。

The cla16 module has 4 ports, but you only made connections to 3 of them in the consn instance.

页: 1 这意味着s2cininput港 of cla16/code>有关。 页: 1 由于你将其连接到一个投入港,因此没有将其推向,这意味着它在整个模拟中一直保留在z上。 由于<代码>p<>>>>代码/代码>的16个MSBs由s<2>/code>驱动,因此,它们也是z

您应使用linkion-by-name,以避免出现这一共同的Verilog错误:

cla16 consn (
    .sum (s2), // assuming you want s2 to be connected to sum
    .a   (p4),
    .b   (), // make connection here
    .cin ()  // make connection here
);




相关问题
How to NOT use while() loops in verilog (for synthesis)?

I ve gotten in the habit of developing a lot testbenches and use for() and while() loops for testing purpose. Thats fine. The problem is that I ve taken this habit over to coding for circuits which ...

Displaying the Verilog parameter name

I am using the parameter keyword to define a state, i.e., RESET = 5 b00000. If I want to use $display to print out the state name instead of the binary representation, or display the state name in my ...

verilog modelsim fpga

Sorry for Newbish question. I am trying to learn about FPGA programming. Before I spend $1K on a FPGA board: if I just want to learn Verilog, can I run it entirely in Modelsim? (I realize there are ...

Assigning wires deep in a nested set of modules

I have a wire that is about 4 levels deep and I really don t want the hassle of having to propagate it up the hierarchy. Is there any way to assign the wire using some sort of referencing? I know I ...

schematic for verilog code that adds three inputs

What does the schematic looks like for the following verilog code? module mystery2(s, c, x, y, z); input x, y, z; output s, c; assign {c, s} = x + y + z; endmodule I know that {c, s} means ...

wire equation in verilog [closed]

If say I have the following wire set-ups, is the wire assignment all valid? wire[3:1] w; wire w1; wire [1:0] w2; A) w1 = w[2]; B) w2 = w[1:0]; C) w2 = w[1:2]; I am guessing that everything is ...

How to wire two modules in Verilog?

I have written two modules DLatch and RSLatch and i want to write verilog code to join those two.