Chip123 科技應用創新平台

標題: 有關verilog 錯誤 [打印本頁]

作者: laasong    時間: 2010-12-27 01:54 PM
標題: 有關verilog 錯誤
小弟我是新手  想把呼叫function函數改成呼叫task 但不知道是哪邊有問題會一值出現  希望高手們能幫我一下  
4 m* ]4 O- n3 o  }4 p我猜應該是在always和呼叫連結不起來的問題  卻不知道如何下手
! R6 \! ]  p; D3 ?, b+ J( Wncvlog: *W,FAAOP1 (shift.v,49|7): task or function call does not specify all formal output arguments [10.2.2][10.3(IEEE)].. b$ C. K" N; T/ f- a% C- H
output [7:0] mout;. V+ X) `, d0 a' g
                |$ n0 z& T' k' ~4 n9 w* j1 s5 b
ncvlog: *W,FAAOP2 (shift.v,60|16): Formal output argument 'mout' is absent in the task or function call identified by the previous error message [10.2.2][10.3(IEEE)].% L- K: p' v+ w7 g4 S
multdiv8(right,indata,mout);% p# o/ n& Y6 }) F
       |
+ N5 v7 u# k2 m* Oncvlog: *W,FAAOP1 (shift.v,51|7): task or function call does not specify all formal output arguments [10.2.2][10.3(IEEE)].
1 _1 ~2 x  \) M( Uoutput [7:0] mout;6 l3 Z! _: q' y- m6 a  E$ `" u
/ u/ u. c/ m; P8 v9 x3 }' K" V$ h

0 X! U; t0 E; S. h4 d/ |原本的code:4 h. D, k1 I2 s( T2 w

/ k$ Z8 U* ~3 T. d- H6 fmodule shift(indata,qout,mout);- f' C8 W% R4 r* W% ~* n1 p

& o) B2 M3 z) {5 y3 t* foutput [7:0] qout;
9 q  g7 [9 I) ooutput [7:0] mout;
. z6 N: q" C/ l0 f% ^" k) D  c* Binput   [7:0]  indata;+ S6 j3 @+ T" K  ^7 `& o1 t$ `6 V

! e( N8 S3 O8 E9 [$ c& _$ E/ d- E) e, Creg [7:0] qout;
% W6 w8 P, y# u( u% b" z6 l1 V1 Ireg [7:0] mout;% g2 ~& L" i  f$ N* X% O# }
parameter left=1;6 r% x! k& }- F8 J; {
parameter right=0;
2 t5 v/ \$ Y3 `- w( o/ h6 g; N% f3 e& r
always@(indata)
2 u! o: Y8 z. i* f3 a# _& a1 R: O0 P( b
begin. v+ P' v! d5 a  f

4 @6 |0 |. h1 X! d+ O' Ymout=multdiv8 (left,indata);+ T0 R6 b( H0 F0 n& l" Z
qout=multdiv8  (right,indata);
' x/ b3 o$ ^) P# C" a
& O1 S+ x- C6 V. v& Z# D+ a0 g' Pend$ ?/ N' M9 q* L; |! ^( m1 a
3 e5 V& H5 C% S1 w0 K8 O, x3 c' d
function [7:0] multdiv8;
7 ^/ r! ]* f% G* ~; y% e% o
! W6 z7 v; G1 x& ?/ D+ B" \input fcn_left :
0 L* {* Q$ ?2 z& F# g! z% }input[7:0] fcn_in;# d9 g  w2 ^! ]% U; z( e
begin
1 y5 W& h, u! b    multdiv8=(fcn_left==1)?(fcn_in<<3): (fcn_in>>3);' P# P8 v& {' _- p
end1 I! U- U; }$ U! n
endfunction
" ^" P; Z+ t$ o6 w; I1 s. x7 V9 i3 h: Q7 f$ r! x% k% c$ a2 t0 O! W
endmodule  o' b- J# O: v% ~5 F- L! h
. {; u% D3 J0 E. K" D5 Z% c
以下是我自己寫的 & h1 ?5 ~6 y. K7 u+ Z+ W& }' v

# p0 ^* N+ |" s6 }1 Smodule (qout, mout,indata);6 T" \9 W1 B1 a9 P& z. i9 W- \* I

" z  w' S9 L4 V3 \+ ]output [7:0] qout;/ K0 A; M1 f* s( r
output [7:0] mout;
0 p( n. Y6 `" K2 I' K  s* iinput [7:0] indata;
: d% K, D- m* M. ?  L3 preg [7:0] qout;
9 J; L. B1 f3 z# v5 _reg [7:0] mout;4 s7 m; f$ s( ]1 X2 S
parameter left=1;2 ^5 s$ |  c1 T; R' j0 Z. n
parameter right=0;7 ^5 N& R8 j4 e
6 C# h( J, E: R
always@(indata) begin8 E2 L( @5 A6 l

( j- D# J  L: g2 `2 pmultdiv8 (left,indata,qout);* @& x3 ?: e. `" q$ X! g) W
multdiv8 (right,indata,mout);
2 U( S. s- N! G6 J% \0 l7 m
' y& o; R( J. m( J: K+ u5 C) dend: L; K- U8 r" ^' w6 G3 J

" d* P/ p. J: t, I/ x" w* wtask multdiv8;* E$ K9 J* S0 y
$ c, ?0 s% n, {2 l+ d# M% g: f
input fcn_left;
& `+ M- k6 B" ]( Tinput [7:0] fcn_in;" {4 ]0 ?# f  p
output [7:0] qout;" W) f' n4 O4 o  a$ n4 L+ ~
output [7:0] mout;) _: b/ [1 h7 D8 t6 s% E5 O

9 ~. x; {  G- t0 z8 N( a8 B' i5 y- N* v4 _, c
if (fcn_left==1)- }4 @! u$ g  X0 |
qout=fcn_in<<3;
7 R7 Y( Y$ c# w: ?1 a8 zelse, J4 L: C& I' X2 W, i) ~
mout=fcn_in>>3;" d( M% U" @' I1 H

) m6 L" x- x% k! Qendtask
3 c0 g6 U/ h' s  ]$ h+ l' C& ~endmodule
作者: chienw    時間: 2010-12-29 01:19 PM
you did not specify qout when you called the task, which is the error message tries to tell you.
作者: laasong    時間: 2010-12-29 04:34 PM
我知道我問題所在了  task的port和宣告的port不一致! `3 m* L# o- G
; S5 Z& J' Z% S# |! Y8 H% A
要在task後面多打qout and mout 這樣就OK了




歡迎光臨 Chip123 科技應用創新平台 (http://www.chip123.com/) Powered by Discuz! X3.2