2013-05-21 5 views
2

JK 플립 플롭 모듈을 호출하는 데 문제가 있습니다. 우리 프로젝트는 상태 머신을 만드는 것입니다. 내 논리는 맞지만, 오류 메시지가 나타납니다. "VHDL 모듈 인스턴스화 오류 : 인스턴스 포트를 오류와 이름 둘 다로 연결할 수 없습니다"Verilog 인스턴스화 오류

오류입니다. JK_FF의 첫 번째 실체화 라인 (67)에

편집 : 나는 문제를 가정하고있어이 http://quartushelp.altera.com/11.1/mergedProjects/msgs/msgs/evrfx_veri_not_a_structural_net_expression.htm

에 의해 주어진 레지스터 함께 할 수있는 뭔가를 가지고 있지만 난 정말하는 방법을 잘 모르겠어요 이 오류를 수정하십시오.

//Project 2 "main" 
module Project2(q3, q2, q1, q0, w, z0, z1, CLK, RST, enable); 
//honestly not too sure if I need the Q or not 
reg q0,q1,q2,q3; 
input enable, w, CLK, RST; 
output q0,q1,q2,q3,z0,z1; 

initial begin 
//k3 <= 1'b1; // essentially k3 = 1 
end 

and(newClock, CLK, enable); // this is the ned clock 

//now i do my assignments i'm guessing 
not(wnot, w); 
not(q3not, q3); 
not(q2not, q2); 
not(q1not, q1); 
not(q0not, q0); 

// j0 assignment 
and(j0temp,w,q3not,q2not,q1not); 
and(j0temp1,wnot,q2); 
and(j0temp2,wnot,q1); 
or(j0,j0temp, j0temp1, j0temp2); 

// k0 assignment 
and(k0temp,q3not,q2not); 
or(k0,wnot,q1, k0temp); 

//j1 assignment 
and(j1temp, wnot,q3not,q2not,q1not,q0not); 
and(j1temp1,w,q2); 
and(j1temp2,w,q0); 
or(j1,q3, j1temp, j1temp1, j1temp2); 

//k1 assignments 
and(k1temp,w,q1); 
and(k1temp1,q2,q0); 
and(k1temp2,q3not,q2not,q1,q0not); 
or(k1,k1temp,k1temp1,k1temp2); 

//j2 assignments 
and(j2temp,wnot,q0); 
and(j2temp1,w,q1); 
and(j2temp2,wnot,q3); 
or(j2, j2temp,j2temp1,j2temp2); 

//k2 assignments 
or(k2,wnot,q1); 

//j3 assignments 
and(j3,wnot,q2,q1,q0); 

//z0 assignments 
and(z0temp,wnot,q0not,q2); 
and(z0temp1,wnot,q1,q2); 
or(z0,z0temp,z0temp1); 

//z1 assignments 
and(z1temp, wnot,q2); 
and(z1temp1,wnot,q1,q0not); 
and(z1temp2,q2,q1); 
or(z1, z1temp, z1temp1, z1temp2); 

//instantiate the flip flops 
JK_FF y0(.j(j0),.k(k0),.CLK(newClock), .RST(RST), .Q(q0), .Qnot(q0not)); 
JK_FF y1(.j(j1),.k(k1),.CLK(newClock), .RST(RST), .Q(q1), .Qnot(q1not)); 
JK_FF y2(j2,k2,newClock, RST, q2, q2not); 
JK_FF y3(j3,k3,newClock, RST, q3, q3not); 



endmodule 

//asynchronous reset JK flip flop module 
module JK_FF(j,k,CLK,RST,Q, Qnot); 
input j,k,CLK,RST; 
output Q; // not sure what this does or if used 
output Qnot; 
reg Q; 
reg Qnot; 

always @(negedge CLK or negedge RST) 

     if(RST)begin 
     Q <= 0; 
     Qnot <= 1; 
     end 
     else if(~j && k) begin 
     Q <= 0; 
     Qnot <= 1; 
     end 
     else if(~j && ~k) begin 
     Q <= Q; 
     Qnot <= Qnot; 
     end 
     else if(j && ~k) begin 
     Q <= 1; 
     Qnot <= 0; 
     end 
     else if(j && k) begin 
     Q <= Qnot; 
     Qnot <= Q; 
     end 

endmodule 
+1

Verilog을 작성할 때 왜 "VHDL 모듈"인스턴스화 오류가 발생하는지 알고 있습니까? IDE가 현재 어떤 언어를 사용하고 있는지 알고 있습니까? – Tim

답변

4

IEEE Std 1364의 어느 곳에서나 선언 선언 이후에 반드시 변수 선언이 나타나야합니다. 데이터 유형 섹션의 어딘가에 있어야합니다. 참조를 찾으면 내 대답을 업데이트하겠습니다.

쉬운 수정 : 4 줄을 아래로 이동하십시오.

필자는 개인적으로 IEEE Std 1364-2001에 소개 된 포트 선언 스타일을 사용하는 것을 선호합니다. 코드 줄이 적고 읽기 쉽습니다. , IEEE 표준 1364에서 2001 사이 섹션 12.3.3에서

:

module Project2(
    output reg q3, q2, q1, q0, 
    input wire w, 
    output wire z0, z1, 
    input wire CLK, RST, enable); 

또한 k3에 드라이버를 누락 있습니다 그것은 JK_FF y3


인용 업데이트와 함께 당신에게 문제를 줄 것이다 IEEE Std 1364-2005 섹션 12.3.3 및 IEEE Std 1800-2012 섹션 23.2.2.1에서 반복됩니다.

"If a port declaration does not include a net or variable type, then the port can be again declared in a net or variable declaration."