Chip123 科技應用創新平台

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

作者: laasong    時間: 2010-12-27 01:54 PM
標題: 有關verilog 錯誤
小弟我是新手  想把呼叫function函數改成呼叫task 但不知道是哪邊有問題會一值出現  希望高手們能幫我一下  ) f8 P& }/ w- o7 |7 U4 {
我猜應該是在always和呼叫連結不起來的問題  卻不知道如何下手6 ~$ U; ?  M% v$ k
ncvlog: *W,FAAOP1 (shift.v,49|7): task or function call does not specify all formal output arguments [10.2.2][10.3(IEEE)].5 u6 K+ W% C7 R% H: A7 j- H5 h
output [7:0] mout;
: w# @' _. V, S& a* {8 w* E3 Z' A( F9 Q9 C                |; _# `9 R/ N: _2 ]5 r
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)].
: f/ u. \( _2 q6 Mmultdiv8(right,indata,mout);0 }& ]4 a5 c+ J9 f. s( R
       |
7 N- q1 E8 B2 x; E9 a. }ncvlog: *W,FAAOP1 (shift.v,51|7): task or function call does not specify all formal output arguments [10.2.2][10.3(IEEE)].
! {% a, N) `, T5 R2 p, \& g1 R+ Youtput [7:0] mout;0 e  ?: u3 x) G  H0 E! W! s
8 n: s, C; {2 ~% P* k4 S
2 u% q* t  B* x, l
原本的code:
2 K) k$ k5 l( N: l$ ?! W0 u
: Q3 w- `5 m, a2 Z' Bmodule shift(indata,qout,mout);
7 J6 M6 q7 Y. a( T9 E% K$ s; y. p  r: X5 |! {2 a) d
output [7:0] qout;
. Z5 _% }1 |; R9 r% ~" a$ Q3 loutput [7:0] mout;5 z/ d/ Q3 K- I/ y
input   [7:0]  indata;1 d6 m  F3 P6 I! [2 a9 w- @

. g/ t6 L- d, ^reg [7:0] qout;
* s8 W# U' R/ [9 G9 C3 Treg [7:0] mout;
+ C; y) ~! |& x. N" L! \parameter left=1;# k. L4 W5 u6 w0 C9 [
parameter right=0;) g5 [4 _4 X) P% P' O( x9 {) C
# Z& r( _3 E2 V5 Z9 m& D+ i3 h
always@(indata)+ D$ A( \0 s% C& l

  S. V( ]' w5 H) i! P+ T! tbegin
7 f. H3 l# O/ Z8 W. B: f
, Y# u0 n% ^* d. L: L5 ?$ o& jmout=multdiv8 (left,indata);
( E6 U: F6 ^2 \% T, \4 {qout=multdiv8  (right,indata);6 H) U/ g7 C% w& S7 V" k* S$ [
1 a: N( T' @( X- P; l
end
" }% |% F% x  ~% G8 g* F
$ T* o5 c; a, c8 F$ ]function [7:0] multdiv8;) B( F& t3 A) o9 v7 \5 I9 e0 I
. [4 h& K3 P5 C0 h2 U
input fcn_left :" {4 H7 U8 k: p0 V
input[7:0] fcn_in;
: r; D3 b, ?- F, z; W0 ^begin8 L+ Y) }6 K; T: b
    multdiv8=(fcn_left==1)?(fcn_in<<3): (fcn_in>>3);: }# b' g3 S8 S+ N9 A
end
& D8 V3 X, w: [endfunction) }& P$ Q, j2 W
! a6 z8 i. ?# Q" M1 a. N$ n$ y2 u9 I
endmodule
) B/ G) M  C0 q( C
0 w: W1 ~" K% h' K8 d; p8 W# H# T以下是我自己寫的 4 o0 P0 q9 i- O4 v! v0 T/ K

$ P+ d3 H: f( \& V$ bmodule (qout, mout,indata);
  L! I2 k& q9 ?; x4 h8 s8 H  ?) }: j' t" q0 {! l' U: v
output [7:0] qout;
; ~2 m4 s% t' l) m& }output [7:0] mout;+ Q! B1 i/ W  o5 f  R4 e
input [7:0] indata;
( [/ r" `1 D* z# B) Breg [7:0] qout;
$ r  U0 A" ^3 x5 |3 i3 g! t1 yreg [7:0] mout;0 W+ M0 r# P5 m8 S3 Z9 R
parameter left=1;  v' }  Y" F( t
parameter right=0;
  d% D  m2 A3 ^& q' G% O) x: X; i& {7 i  E! t% @4 u( ]) h" |+ L0 I
always@(indata) begin
* c  V) n7 z, [# _5 C. R0 h) h/ ?% s
multdiv8 (left,indata,qout);# B- _- A' D# g2 ~
multdiv8 (right,indata,mout);: M, Q* r7 W" }

8 |: q! c4 Z3 T: uend4 n2 _4 Q) ^- M/ a/ X, E- x

5 t6 q2 i. r" U# _, `" vtask multdiv8;8 i/ W3 g5 t- i2 Y" o2 V

8 |$ T; t: t9 [input fcn_left;8 [: W. @# f: k1 B9 `+ M
input [7:0] fcn_in;
# v+ A+ T4 k6 voutput [7:0] qout;
+ R" W$ [* ~7 d3 v& noutput [7:0] mout;
9 B) d! d8 v$ ?+ D% `6 Y0 _
6 h: K) d+ z6 O+ o. w" `* f
( D7 v+ t+ H: P! Kif (fcn_left==1)# u0 ^: B; G' K
qout=fcn_in<<3;. P2 }5 C( O' P9 D" {
else
- `2 h5 L  d9 @, W5 hmout=fcn_in>>3;% ^0 `6 {& ^) n% J

8 |; d  L. m1 ?" I# Dendtask & R  G( {5 x' y1 l4 I" M5 y
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不一致6 s: [2 J" s* _/ b# E4 Z
* h1 `- P( \0 D$ S" u3 p9 v' F
要在task後面多打qout and mout 這樣就OK了




歡迎光臨 Chip123 科技應用創新平台 (http://free.vireal.world/chip123_website/innoingbbs/) Powered by Discuz! X3.2