|
小弟我是新手 想把呼叫function函數改成呼叫task 但不知道是哪邊有問題會一值出現 希望高手們能幫我一下
( V6 |( O( [; j: n我猜應該是在always和呼叫連結不起來的問題 卻不知道如何下手
! P) m6 v9 y0 _6 l+ U. e1 Tncvlog: *W,FAAOP1 (shift.v,49|7): task or function call does not specify all formal output arguments [10.2.2][10.3(IEEE)].! _9 d( }+ s$ b5 U m
output [7:0] mout;( d# p& ^4 D0 b% x% j- R
|; O& U3 \0 ^: v' b; f& @9 ^
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)].* T5 a3 o; X+ @5 j
multdiv8(right,indata,mout);
; h: x$ H* L% d h2 W) v |
) N- J9 ]- J# n# _3 [) E) F- tncvlog: *W,FAAOP1 (shift.v,51|7): task or function call does not specify all formal output arguments [10.2.2][10.3(IEEE)].
; q, o, }1 e: Uoutput [7:0] mout;3 j- ^8 c* A, N6 g5 @3 D
0 }5 f5 v& s2 `% T% Z3 S4 w, h: S8 T# O4 S
原本的code:
( z4 A" P d& a, E% d+ n# v% s3 j
+ w2 E: ^* W! v6 omodule shift(indata,qout,mout);# c& L* @* z8 u! b: j! R' A9 N
`0 q/ l( _4 Woutput [7:0] qout;
5 ?4 t' A- C3 c/ Noutput [7:0] mout;* ]& `1 O( k0 w# ` Y; w: X& f
input [7:0] indata;
8 q" U% D' [1 l$ {0 \9 s, ~4 j) K7 F; ~- m0 V! }3 |) f
reg [7:0] qout;% l7 s: M% Z& G" r; y, j
reg [7:0] mout;
& r$ ^ |" {2 pparameter left=1;
7 |: K: B. p0 c( I4 cparameter right=0;
' {7 ?& n. O( p+ U9 e9 G
% w5 K* a N W* halways@(indata). Q0 w- a! o- j& A2 K0 a8 L2 Z- r8 A( v9 X
5 D4 k# g8 k0 F; ]. rbegin
( S" x7 h& H+ a# T0 e3 a
& [9 E/ {1 V2 n0 y) q Cmout=multdiv8 (left,indata);
9 @) w$ c G* S4 I3 G6 A/ Fqout=multdiv8 (right,indata);* \/ e5 H2 _: t7 {# x. A3 d3 F/ V
$ O( U" }7 k" m Lend
0 q6 t7 e% A" s/ w
7 M( j6 `) F% cfunction [7:0] multdiv8;
: L2 k' z" W' J- s+ J% ?; U
4 w- D) K/ j1 V7 E4 k; G# pinput fcn_left :: }# w- j5 @% |/ d4 Z
input[7:0] fcn_in;
+ U0 c' X% |4 @begin
* n# b. J% R4 c1 |2 C7 l% H/ b multdiv8=(fcn_left==1)?(fcn_in<<3): (fcn_in>>3);
! t' {$ Q# [! oend
: v4 ?+ i' O3 X" I. X2 pendfunction
8 ~1 B8 u$ f6 P# J" q0 r- r/ L$ c4 c# ~! y, k
endmodule1 _$ j( z: w8 o) d: B! \
) z Z# r; w# c3 p以下是我自己寫的 * J' U; z3 s" l& E, {9 B
" f A' |( u/ [9 u
module (qout, mout,indata);
; c( w/ @! r4 j- Q4 O( l8 l: K. L0 k+ d- Q! F% H5 I
output [7:0] qout;
9 a6 t2 n- M' k+ N6 z4 ]output [7:0] mout;& `* j9 W% v; K9 V9 t
input [7:0] indata;- \5 T3 `% S' p y2 d2 {; V7 M& R% n# R
reg [7:0] qout;
$ S# V0 P/ f5 p$ A5 w" q9 L; U# freg [7:0] mout;
\& |1 }2 W* U1 _2 lparameter left=1;# `0 ~0 E5 L6 n' P8 {" G# `9 p
parameter right=0;5 h( _# v3 n0 m- n' S4 c2 A
& p- A, _& h7 b. T" {) _" [6 {always@(indata) begin0 p* M$ ?8 O% @* Q7 m3 _5 D
# h2 B# X# T: R5 d. k- h
multdiv8 (left,indata,qout);8 ]# V3 x# T* o% x
multdiv8 (right,indata,mout);
. w8 q2 H8 e7 x0 M. A: V) C
3 l" P$ n/ P( F wend
' o; M4 |) d+ C, O* A9 S' ?! t; S! u6 i7 H7 W( K* S
task multdiv8;
1 L, v+ U% L% E s# e/ m8 F4 U9 T
" q" ?; Y, @( w6 q8 ainput fcn_left;
* h0 m. z- \8 H( k: k9 Einput [7:0] fcn_in;. Y- k9 n1 w2 Y; y
output [7:0] qout;, |5 P( Y# S' w+ ?/ Q- E
output [7:0] mout;- p- E) r1 C1 G. U
+ R& O" i9 W* o3 _
8 E, f8 c; B2 P2 x) ]* q
if (fcn_left==1)
# u6 j5 U! [! h1 ^% z' c% kqout=fcn_in<<3;4 H% @) Z$ ?% }1 i0 Y
else6 n: `4 H8 W* w# O+ {/ M
mout=fcn_in>>3;
; V0 D- _% I. D" h0 t! H6 Y. U6 ^3 a# D' f
endtask 7 i) l3 P8 a& b$ v0 \( I
endmodule |
|