|
小弟我是新手 想把呼叫function函數改成呼叫task 但不知道是哪邊有問題會一值出現 希望高手們能幫我一下
. e+ ], O- w0 y' j# B8 [9 P% f y我猜應該是在always和呼叫連結不起來的問題 卻不知道如何下手# G2 |" @% N0 T( k6 G
ncvlog: *W,FAAOP1 (shift.v,49|7): task or function call does not specify all formal output arguments [10.2.2][10.3(IEEE)].2 G, Q" _% ]7 L( a
output [7:0] mout;
& y& X- W( g, e( g4 r |6 ]+ @3 s8 D$ F% `
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* v- G7 d( Y% Mmultdiv8(right,indata,mout);4 l7 u4 a) B) {% l2 e7 n: P
|
; I* s1 q# I) `: W) g/ dncvlog: *W,FAAOP1 (shift.v,51|7): task or function call does not specify all formal output arguments [10.2.2][10.3(IEEE)].
( S# o! [. v8 x" U/ U6 ~$ loutput [7:0] mout;* A8 Y/ l& c3 Q! b
0 w4 v8 v& q) q: Z9 |6 U2 S1 ~2 A0 D3 \
原本的code:
$ x8 t( w" r9 s6 w9 X; d
) L: m2 c4 A+ k+ c$ @module shift(indata,qout,mout);6 n( V6 w$ Q; A1 N; S. J& s1 {( M
7 @$ I1 i- T1 c5 z5 q1 d
output [7:0] qout;- Y: Z4 M! Q( a% M
output [7:0] mout;
3 d! {2 `) O/ E9 Einput [7:0] indata;8 B) H8 |6 {9 ] {1 H
l! J) ^( I. b; ^4 L }9 s
reg [7:0] qout;8 p( x* V' c( x+ w! i7 u3 u y
reg [7:0] mout;
4 v- z) D6 i( |7 x5 d- K& [8 K2 Wparameter left=1;& n& `( J; r; d; _+ f0 \) D
parameter right=0;
& z) K% o) a3 f3 P: A! x, C0 R5 X* ], z- k" i* E! K, C
always@(indata)
) n' a; l% [ [# ?) F9 e, _- Z6 m! b# c6 S& }, ]3 z
begin
1 y/ W( {. g. |) V" I; b7 e/ C0 P6 D7 k
mout=multdiv8 (left,indata);
1 i" [$ T$ z, ?# b' Hqout=multdiv8 (right,indata);
4 T. w& @. o i* c' X1 F: i t& ~6 }, S9 p4 C" R* X( E5 K
end
: }2 l( O) p) U- h/ |7 w5 y
% P: P# u: y) y" l- g2 o% Ufunction [7:0] multdiv8;
7 {5 {+ p3 o j) }) Z# Z) Y$ W9 J3 P. P) k% M X& v* O5 w% @
input fcn_left :+ E0 o* c$ j, O( V
input[7:0] fcn_in;% A% E: {' ~* [- F
begin" u. L1 J( F# _: k+ ~- Z
multdiv8=(fcn_left==1)?(fcn_in<<3): (fcn_in>>3);
% F8 I4 S0 O5 ?( ?: u% t/ @( hend5 |2 ]4 i% y9 G! D
endfunction
, R% Q, G: Z6 b' r$ q' c4 I2 z5 v+ _2 f8 L. s, m0 b9 c
endmodule
' h- Q4 d4 D, ~* l3 i" O; G7 M: Z9 p8 Y/ p( R. c- w
以下是我自己寫的
5 c& h L1 T$ \: ?. g; B
! J+ |! ]. B7 |# mmodule (qout, mout,indata);$ d8 }. n" O. r: ]0 P9 \
6 g+ @5 o" Z `/ W3 b
output [7:0] qout;
. C3 M" b2 Y9 H+ i- D) h/ Doutput [7:0] mout;
( c! O, K% \8 a. ~5 hinput [7:0] indata;
5 s% D. C8 L3 }: m# ]. W1 Vreg [7:0] qout;: T g* M6 V& h! B# T( O$ \
reg [7:0] mout;1 V: P; d& o0 C4 e
parameter left=1;
9 Y3 N3 P( [& [8 o$ hparameter right=0;
3 z8 `! H4 c( a, [& g4 ]$ S. G, i |* y/ O, s E: k7 Z
always@(indata) begin" o5 e+ {# i6 _ j
! n* M. V$ w. ]: O0 [multdiv8 (left,indata,qout);
6 c1 I3 R; z8 E+ y* j: D9 D" J0 ]multdiv8 (right,indata,mout);) H+ ?# n l# |7 F1 q0 b! U' h; J
7 ?: U1 R* M' ?! F7 Xend
0 p( e$ j; ~5 Z7 o" I# k9 ]3 j1 K7 l0 j/ W4 D& b# V6 O9 q4 M E
task multdiv8;
v( j; h( }9 j( b# A v
c9 U: [) B- L d/ Linput fcn_left;0 g8 ?" I) H- q+ S
input [7:0] fcn_in;
! k4 u. e$ R. d- s* {( {# koutput [7:0] qout;
' j' ^1 V f+ E& ^output [7:0] mout;
- |8 T% n, P, B" Y# G! K% c: }1 x( l% y1 H
& r" U& P) O) x* y# {if (fcn_left==1)
! ?* H8 u" j" [ N; T" Y5 H2 L/ m; nqout=fcn_in<<3;
; E2 R0 D5 G. Q, Q5 N0 y- H% Jelse
9 r3 m/ s& ~+ R2 gmout=fcn_in>>3;
5 y5 i; R# Z; e C5 Z/ h& k5 D4 r, Q& n7 I2 ]2 Y6 o6 x1 }
endtask ( z" ~1 y" T; {& X
endmodule |
|