dplod000s.vmd
2.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
/**************************************************************/
/* Verilog module of datapath cell DPLOD000s */
/* Designed by Lin Yang VLSI Technology Oct. 20, 90 */
/* Designed by Linda J. Xu Compass Oct. 27, 92 */
/* */
/* The following is the port description */
/* Data ports */
/* IN : the input port */
/* OUT : the output port */
/* Control ports */
/* INST_ZERO : the zero detect flag */
/* Parameters */
/* WORDSIZE : the word size of the datapath cell */
/* ALL_ZERO_OK : the flag for the all zero input case */
/* DELAY : the delay time from input to output */
/* BF : the with/without buffer flag */
/* 0 for without buffer; 1 for with buffer */
/**************************************************************/
module dplod000s(IN, OUT, INST_ZERO);
parameter WORDSIZE = 8, ALL_ZERO_OK = 0, DELAY = 4, BF = 1;
input [WORDSIZE-1:0] IN;
output [WORDSIZE-1:0] OUT;
output INST_ZERO;
function [WORDSIZE:0] lod;
input [WORDSIZE-1:0] X;
integer i, counter;
begin
i = WORDSIZE;
counter = 0;
lod = {WORDSIZE+1{1'b0}};
while (i>0)
begin
i = i - 1;
case (X[i])
'b1:
begin
lod[i] = 'b 1;
i = 0;
end
'b0: counter = counter + 1;
default
begin
lod = {WORDSIZE+1{1'bx}};
i = 0;
end
endcase
end
if (counter == WORDSIZE)
begin
lod[WORDSIZE] = 'b 1;
if (ALL_ZERO_OK == 0)
lod[WORDSIZE-1] = 'b 1;
end
end
endfunction
assign #DELAY {INST_ZERO, OUT} = lod(IN);
endmodule