|
小弟我是新手 想把呼叫function函數改成呼叫task 但不知道是哪邊有問題會一值出現 希望高手們能幫我一下 ' t) l6 ^% V. S* C2 K* D2 K
我猜應該是在always和呼叫連結不起來的問題 卻不知道如何下手
4 x$ D4 V& \' o$ r3 f, u4 ?6 encvlog: *W,FAAOP1 (shift.v,49|7): task or function call does not specify all formal output arguments [10.2.2][10.3(IEEE)].- d0 v' d0 X! u5 B3 X) x2 @! J
output [7:0] mout;
* f8 z1 e: T1 ~7 \8 m) \+ C9 _ |; y$ O7 z) |+ z# ]6 X* i+ B) S/ l
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)].
6 I9 l% ^) E8 Ymultdiv8(right,indata,mout);: T# [$ |" F6 F/ v6 I0 l1 y
|& U# h* T4 X3 ]( w4 s4 U& s
ncvlog: *W,FAAOP1 (shift.v,51|7): task or function call does not specify all formal output arguments [10.2.2][10.3(IEEE)].& ]- [: }9 o# s" P; S# O2 o
output [7:0] mout;
; [" z i ]% D
1 S. G- Q6 D1 Y8 V% C7 f: }0 J+ u3 x4 |0 k' g/ h, E) Z
原本的code:1 b; i1 p0 L, }
* M3 x: G& m( n2 w0 S+ ` i7 t+ Bmodule shift(indata,qout,mout);( s7 c/ M' k1 Q. l, m$ N$ a
6 W' w$ {" s& s. g) X
output [7:0] qout;
, C# W! N- ^* l0 x* Woutput [7:0] mout;/ n( W \6 |4 J5 S+ A
input [7:0] indata;' w. p$ `5 d0 j
* Z: y/ a2 F% d, S2 P/ B
reg [7:0] qout;/ Z) U3 S9 V4 A9 _* S: f, T
reg [7:0] mout;. c6 s# i5 G1 `; f7 c: z# k' O2 x
parameter left=1;) [; r; L, S/ Z. B6 ?4 E
parameter right=0;/ n5 n/ A3 T: q- @4 ]
, a8 ^/ E# c% r5 u# z, falways@(indata). V% A- d4 a3 {* L3 d: |% N) I' H/ ~* ?
3 W3 e3 ^. m2 ?begin
1 d: k0 s) `! N2 B7 m2 }$ ]
8 Z1 Z2 l; z. K% V9 I- o9 amout=multdiv8 (left,indata);; _1 z7 b8 ?, S& w0 U
qout=multdiv8 (right,indata);1 R" i0 w: M* O( u5 O
: [ ]* n: q. B, F+ Eend" j. J, H9 }- P5 m
, o, B/ g" s ^1 ~7 r. Z7 o( H# ~3 [function [7:0] multdiv8;
! f- z+ w% U" U: f3 E) n- E/ U/ v) A6 m# _
input fcn_left :4 [' ?* ~1 K a) j
input[7:0] fcn_in;
: S8 D# Q. `; D5 mbegin
2 A+ f" {( V7 o. p7 i( X multdiv8=(fcn_left==1)?(fcn_in<<3): (fcn_in>>3);' i# V- O% V! t& D6 x! s& C
end4 e. t# G' ]( A
endfunction
4 j8 J% k/ w$ M' r# f# \' R& l6 y& z$ s( b) F: @
endmodule/ V0 L6 l5 |& B& y
! o: D, s/ b5 l4 s; x: A; z
以下是我自己寫的
( P+ D' r, o% v+ `- P- ~: A5 j0 A" a+ F( m& j9 m! t
module (qout, mout,indata);
+ v o+ E% x2 S) d$ a. R# j) i5 m7 S, R2 S
output [7:0] qout;
: T8 e: R1 Z J/ u9 x$ V% foutput [7:0] mout;8 H' @9 s* r% T9 z6 V2 a
input [7:0] indata; l" V) N4 x6 R& P9 d7 E
reg [7:0] qout;
) O1 w- c: _5 wreg [7:0] mout;
2 }5 y0 R, I9 p/ `2 }& Yparameter left=1;
, U) L. w: h% g7 S; Y5 T, c% f( Vparameter right=0;' r0 J, x" y0 Y K. i
9 s4 c- W( N2 Malways@(indata) begin
_; q8 l( L: }& _# ]2 _. S4 @+ X6 D# ~% D$ J7 {. N: b1 K
multdiv8 (left,indata,qout);1 M7 E/ |( t, _& L# d% Q
multdiv8 (right,indata,mout);
1 Z; H, v0 H! h2 u, F# @2 T0 b" t r8 |: q- w) m! O
end& b2 e) P! @+ i9 P. [
# v( b8 O# S. V3 \task multdiv8;) j# R3 e5 @' I- {. J
/ |" E9 |( O5 A* U/ G
input fcn_left;- @$ \% p7 p6 C9 R( [7 ?8 T
input [7:0] fcn_in;
/ x$ g) z+ u4 { U7 F7 qoutput [7:0] qout;9 e: H o: l+ ~
output [7:0] mout;- `) `* h4 u8 C( ]
1 x2 Y% M: C$ P, M) x
- u2 z8 W5 _% yif (fcn_left==1)7 t; _& Y' y5 R) ]* U/ n4 u& p
qout=fcn_in<<3;
0 K+ W" {% Q+ N. @' ^0 eelse
- A4 J6 t9 Y. W G. smout=fcn_in>>3;
; u' T' ~$ k% U1 C! y* _0 a( T: B' l: M; b) q: f) i) |
endtask
+ U/ q# R) _" I3 W' U# l4 r" n+ b$ Zendmodule |
|