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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [or1k_startup/] [rtl/] [verilog/] [flash_wb_32x32.v] - Blame information for rev 857

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 marcus.erl
module flash_wb_1k (
2
        wb_adr_i, wb_cyc_i, wb_stb_i, wb_dat_o, wb_ack_o, clk, rst );
3
 
4
input  [4:0]  wb_adr_i;
5
input         wb_cyc_i;
6
input         wb_stb_i;
7
output [31:0] wb_dat_o;
8
reg    [31:0] wb_dat_o;
9
output        wb_ack_o;
10
reg           wb_ack_o;
11
input         clk;
12
input         rst;
13
 
14
reg [3:0]     counter;
15
wire [7:0]    do;
16
 
17
parameter [31:0] NOP = 32'h15000000;
18
 
19
always @ (posedge rst or posedge clk)
20
if (rst)
21
        counter <= 4'd0;
22
else
23
        if (wb_cyc_i & wb_stb_i & !wb_ack_o)
24
                counter <= counter + 4'd1;
25
 
26
always @ (posedge rst or posedge clk)
27
if (rst)
28
        wb_ack_o <= 1'b0;
29
else
30
        wb_ack_o <= (counter == 4'd15);
31
 
32
always @ (posedge rst or posedge clk)
33
if (rst)
34
        wb_dat_o <= NOP;
35
else
36
        case (counter)
37
        4'd15: wb_dat_o[31:24] <= do;
38
        4'd11: wb_dat_o[23:16] <= do;
39
        4'd7: wb_dat_o[15: 8] <= do;
40
        4'd3: wb_dat_o[ 7: 0] <= do;
41
        endcase
42
 
43
 
44
flash flash0 (
45
        .CLK  (counter[1] ^ counter[0]),
46
        .ADDR ({wb_adr_i,counter[3:2]}),
47
        .DOUT (do));
48
 
49
endmodule

powered by: WebSVN 2.1.0

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