|
小弟我是新手 想把呼叫function函數改成呼叫task 但不知道是哪邊有問題會一值出現 希望高手們能幫我一下 7 G8 N( }7 ^# S5 O2 w5 U) d
我猜應該是在always和呼叫連結不起來的問題 卻不知道如何下手; ?1 M/ \" b" F1 ~
ncvlog: *W,FAAOP1 (shift.v,49|7): task or function call does not specify all formal output arguments [10.2.2][10.3(IEEE)].
! c$ N' R8 H9 Houtput [7:0] mout;% U! W1 z5 B; |
|
4 j3 }* l* ~6 }. [; Lncvlog: *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)].3 M$ Y; q7 a( x! R2 U
multdiv8(right,indata,mout);0 ~/ b1 Y, \; R2 z/ T7 T
|
/ j4 r$ Q' y8 ]+ B- Zncvlog: *W,FAAOP1 (shift.v,51|7): task or function call does not specify all formal output arguments [10.2.2][10.3(IEEE)].) `0 ^: X/ i% G' s. x
output [7:0] mout; ?2 q8 i6 x6 I- l* t* r
+ v& Z' L- ~' u7 z" k5 F; M
6 M1 f8 k; |% ^2 u3 T; i, }8 ]原本的code:
( H% T/ A+ i% g3 c+ _- L% g7 Y: o. c6 p. X
module shift(indata,qout,mout);/ G& F& A- _' Q; |
9 m) @3 ?4 }# G1 Y3 D1 ` L0 U
output [7:0] qout;% K5 D9 d7 ]3 D k; K1 D, V, a4 l% e
output [7:0] mout;9 Z% }( w7 g- @- D' W% p
input [7:0] indata;5 ]2 ~' u; i: m! U, Q
0 ]% ], W) \6 o/ o% K9 K1 r' N3 Xreg [7:0] qout;% O+ |, ]/ ^0 A& j2 G# }+ l
reg [7:0] mout;
5 q! f+ j% P7 jparameter left=1;+ `1 D. Q h7 ^/ L, V
parameter right=0;
8 L6 v) J+ x Q5 M1 J: g
; ~& z; {6 p7 q0 {& g$ H3 \; Malways@(indata)6 x0 D, n0 A* r$ l* f
& f8 q G3 v& O8 c4 ^- Rbegin, g. ~1 U' m. N3 P: G
+ F( E" F4 f) _) D! c
mout=multdiv8 (left,indata);
, }% {/ i' `; f5 Rqout=multdiv8 (right,indata);7 q$ x4 d9 o) |4 T. Q
) y6 P y! L+ S( I4 Lend+ J7 B4 I$ {: |" ?/ T3 r4 _
: ~+ t4 B- u4 r
function [7:0] multdiv8;
1 ~& m/ `# b8 P0 N: ]7 z$ x, ]" E( L
input fcn_left :
& r0 X$ z( w6 V4 v. einput[7:0] fcn_in;; y7 o4 b7 @6 D
begin
# t4 t. K" U, e, {, A. ^& H' _; f multdiv8=(fcn_left==1)?(fcn_in<<3): (fcn_in>>3);
- X* {/ i' D2 |* [% C' ^end
: @4 Y! @; Q5 H, tendfunction
{' a5 R- p8 A+ ?8 A' g% b5 i, P
endmodule W: B- Q6 ]) T- A* j5 F* ]
+ S% I4 r3 |) X6 ?& s1 H
以下是我自己寫的
. S. q( C$ ^7 n4 i
* c0 ^, W& ?9 C% Z. Gmodule (qout, mout,indata);% m8 }6 a' i8 M ]+ t
0 }- v1 q5 m2 T+ F( g4 Uoutput [7:0] qout;; x, y4 i% k* o6 i3 c# c' J
output [7:0] mout; {$ O/ v7 H7 _" F7 v" {
input [7:0] indata;2 r) R! z! ]; P
reg [7:0] qout;
: J, ^, R" L: Breg [7:0] mout;
& I0 L( |2 T0 D3 \. ~* X5 yparameter left=1;
0 E/ B5 F( u& L" B, ?parameter right=0;
$ L; ^- R7 V# R8 @6 E7 E a/ E! z" G8 c2 n( i [$ w
always@(indata) begin
' ^3 ?6 V5 \8 s% }$ V9 |
% N9 Y m$ w2 i' Y3 }- h$ umultdiv8 (left,indata,qout);) {4 \4 d: `* H2 Q
multdiv8 (right,indata,mout);) d9 b M" E+ { Y
& g3 B* a8 \" @; x* ~# M# o
end" {9 k6 g+ {+ T% m: J
8 r# A7 E0 k7 @* u% O
task multdiv8;4 u' Z1 w V7 I# B1 G
7 X% D" c& i! Z# P: B
input fcn_left;6 u4 I( J* ~; l8 [1 {! [# O6 X L' R
input [7:0] fcn_in;
7 y$ E; w: M* f2 _" b# toutput [7:0] qout;
" I9 S, C; B# z% M6 aoutput [7:0] mout;2 G. r0 U2 @& i! p
- Z: R3 A& M& ^1 V( Z, Q& {
& e, G1 N% M/ z0 Z: C& Y
if (fcn_left==1)
" p C$ H1 L2 M- {" Yqout=fcn_in<<3;5 j# k3 L- w6 s5 t
else
# I& n& s3 A/ R+ ^) `: \9 ^ @mout=fcn_in>>3;
. t$ _: B K: i% S& Z) K" x
# G* |+ [2 N i7 H0 \ ~; uendtask
% U9 x* h. O/ Y" f. O- P; Wendmodule |
|