|
小弟我是新手 想把呼叫function函數改成呼叫task 但不知道是哪邊有問題會一值出現 希望高手們能幫我一下
& p* }. w$ q' L+ X5 S' J4 z我猜應該是在always和呼叫連結不起來的問題 卻不知道如何下手1 J4 {, l8 a u- S- H
ncvlog: *W,FAAOP1 (shift.v,49|7): task or function call does not specify all formal output arguments [10.2.2][10.3(IEEE)].
0 Z5 ?% U' [( |1 Eoutput [7:0] mout;5 S) s5 H T+ H6 S5 Y& p. g
|
$ ~9 a$ v5 K* l+ v. F8 Kncvlog: *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)].
* d9 w# P, L8 i q0 F: y' umultdiv8(right,indata,mout);* `0 n, r6 Q3 j$ V: Y0 u
|$ l p' ^7 Q0 | a! \7 g
ncvlog: *W,FAAOP1 (shift.v,51|7): task or function call does not specify all formal output arguments [10.2.2][10.3(IEEE)].
1 ]# V: V. H8 V! \( routput [7:0] mout;
+ ^, h' G& s& Z( h. [/ p
B4 Q% W6 x5 U: G- k T" f/ E \3 S7 H2 K
原本的code:' X/ {) ^: l( d( u/ J5 B3 K
2 y& N8 f: E$ ?$ z# lmodule shift(indata,qout,mout);
1 }( ^% K$ {& a8 E# l( K3 k8 g4 ^& ~, c1 u* S& U6 d
output [7:0] qout;! H6 M9 c* t. I) y
output [7:0] mout;# z: {% j' B! A; Y
input [7:0] indata;
* F; Z( m1 U' d( H- Y9 K6 \: _' D Y1 d9 V1 y' G) a$ j/ X
reg [7:0] qout;' n1 F" F0 @3 ^ k1 L2 }
reg [7:0] mout;
- W9 Z# h7 }6 V& ^0 q* {0 T+ `) sparameter left=1;
4 \% S& O& D K3 Uparameter right=0;
2 d5 J- [0 d6 C& B' K+ i* Q' T, I% @( S/ a
always@(indata)/ W, m, h& H5 D! X: o/ j
@# j O/ H) k2 A/ \
begin
6 L* x! j2 Z8 {, G) ~* @7 d* M$ E5 l1 D
mout=multdiv8 (left,indata);; p9 n! E' R# j" d _
qout=multdiv8 (right,indata);
# ?" o. _2 F3 Z6 Y
5 {/ }8 s: n! d* J! B( qend
' z3 ]2 p8 W% F
7 @# _, c Z) |9 O6 h* m( O0 l5 K* I+ z7 vfunction [7:0] multdiv8;
" e/ z! v. s5 Z! B4 ^5 p8 }3 m$ X, P: }+ l/ k+ |
input fcn_left :2 z x5 S/ H, d7 ^# y" `; c
input[7:0] fcn_in;" ^$ |* K# g: w$ \- u
begin7 i5 l$ m( y3 z
multdiv8=(fcn_left==1)?(fcn_in<<3): (fcn_in>>3);# K% ]8 Y2 D6 c- p; m
end$ U9 _9 n* P: J' j
endfunction
2 ?4 c2 |( W9 W# M$ h
# i0 C4 P" ^* m% ~endmodule
) C) K" q0 t6 U2 i' c" p. Y# K& C6 h- D( H! N
以下是我自己寫的 & J5 U4 T: ?3 b, ~
* `' e: C, B4 Y( M M7 {7 H6 L7 [: I
module (qout, mout,indata);
* Z8 D) w; f R! p9 P1 v- T2 k' f/ }8 \$ ^. L
output [7:0] qout;
3 B6 n0 m4 N* W, _# Ooutput [7:0] mout;
1 m' c8 Y" A' i. ?input [7:0] indata;
6 O- C: {; E6 `0 Lreg [7:0] qout;, ~; {4 o% l% c" V, I6 l& h0 Y2 k' I
reg [7:0] mout;2 l8 p8 y K5 L! `
parameter left=1;
6 F4 z: p6 F9 R# U: Zparameter right=0;
" G$ M, @4 M7 s. d/ Y) M
& P+ Y6 X8 K" I Galways@(indata) begin
3 q7 {* f7 k1 f0 W8 W1 q+ B, h7 v2 O) O
multdiv8 (left,indata,qout);
$ K; v+ w5 f7 O$ y4 `- zmultdiv8 (right,indata,mout);
) t. D' J+ e0 n9 u* k1 _: j; I! y. h# t" |" P! i' E
end) D- g! |; X4 e7 v+ r: N# i0 o
: V' m# N7 K! D% A' |6 A
task multdiv8;
$ |( }4 \1 C8 ]3 k- T: g' V5 x6 n1 W3 ^0 T
input fcn_left;" | {2 j7 O3 T7 f7 F
input [7:0] fcn_in;# A# \( ~. t; B
output [7:0] qout;/ s I8 K: _# |0 [
output [7:0] mout;: h1 G4 k7 Y1 ?( X- G
" T7 B" |7 d3 p1 C4 \. P) Z9 ^8 I2 t
9 B8 e" o7 S9 I1 L; M9 Aif (fcn_left==1)7 a5 J6 F, l/ F. j' G
qout=fcn_in<<3;
1 k: _) h5 ?% t# ~ ]else
! f% z6 n4 N! ]. n% J7 mmout=fcn_in>>3;9 r W! }3 O# R! k6 ~( g; H
# w; B5 Q! ?$ u ]7 p5 x
endtask
" H0 k6 H; _% u" V. D8 p! Kendmodule |
|