SRLC16.v
948 Bytes
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
// $Header: /root/leakn64/depot/rf/hw/debug/xilinx/SRLC16.v,v 1.1 2003/04/01 21:47:36 berndt Exp $
/*
FUNCTION : 16 bit Shift Register LUT w/ Carry
*/
`timescale 100 ps / 10 ps
module SRLC16 (Q, Q15, A0, A1, A2, A3, CLK, D);
parameter INIT = 16'h0000;
output Q, Q15;
input A0, A1, A2, A3, CLK, D;
reg [5:0] count;
reg [15:0] data;
wire [3:0] addr;
wire q_int;
buf b_a3 (addr[3], A3);
buf b_a2 (addr[2], A2);
buf b_a1 (addr[1], A1);
buf b_a0 (addr[0], A0);
buf b_q_int (q_int, data[addr]);
buf b_q (Q, q_int);
buf b_q15_int (q15_int, data[15]);
buf b_q15 (Q15, q15_int);
initial begin
while (CLK === 1'bx)
#2;
for (count = 0; count < 16; count = count + 1)
data[count] <= INIT[count];
end
always @(posedge CLK) begin
{data[15:0]} <= {data[14:0], D};
end
specify
(CLK => Q) = (1, 1);
(CLK => Q15) = (1, 1);
endspecify
endmodule