OpenCores
URL https://opencores.org/ocsvn/ao486/ao486/trunk

Subversion Repositories ao486

[/] [ao486/] [trunk/] [rtl/] [ao486/] [autogen/] [memory_write.v] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 alfik
//======================================================== conditions
2
wire cond_0 = state == STATE_IDLE;
3
wire cond_1 = length_1 == 3'd1;
4
wire cond_2 = length_1 == 3'd2;
5
wire cond_3 = write_do && ~(wr_reset) && ~(write_page_fault) && ~(write_ac_fault);
6
wire cond_4 = state == STATE_FIRST_WAIT;
7
wire cond_5 = tlbwrite_page_fault || tlbwrite_ac_fault;
8
wire cond_6 = tlbwrite_done && length_2_reg != 3'd0;
9
wire cond_7 = tlbwrite_done;
10
wire cond_8 = reset_waiting == `FALSE;
11
wire cond_9 = state == STATE_SECOND;
12
wire cond_10 = tlbwrite_page_fault || tlbwrite_ac_fault || tlbwrite_done;
13
wire cond_11 = tlbwrite_done && reset_waiting == `FALSE;
14
//======================================================== saves
15
wire [23:0] buffer_to_reg =
16
    (cond_0 && cond_1)? ( write_data[31:8]) :
17
    (cond_0 && ~cond_1 && cond_2)? ( { 8'd0,  write_data[31:16] }) :
18
    (cond_0 && ~cond_1 && ~cond_2)? ( { 16'd0, write_data[31:24] }) :
19
    buffer;
20
wire [31:0] address_2_reg_to_reg =
21
    (cond_0)? ( { address_2[31:4], 4'd0 }) :
22
    address_2_reg;
23
wire [2:0] length_2_reg_to_reg =
24
    (cond_0)? (  length_2) :
25
    length_2_reg;
26
wire [1:0] state_to_reg =
27
    (cond_0 && cond_3)? ( STATE_FIRST_WAIT) :
28
    (cond_4 && cond_5)? ( STATE_IDLE) :
29
    (cond_4 && ~cond_5 && cond_6)? ( STATE_SECOND) :
30
    (cond_4 && ~cond_5 && ~cond_6 && cond_7)? ( STATE_IDLE) :
31
    (cond_9 && cond_10)? ( STATE_IDLE) :
32
    state;
33
//======================================================== always
34
always @(posedge clk or negedge rst_n) begin
35
    if(rst_n == 1'b0) buffer <= 24'd0;
36
    else              buffer <= buffer_to_reg;
37
end
38
always @(posedge clk or negedge rst_n) begin
39
    if(rst_n == 1'b0) address_2_reg <= 32'd0;
40
    else              address_2_reg <= address_2_reg_to_reg;
41
end
42
always @(posedge clk or negedge rst_n) begin
43
    if(rst_n == 1'b0) length_2_reg <= 3'd0;
44
    else              length_2_reg <= length_2_reg_to_reg;
45
end
46
always @(posedge clk or negedge rst_n) begin
47
    if(rst_n == 1'b0) state <= 2'd0;
48
    else              state <= state_to_reg;
49
end
50
//======================================================== sets
51
assign write_done =
52
    (cond_4 && ~cond_5 && ~cond_6 && cond_7 && cond_8)? (`TRUE) :
53
    (cond_9 && cond_11)? (`TRUE) :
54
    1'd0;
55
assign tlbwrite_do =
56
    (cond_0 && cond_3)? (`TRUE) :
57
    (cond_4)? (`TRUE) :
58
    (cond_9)? (`TRUE) :
59
    1'd0;
60
assign tlbwrite_address =
61
    (cond_0)? ( write_address) :
62
    (cond_4)? ( write_address) :
63
    (cond_9)? ( address_2_reg) :
64
    32'd0;
65
assign tlbwrite_length =
66
    (cond_0)? (  length_1) :
67
    (cond_4)? (  length_1) :
68
    (cond_9)? (  length_2_reg) :
69
    3'd0;
70
assign tlbwrite_data =
71
    (cond_0)? (    write_data) :
72
    (cond_4)? (    write_data) :
73
    (cond_9)? (    { 8'd0, buffer }) :
74
    32'd0;

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.