|
小弟我是新手 想把呼叫function函數改成呼叫task 但不知道是哪邊有問題會一值出現 希望高手們能幫我一下
9 \' `1 W! x: t: a$ w我猜應該是在always和呼叫連結不起來的問題 卻不知道如何下手
. @5 T8 W* ~! a0 Dncvlog: *W,FAAOP1 (shift.v,49|7): task or function call does not specify all formal output arguments [10.2.2][10.3(IEEE)].# v. ^- m3 c5 J: y/ ~- I
output [7:0] mout;( a9 n1 @; T/ o( m, C9 Q+ h
|
$ N0 M1 v/ ^- U8 D0 V1 `. {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)].
2 M% B& f' q! a% U1 B& omultdiv8(right,indata,mout);
: M- e3 _7 ?% P. P0 t: ^3 h, ?9 S |
8 u8 s; }. ~ x" v. O0 d# _ncvlog: *W,FAAOP1 (shift.v,51|7): task or function call does not specify all formal output arguments [10.2.2][10.3(IEEE)].6 S* R7 [. j8 g' E
output [7:0] mout;
: _# y" N/ G' s3 b ?2 L$ b
- v' c4 ]. Y6 h1 l
6 o% Z: f# c, Q1 t& D- H4 t4 q' n原本的code:! x! N$ Z2 f0 v" E- _
$ D U$ _5 j( b, ?) f
module shift(indata,qout,mout);4 w8 {9 x1 m! `, u$ ~$ r$ y) \
8 G" P& c5 q7 k/ g0 H) `: E2 O
output [7:0] qout;+ d. e' n4 T0 x
output [7:0] mout;
9 N7 H) _% e% m; P& Binput [7:0] indata;
) H4 H* n+ |* v9 b* A
5 d% D$ `4 {/ |reg [7:0] qout;
- ]! M2 u8 y4 a) ^8 y% d; q preg [7:0] mout;
( U- O3 p3 N( u' Tparameter left=1;% o7 A( Z( R0 g
parameter right=0;! ?1 w0 m' k) S" _1 z+ r
' S: {, E" R9 H$ halways@(indata)3 M( e/ b$ c2 u5 ~1 a) ~7 c
p x; l" t* y: s% Pbegin
) Q- n; W( i% E% F1 N+ K/ Q T+ o& t" w1 ~2 s* z
mout=multdiv8 (left,indata);
; k3 H4 C. V5 q+ L. Oqout=multdiv8 (right,indata);9 i" _0 l3 J8 m1 C( \8 _5 x
2 \' f: W' y# O2 `3 @) Q: H
end+ @7 A* |9 t& d9 `# E
. O+ c- p& [) I% S
function [7:0] multdiv8;) R( B* Y: S" y- Z0 T" z
& i5 |- [% S9 A% G/ A
input fcn_left :
% {) i+ u! \- _) B$ w! u3 E) G- }4 binput[7:0] fcn_in;; z! K a C3 @7 h
begin
8 y: G) {9 f9 ~, L" |9 X multdiv8=(fcn_left==1)?(fcn_in<<3): (fcn_in>>3);, I% L( H: [) P( H
end6 E4 e+ l) g6 L S1 x1 l z$ b
endfunction
+ g3 |! ]! l! l$ ?: m+ v* N$ G9 Q6 ~
endmodule
% M! N5 v5 ^& u, r
b9 U$ u5 N2 O7 ]" S1 e+ [" \以下是我自己寫的 ; ]2 L1 Y U b+ p3 O
- a6 ?0 C3 @% F5 i8 pmodule (qout, mout,indata);
) m, b7 C: w( k- R
4 m' `+ A8 q7 soutput [7:0] qout;7 X& o2 r u! I" b% s
output [7:0] mout;4 w" l" }3 Z$ E' c
input [7:0] indata;
; q7 j/ q) } e; Y7 Creg [7:0] qout;4 K7 p% j8 m; f7 F
reg [7:0] mout;
+ x: t# u, r, mparameter left=1;; l" Q/ Y5 T& z& v6 d' w
parameter right=0;# b/ z3 ?' k* d+ i
0 z! W5 b( F8 d2 _always@(indata) begin1 P+ J& j( u# f [8 h
' r2 \8 I6 y4 ^3 Q
multdiv8 (left,indata,qout);
3 N3 s$ @( X6 wmultdiv8 (right,indata,mout);0 H; ?! k) n& H' t2 K5 q" `- }
( \, ]$ j! B p
end
' E: e, I0 ^" e9 o& \5 G; M5 G" n$ b) \. R1 I/ W0 M, W l: N+ B
task multdiv8;. [5 s" X) c& g4 }4 M$ m/ k- ^
\7 F% _1 b h U% ?: |
input fcn_left;
- b" @% Q6 I M2 h$ Binput [7:0] fcn_in;7 o) d. {" U4 h9 `. R$ E1 [
output [7:0] qout;
! I" H4 Q) u: d; ^- a1 l) voutput [7:0] mout;$ s$ r: S$ x1 u; b& Q* T
+ j0 e7 ~8 a, g0 o; \) h2 r! m- M$ U% A
+ x9 F& V# t( a' L" R7 C$ l- y1 V/ W+ ]if (fcn_left==1)
7 i7 B( v( t! u# u; hqout=fcn_in<<3;7 S4 V# L* K# B" q6 Y1 c
else
( P0 h: z) ~/ amout=fcn_in>>3;
: K% P+ `+ _5 S" U4 \: F
' d( C5 g, j7 k, q+ R: Q0 pendtask F7 Z* M- I( P( Y o: {) m
endmodule |
|