x393
1.0
FPGAcodeforElphelNC393camera
varlen_encode_snglclk.v
Go to the documentation of this file.
1
39
40
module
varlen_encode_snglclk
(
41
input
clk
,
// posedge
42
input
[
11
:
0
]
d
,
// 12-bit 2-s complement
43
output
reg
[
3
:
0
]
l
,
// [3:0] code length, latency 2 clocks
44
output
reg
[
10
:
0
]
q
);
// [10:0] literal, latency = 2 clocks
45
46
reg
[
11
:
0
]
d1
;
47
48
wire
this0
= |
d1
[
3
:
0
];
49
wire
this1
= |
d1
[
7
:
4
];
50
wire
this2
= |
d1
[
10
:
8
];
51
wire
[
1
:
0
]
codel0
= {|
d1
[
3
:
2
],
d1
[
3
] || (
d1
[
1
] & ~
d1
[
2
])};
52
wire
[
1
:
0
]
codel1
= {|
d1
[
7
:
6
],
d1
[
7
] || (
d1
[
5
] & ~
d1
[
6
])};
53
wire
[
1
:
0
]
codel2
= {|
d1
[
10
], (
d1
[
9
] & ~
d1
[
10
])};
54
wire
[
3
:
0
]
codel
=
this2
? {
2'b10
,
codel2
[
1
:
0
]} :
55
(
this1
? {
2'b01
,
codel1
[
1
:
0
]} :
56
(
this0
? {
2'b00
,
codel0
[
1
:
0
]} :
4'b1111
));
// after +1 will be 0;
57
58
always
@(
posedge
clk
)
begin
59
d1
[
11
] <=
d
[
11
];
60
d1
[
10
:
0
] <=
d
[
11
] ? -
d
[
10
:
0
] :
d
[
10
:
0
];
61
62
q
[
10
:
0
] <=
d1
[
11
] ? ~
d1
[
10
:
0
] :
d1
[
10
:
0
];
63
l
<=
codel
[
3
:
0
]+
1
;
// needed only ASAP, valid only 2 cycles after start
64
65
end
66
67
endmodule
varlen_encode_snglclk.3109clk
3109clk
Definition:
varlen_encode_snglclk.v:41
varlen_encode_snglclk.3110d
[11:0] 3110d
Definition:
varlen_encode_snglclk.v:42
varlen_encode_snglclk.3112q
reg [10:0] 3112q
Definition:
varlen_encode_snglclk.v:44
varlen_encode_snglclk.3118codel1
3118codel1wire[1:0]
Definition:
varlen_encode_snglclk.v:52
varlen_encode_snglclk.3119codel2
3119codel2wire[1:0]
Definition:
varlen_encode_snglclk.v:53
varlen_encode_snglclk.3113d1
3113d1reg[11:0]
Definition:
varlen_encode_snglclk.v:46
varlen_encode_snglclk.3114this0
3114this0wire
Definition:
varlen_encode_snglclk.v:48
varlen_encode_snglclk.3120codel
3120codelwire[3:0]
Definition:
varlen_encode_snglclk.v:54
varlen_encode_snglclk.3117codel0
3117codel0wire[1:0]
Definition:
varlen_encode_snglclk.v:51
varlen_encode_snglclk
Definition:
varlen_encode_snglclk.v:40
varlen_encode_snglclk.3115this1
3115this1wire
Definition:
varlen_encode_snglclk.v:49
varlen_encode_snglclk.3116this2
3116this2wire
Definition:
varlen_encode_snglclk.v:50
varlen_encode_snglclk.3111l
reg [3:0] 3111l
Definition:
varlen_encode_snglclk.v:43
compressor_jp
varlen_encode_snglclk.v
Generated by
1.8.12