|
小弟我是新手 想把呼叫function函數改成呼叫task 但不知道是哪邊有問題會一值出現 希望高手們能幫我一下 ( w9 R, b% z" T0 f h% B& o7 \
我猜應該是在always和呼叫連結不起來的問題 卻不知道如何下手5 }! N/ m# f8 }* Z! u
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 I1 U: @2 w% l" aoutput [7:0] mout;9 m5 P/ P& X" X
|
2 |3 S% W' B& A5 V' |: H7 x( ^0 gncvlog: *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)].& S; X9 B; z) k: f f% q4 p8 {
multdiv8(right,indata,mout);
% X% ]% k# e8 M/ g |
$ v0 c+ m/ p" h% _ncvlog: *W,FAAOP1 (shift.v,51|7): task or function call does not specify all formal output arguments [10.2.2][10.3(IEEE)]." p8 S8 o' g N* u7 k2 z
output [7:0] mout;/ T& O3 F2 O- t( i d% o
- K, t1 J- S; @4 v# U5 d
2 F+ y: r" D; `# h. N/ L
原本的code:( ]* o9 S0 v4 O' [( n8 z
7 h: h1 ~; O; @4 t- _% s! o
module shift(indata,qout,mout);
- D9 R/ f& h C$ N
5 e6 ]5 H8 T J2 k1 P3 v( y! D Joutput [7:0] qout;
0 n5 E- a; T5 Z- P! b" Foutput [7:0] mout;+ N S& _% S* T
input [7:0] indata;
F* D9 B+ R+ m; l0 j2 e( ?
0 A+ I5 d6 F/ K. }0 }, K* ireg [7:0] qout;# ^% d9 L7 z4 e2 C% X
reg [7:0] mout;
: s6 ~/ d. G# |" T& r1 g4 H* m9 Wparameter left=1;
+ i- m7 \$ T8 l6 \; nparameter right=0;
- v6 d2 N# \% j# |! |: A% z$ V- E
" G4 d i( I4 @4 z5 S* b4 `! Xalways@(indata)
, q. g# j" R0 X, p+ T, g; E9 n4 _3 F/ p) `' r. N' b% Y2 b
begin+ N: [2 j. b) x$ p) J/ w2 s# ]' q
& w4 G- |4 i: q$ {: U+ omout=multdiv8 (left,indata);
, q+ l8 S. S! V; \) p; n* lqout=multdiv8 (right,indata);
, w$ B; P; q- E' _$ E9 P
7 m W/ v% ~- g+ W! |1 r) |6 E2 U6 Hend
' ]: f \) V) d1 C$ c: E# X; @: D9 S7 c6 E ~5 Y7 G# \
function [7:0] multdiv8;
' n% W- @% ?9 K7 m0 s& L
3 P* c8 v7 O) B# L7 p9 g0 u2 Kinput fcn_left :
: u2 P2 d; F9 ^3 |2 T' Ainput[7:0] fcn_in;
! Q5 K8 y5 p: z# Q/ y+ xbegin2 O; t% K2 d% ~4 n6 [2 X% S+ o! t
multdiv8=(fcn_left==1)?(fcn_in<<3): (fcn_in>>3);
5 k! y$ s/ S `8 Xend; Q! L1 l% Y6 t4 T9 \5 e9 u
endfunction, V# l' S$ o# x, Y
0 e, B/ |3 m H1 g; L1 B0 t
endmodule% i3 \3 J( Y$ s& u9 e. E7 o; T
. n1 l% C8 c, d$ E( s. l2 G以下是我自己寫的 $ A8 X* R: U. a% C. c! b
) {4 Q! f' [/ p! u& r; A. z. kmodule (qout, mout,indata);
M6 N- U, U0 Q# O; w; ?" ^' i; M" u, |
output [7:0] qout;8 v- e) e- e2 s" |1 F
output [7:0] mout;
8 C$ }6 l1 _6 K/ e3 N9 O9 pinput [7:0] indata;- p+ s2 m1 w. \; ~* ~( W
reg [7:0] qout;; h G. Q% f* Z) P+ \. u
reg [7:0] mout;' c4 l- r6 O9 Y0 |
parameter left=1;
) Q& K6 s+ ^' `4 n, ]& i0 eparameter right=0;9 y/ Z. n. ~! J! o
" ?$ p1 J% V& Y2 I7 a- s/ {always@(indata) begin
# t( Z9 O t0 @% n( O
; [* j" }8 H" Jmultdiv8 (left,indata,qout);
+ D5 P" c) e l: Smultdiv8 (right,indata,mout);
- { j3 _1 ~5 N
c5 \/ x& W2 X" b5 L8 ]% Rend0 P6 M2 g# j! w
5 m' [0 c' K, B6 N, F3 \task multdiv8;
7 Z8 J, s8 ?: e+ b7 h
$ L$ }: m! m+ Z: q# jinput fcn_left;: F5 d8 k* L2 H: |
input [7:0] fcn_in;
" M. ]9 t# ^" @6 g0 l4 noutput [7:0] qout;
$ G6 F% r7 ?; W0 ?, zoutput [7:0] mout;3 C( k' ] S7 i& e0 R
7 F) K4 k# D" j$ t. {
4 w: Z) U" e) `3 P% c$ dif (fcn_left==1)
v, X5 V$ | i Q4 C; | [qout=fcn_in<<3;" n& n! x; n( M B' l5 {
else
7 v: I: _- B' d" dmout=fcn_in>>3;
: }5 A _/ G5 M3 Z: d% P
$ P- v/ _2 d3 g W0 ]# U9 o( Qendtask
! l4 |* Q" B5 [7 v. Y" Pendmodule |
|