Verilog için ALU yazmayı deniyorum. Ve deneyimlediğim birkaç hata var. Aşağıdaki kullanırALU için Verilog modülü düzgün çalışmıyor.
module yMux(z, a, b, c);
parameter SIZE = 2;
output [SIZE-1:0] z;
input [SIZE-1:0] a, b;
input c;
yMux1 mine[SIZE-1:0](z, a, b, c); // 2-bit 2 -to-1 mux and it would be cumbersome to write 32 mux instantiation lines.
endmodule
Son olarak yMux yukarıda: Burada
module yMux1(z, a, b, c);
output z;
input a, b, c;
wire notC, upper, lower;
// Gates and interconnections for MUX
// if c is 0, z=a.
// if c is 1, z=b
not my_not(notC, c);
and upperAnd(upper, a, notC);
and lowerAnd(lower, c, b);
or my_or(z, upper, lower);
endmodule
olduğunu
olduğunu HerÖncelikle burada benim kodudur:
module yAlu(z, ex, a, b, op);
input [31:0] a, b;
input [2:0] op;
output [31:0] z, ztemp;
output ex;
wire[31:0]a0,a1,a2,a3,a4, atemp;
assign slt = 0;
assign ex = 0;
assign a0 = a & b;
assign a1 = a | b;
assign a2 = a + b;
assign a3 = a - b;
assign a4 = a[31]^b[31];
yMux #(32) lo(zLo, a0, a1, op[0]);
yMux #(32) hi(zHi, a2, a3, op[0]);
yMux #(32) temp(atemp, zLo, zHi, op[1]);
assign z = (op[2] == 1) ? a4 : atemp;
assign slt = z;
endmodule
Ve yAlu.v aşağıdaki kullanır Yukarıdaki testler:
aşağıdaki gibi sıraylaSorularım: sadece yukarıda
Question 1.
Kod 0 çalışır ve 1. Mesele daha çalışmaz. Örneğin, 2. kaynak kodunda,
a = $ rasgele; b = $ rasgele;
bunun için çalışmıyor. a = 1 veya 0, b = 1 veya 0.
Question 2.
ben emin "slt" fonksiyonu düzgün çalıştığını olduğumda sadece çalışır. Bunu öğreten hoca, bana derste ne gibi bir şey yaptıklarını söylemedi, ama biz, googling ya da başka bir şeyle, bize slt tasarladı.
Question 3.
Derlediğim her seferde Hata alıyorum. Bu neden?
yAlu.v:38: warning: Port 1 (z) of yMux expects 32 bits, got 1.
yAlu.v:38: : Padding 31 high bits of the port.
yAlu.v:39: warning: Port 1 (z) of yMux expects 32 bits, got 1.
yAlu.v:39: : Padding 31 high bits of the port.
yAlu.v:40: warning: Port 2 (a) of yMux expects 32 bits, got 1.
yAlu.v:40: : Padding 31 high bits of the port.
yAlu.v:40: warning: Port 3 (b) of yMux expects 32 bits, got 1.
yAlu.v:40: : Padding 31 high bits of the port.
I can't fix this at all.
ben bile doğru yapıyorum bilmiyorum. Bana söylediği şeyi yapmamı sağlayan kılavuz, örnek çıktıların yanı sıra yeterince açıklamaya da sahip değil.
Zaten zamanında bitiremedim, bu yüzden önemli değil sanırım sorunum için çözümü bilmem gerektiğini düşünüyorum.
Bana yardım ederseniz çok teşekkür ederim.
Etiket etiketini durdur! Verilog, assembler veya C ile hiçbir şekilde ilgili değildir! Bir programlama dili bile değil. – Olaf