vtestena.v
1.03 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
// vtestena.v v1 Frank Berndt
// test enable logic;
// :set tabstop=4
`timescale 1ns/1ns
module vtestena (
sysclk, coldrst_l, v_tread, v_nvout, porst, ena
);
// operational ports;
input sysclk; // system clock;
input coldrst_l; // cold reset;
input v_tread; // read for test enable;
input [31:0] v_nvout; // virage read data;
input porst; // sum of power-on resets;
output ena; // test enable output;
// need a flop with async reset, to protect against missing sysclk;
// enable test mode after read data pattern matches;
// force enable by not-bonded pad, still need sysclk;
wire ena_rst; // sym of async resets;
wire match; // enable pattern matches;
reg ena; // flop with async clear;
reg check; // check virage read data;
assign ena_rst = ~porst & coldrst_l;
assign match = (v_nvout == 32'hbb2002fb);
always @(posedge sysclk)
begin
check <= v_tread;
end
always @(posedge sysclk or negedge ena_rst)
begin
if(ena_rst == 1'b0)
ena <= 1'b0;
else if(check)
ena <= match;
end
endmodule