1 |
2 |
alfik |
//======================================================== conditions
|
2 |
|
|
wire cond_0 = init_done == `FALSE;
|
3 |
|
|
wire cond_1 = invd_counter == 8'd255;
|
4 |
|
|
wire cond_2 = state == STATE_IDLE;
|
5 |
|
|
wire cond_3 = init_done && invddata_do;
|
6 |
|
|
wire cond_4 = init_done && wbinvddata_do;
|
7 |
|
|
wire cond_5 = state == STATE_INVD;
|
8 |
|
|
wire cond_6 = state == STATE_WBINVD;
|
9 |
|
|
wire cond_7 = wbinvd_valid;
|
10 |
|
|
wire cond_8 = writeline_done;
|
11 |
|
|
wire cond_9 = wbinvd_counter == 10'd1023;
|
12 |
|
|
//======================================================== saves
|
13 |
|
|
wire [9:0] wbinvd_counter_to_reg =
|
14 |
|
|
(cond_6 && cond_7 && cond_8)? ( wbinvd_counter_next) :
|
15 |
|
|
(cond_6 && ~cond_7)? ( wbinvd_counter_next) :
|
16 |
|
|
wbinvd_counter;
|
17 |
|
|
wire after_invalidate_to_reg =
|
18 |
|
|
(cond_0 && cond_1)? ( `TRUE) :
|
19 |
|
|
(cond_2)? ( `FALSE) :
|
20 |
|
|
(cond_5 && cond_1)? ( `TRUE) :
|
21 |
|
|
(cond_6 && cond_7 && cond_8 && cond_9)? ( `TRUE) :
|
22 |
|
|
(cond_6 && ~cond_7 && cond_9)? ( `TRUE) :
|
23 |
|
|
after_invalidate;
|
24 |
|
|
wire [7:0] invd_counter_to_reg =
|
25 |
|
|
(cond_0)? ( invd_counter + 8'd1) :
|
26 |
|
|
(cond_5)? ( invd_counter + 8'd1) :
|
27 |
|
|
invd_counter;
|
28 |
|
|
wire [1:0] state_to_reg =
|
29 |
|
|
(cond_2 && cond_3)? ( STATE_INVD) :
|
30 |
|
|
(cond_2 && ~cond_3 && cond_4)? ( STATE_WBINVD) :
|
31 |
|
|
(cond_5 && cond_1)? ( STATE_IDLE) :
|
32 |
|
|
(cond_6 && cond_7 && cond_8 && cond_9)? ( STATE_IDLE) :
|
33 |
|
|
(cond_6 && ~cond_7 && cond_9)? ( STATE_IDLE) :
|
34 |
|
|
state;
|
35 |
|
|
wire init_done_to_reg =
|
36 |
|
|
(cond_0 && cond_1)? ( `TRUE) :
|
37 |
|
|
init_done;
|
38 |
|
|
//======================================================== always
|
39 |
|
|
always @(posedge clk or negedge rst_n) begin
|
40 |
|
|
if(rst_n == 1'b0) wbinvd_counter <= 10'd0;
|
41 |
|
|
else wbinvd_counter <= wbinvd_counter_to_reg;
|
42 |
|
|
end
|
43 |
|
|
always @(posedge clk or negedge rst_n) begin
|
44 |
|
|
if(rst_n == 1'b0) after_invalidate <= 1'd0;
|
45 |
|
|
else after_invalidate <= after_invalidate_to_reg;
|
46 |
|
|
end
|
47 |
|
|
always @(posedge clk or negedge rst_n) begin
|
48 |
|
|
if(rst_n == 1'b0) invd_counter <= 8'd0;
|
49 |
|
|
else invd_counter <= invd_counter_to_reg;
|
50 |
|
|
end
|
51 |
|
|
always @(posedge clk or negedge rst_n) begin
|
52 |
|
|
if(rst_n == 1'b0) state <= 2'd0;
|
53 |
|
|
else state <= state_to_reg;
|
54 |
|
|
end
|
55 |
|
|
always @(posedge clk or negedge rst_n) begin
|
56 |
|
|
if(rst_n == 1'b0) init_done <= 1'd0;
|
57 |
|
|
else init_done <= init_done_to_reg;
|
58 |
|
|
end
|
59 |
|
|
//======================================================== sets
|
60 |
|
|
assign wbinvddata_done =
|
61 |
|
|
(cond_6 && cond_7 && cond_8 && cond_9)? (`TRUE) :
|
62 |
|
|
(cond_6 && ~cond_7 && cond_9)? (`TRUE) :
|
63 |
|
|
1'd0;
|
64 |
|
|
assign writeline_do =
|
65 |
|
|
(cond_6 && cond_7)? (`TRUE) :
|
66 |
|
|
1'd0;
|
67 |
|
|
assign wbinvdread_address =
|
68 |
|
|
(cond_2 && ~cond_3 && cond_4)? ( wbinvd_counter[9:2]) :
|
69 |
|
|
(cond_6 && cond_7 && cond_8)? ( wbinvd_counter_next[9:2]) :
|
70 |
|
|
(cond_6 && cond_7 && ~cond_8)? ( wbinvd_counter[9:2]) :
|
71 |
|
|
(cond_6 && ~cond_7)? ( wbinvd_counter_next[9:2]) :
|
72 |
|
|
8'd0;
|
73 |
|
|
assign wbinvdread_do =
|
74 |
|
|
(cond_2 && ~cond_3 && cond_4)? (`TRUE) :
|
75 |
|
|
(cond_6 && cond_7 && cond_8)? (`TRUE) :
|
76 |
|
|
(cond_6 && ~cond_7)? (`TRUE) :
|
77 |
|
|
1'd0;
|
78 |
|
|
assign writeline_line =
|
79 |
|
|
(cond_6 && cond_7)? ( wbinvd_line[127:0]) :
|
80 |
|
|
128'd0;
|
81 |
|
|
assign start_wbinvd =
|
82 |
|
|
(cond_2 && ~cond_3 && cond_4)? (`TRUE) :
|
83 |
|
|
1'd0;
|
84 |
|
|
assign invddata_done =
|
85 |
|
|
(cond_5 && cond_1)? (`TRUE) :
|
86 |
|
|
1'd0;
|
87 |
|
|
assign writeline_address =
|
88 |
|
|
(cond_6 && cond_7)? ( { wbinvd_line[147:128], wbinvd_counter[9:2], 4'd0 }) :
|
89 |
|
|
32'd0;
|
90 |
|
|
assign wbinvd_write_control =
|
91 |
|
|
(cond_6 && cond_7 && cond_8)? ( wbinvd_counter[1:0] == 2'd3) :
|
92 |
|
|
(cond_6 && ~cond_7)? ( wbinvd_counter[1:0] == 2'd3) :
|
93 |
|
|
1'd0;
|