|
小弟我是新手 想把呼叫function函數改成呼叫task 但不知道是哪邊有問題會一值出現 希望高手們能幫我一下 ; o! @! p6 d8 P" c7 ]0 L9 @- @9 ?# a
我猜應該是在always和呼叫連結不起來的問題 卻不知道如何下手2 }, j) R* K d# t# @$ k
ncvlog: *W,FAAOP1 (shift.v,49|7): task or function call does not specify all formal output arguments [10.2.2][10.3(IEEE)].
, n! o7 Z- h/ ~8 a2 h; noutput [7:0] mout;; Q6 ~9 f N" s6 I
|
% p- T1 X; A" Tncvlog: *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)].
4 c/ q6 x# x& tmultdiv8(right,indata,mout);
+ b7 X$ d( q" c0 O0 H, i2 Q |" Y/ e2 O0 |" @% S2 v0 u
ncvlog: *W,FAAOP1 (shift.v,51|7): task or function call does not specify all formal output arguments [10.2.2][10.3(IEEE)].
l# X( k1 p8 Xoutput [7:0] mout;; j( x! c5 S' D3 r0 ^3 \
" ^) Z& s/ ]" S/ U/ ?: r
# u! S% @& S) `; I! M原本的code:1 n, k! h7 |. _% E4 Z
7 R7 p6 S" q/ f+ y* T) Qmodule shift(indata,qout,mout);
, b) |# v. @4 R9 t' m& ^* J4 H a N2 W5 G+ _5 b7 j' A* G
output [7:0] qout;
2 X! B t5 K# B' Toutput [7:0] mout;9 z6 `& Z3 \5 R7 _+ U
input [7:0] indata;
6 d( k( g& w' C2 W8 v9 b* e7 D' B$ r5 [
reg [7:0] qout;+ k3 B- R k) j6 D
reg [7:0] mout;) q& {% l" J& H0 F
parameter left=1;
7 s+ g% t& x6 ` eparameter right=0;
; Q9 p0 N1 e) Y% ]' @3 O0 O1 E) }: g7 J1 ]# d9 L' y! |$ G
always@(indata). |# J* X* V2 {4 k& @
6 w& Q) K" @& G8 u3 bbegin: o: ^9 O' x9 M# b7 A
+ ~' X# B1 F+ E0 _
mout=multdiv8 (left,indata);4 x7 |! ]7 D, ]
qout=multdiv8 (right,indata);# }$ e `- x" s! d( C9 ?
% u* ?2 s- n l9 @- m
end7 L+ h& v; I. s7 G! U+ G) r1 F
8 Y/ C" \& G8 P* r1 r7 rfunction [7:0] multdiv8;# K4 L; r% X. k) \7 w
) H" B" T# K+ H' k/ T% @# Y
input fcn_left :- r1 E. D4 _) m; h. E$ C+ L+ Z# {
input[7:0] fcn_in; b5 o$ f P! |; n9 A) {) b
begin
% h* X" G7 F& a8 P+ H4 h$ ~ multdiv8=(fcn_left==1)?(fcn_in<<3): (fcn_in>>3);
( h$ ^! D# S0 l' v- b: M8 V& n, Q2 Lend9 w9 w3 j1 t8 ~) n; F1 Q0 ^
endfunction; x0 n3 A9 c& R
! ?* S# A4 J. r9 m3 e3 [! |endmodule
E! y& F# K7 D8 N& z% ]
6 @# h k7 w. y; z. L, a; ]8 F! C) r: J( o以下是我自己寫的
7 m& W& R N4 V
`' v1 ^% J0 N1 `8 Imodule (qout, mout,indata);1 L1 {- p7 V, d5 \, |
5 m6 i3 v( x9 m# i' e+ a8 R9 K8 ?0 s
output [7:0] qout; P4 V: c e1 M3 D
output [7:0] mout;
, H/ h% @# g0 b9 s vinput [7:0] indata;
# [! s/ |5 O# ureg [7:0] qout;0 W0 D1 ]. D! \8 s% l) w( `
reg [7:0] mout;8 {1 T" X- V; |7 F# ]: L! q
parameter left=1;
A( T! J" Z+ K6 i9 n% Z9 dparameter right=0;
4 }# V5 E" G6 q5 W# _
% X# B4 u$ [' R4 P$ T9 q& galways@(indata) begin, L9 m1 i/ y4 c9 t( C% H$ k
- X {, o7 [7 @1 i l* Ymultdiv8 (left,indata,qout);
! Q ?6 N# `6 f) ^0 t, M$ Z, Z6 ]$ jmultdiv8 (right,indata,mout);
' V9 Y' g; ]- c5 m( `2 P! y& Z3 p( d2 ?
end. o, U6 A; F+ W
; `! | h/ F( F8 f8 F6 |1 h+ _
task multdiv8;8 K* G* m; M. e2 K+ V4 B
/ a( u# F: g' T. h! C$ D9 M% dinput fcn_left;
3 Q. Y. A/ S* k0 P) binput [7:0] fcn_in;
$ B/ g& f/ o4 g- B+ F2 n4 {output [7:0] qout;/ W$ O& h {+ d! V: ?+ T
output [7:0] mout;
- ] ?8 y+ c, Y) q7 G
+ o7 G3 r9 b. o3 K3 G( o0 o' k8 A7 D1 `9 H0 r
if (fcn_left==1)
: G- X8 P/ y* Y2 Vqout=fcn_in<<3;
/ Z" [5 z) D2 L! F+ O; `6 \else
9 ^$ ?9 q8 ?5 l. m& v, Cmout=fcn_in>>3;
9 j6 y/ Y5 _; ^3 i! f5 j+ }6 ]; m$ l" U5 e2 ^9 W
endtask 0 y$ @+ e. R0 f7 o8 e* a9 P0 \
endmodule |
|