Chip123 科技應用創新平台

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

作者: laasong    時間: 2010-12-27 01:54 PM
標題: 有關verilog 錯誤
小弟我是新手  想把呼叫function函數改成呼叫task 但不知道是哪邊有問題會一值出現  希望高手們能幫我一下  ! P$ K5 z( [. x2 X- g# x, M
我猜應該是在always和呼叫連結不起來的問題  卻不知道如何下手
# Z& l+ D9 J+ Q  c: ~1 v. C3 l0 Kncvlog: *W,FAAOP1 (shift.v,49|7): task or function call does not specify all formal output arguments [10.2.2][10.3(IEEE)].+ E! y0 m! V/ ^1 L- n4 j$ ?5 ~
output [7:0] mout;1 m. L7 n6 c& }: u
                |  s. e9 t2 o. r: `6 f$ E, ^. m
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)].' K3 Q3 t/ R; ?/ D5 M7 j% S6 e
multdiv8(right,indata,mout);! D+ P0 S* H4 X+ F9 }2 T
       |' m5 D/ F: H! X6 F
ncvlog: *W,FAAOP1 (shift.v,51|7): task or function call does not specify all formal output arguments [10.2.2][10.3(IEEE)].1 I' ^4 I5 r+ J) z4 R+ s
output [7:0] mout;+ l- q( |: ^/ U( b1 H' t
/ F/ l' h0 A- A" d2 Z3 s6 f! Q
) W$ G" ^! o! T* Q
原本的code:* e; U& n# q  j2 h0 B  U2 ?2 O
7 V- q. Z* {$ J. b( `0 Y# O9 j* h
module shift(indata,qout,mout);
' u6 K  ?8 q6 a9 t5 ~" T0 a, k9 ?% I  ^- p
output [7:0] qout;) g' r& x5 t' x  o* T, A, {
output [7:0] mout;  q4 _$ B7 U6 _1 M9 M- c" N
input   [7:0]  indata;
% p; U: Y) _- ~. @& b2 v' W+ k: ?
6 V" t( Q$ C. w$ R1 P& m7 @reg [7:0] qout;
* A4 Z2 L3 J- o9 Freg [7:0] mout;
3 n  e0 I8 w. j* b4 ]7 |  bparameter left=1;6 l. S+ G7 V* S" D# i8 G
parameter right=0;
4 R  ]; Z6 l2 \3 {, p$ v8 s! z& \, }, v4 r
always@(indata)) |0 ^; K" f$ q/ D' n

. t$ i. t: s. x0 ?1 W7 f/ \begin, m% s" M% H! v  N4 q6 N

" |3 F' c7 v' p9 a% ~mout=multdiv8 (left,indata);7 O" T1 n/ c  ?% B7 J; e3 ?" a
qout=multdiv8  (right,indata);
5 H. H3 c5 ]# I" n5 E4 F$ D2 f# D; A
end- E8 d2 M. ^9 k( T( o2 N2 [
8 q& ^1 E$ j2 y0 m7 b6 U
function [7:0] multdiv8;5 z% w: P% @1 k$ d; @$ C2 q5 a

% u8 L" p/ I/ s, u% g' Sinput fcn_left :& Q3 P  Q* [+ C
input[7:0] fcn_in;
; E! h" u+ \2 L8 O- n9 B% B  e4 _. ~2 Wbegin
) k( ~! M1 G( }+ T7 j/ r    multdiv8=(fcn_left==1)?(fcn_in<<3): (fcn_in>>3);. Y" M9 ^8 p9 d
end7 O0 Q1 E: g# H
endfunction
; A* M' V2 E/ k1 ^  u1 t, n! d) _5 g- q4 D! S3 h
endmodule1 \5 \7 e; Y$ E) d1 C( e& v8 u  f8 k
) t3 L* c% P0 S! Y% Y4 J# Y
以下是我自己寫的 * k) [3 A$ G9 m3 Q; B
+ s# D4 e" |1 }4 N* W- n/ G. ~+ b
module (qout, mout,indata);. M- m0 K7 p7 @6 t$ I, j

9 z; V0 G3 n$ P- V' K1 E4 Ioutput [7:0] qout;
7 C$ r% j/ Y* i4 A& g) _0 r  Doutput [7:0] mout;) m8 y% u, f0 h( D4 E# D
input [7:0] indata;
* Q0 {0 u- ]6 R  I- Hreg [7:0] qout;4 H) Q0 {) Z0 ~. B: V
reg [7:0] mout;
+ X( @6 d5 d; R7 e6 q# j! v# Qparameter left=1;
+ B4 o5 T5 R! E/ Z3 `: t5 Iparameter right=0;  a' D5 @% [4 P

& x: v8 r' t( v! w9 [' m4 }' {; ?always@(indata) begin
$ _+ }3 P( k8 ]+ \& z4 H
! e- S9 f) T+ b) N4 V4 N% w' }multdiv8 (left,indata,qout);
; C  v$ A3 i/ l) Y9 {$ M/ umultdiv8 (right,indata,mout);
* e4 p* s4 A: P, S1 ?  [) X. Z# s: W4 z! c$ x9 T
end
! F1 w* ~; z' T" t- ]- _" L" O  V9 K& k, W4 q) _  D! m
task multdiv8;# [% H& v) f) h

, j% F  t' X0 Ainput fcn_left;. ~+ _8 l4 V5 n! J
input [7:0] fcn_in;6 m1 P( A8 s6 m& X" e6 J
output [7:0] qout;
/ `# \. J3 G" {: d# `/ foutput [7:0] mout;; {2 X; V( E& ?6 V6 ?

1 C8 y7 [5 O0 n/ \. G7 `# @8 [; H. H
if (fcn_left==1)* P# p' k# B. L, p! u( O5 P
qout=fcn_in<<3;) i$ A4 j( T  J& d* p; ]# ~0 P$ h
else
; {  D% g5 I4 c3 v  P& K- Vmout=fcn_in>>3;8 `8 V0 n% }: ~& K  L

2 D0 ~5 ?- ?! T0 r' jendtask # q* j( _. y$ 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不一致
8 j% U* l5 J9 a, P! C. ^% Z5 p' e7 m! b
要在task後面多打qout and mout 這樣就OK了




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