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

Subversion Repositories z80control

[/] [z80control/] [trunk/] [CII_Starter_USB_API_v1/] [HW/] [Multi_Flash/] [Flash_Multiplexer.v] - Blame information for rev 12

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 12 tylerapohl
//Legal Notice: (C)2006 Altera Corporation. All rights reserved. Your
2
//use of Altera Corporation's design tools, logic functions and other
3
//software and tools, and its AMPP partner logic functions, and any
4
//output files any of the foregoing (including device programming or
5
//simulation files), and any associated documentation or information are
6
//expressly subject to the terms and conditions of the Altera Program
7
//License Subscription Agreement or other applicable license agreement,
8
//including, without limitation, that your use is for the sole purpose
9
//of programming logic devices manufactured by Altera and sold by Altera
10
//or its authorized distributors.  Please refer to the applicable
11
//agreement for further details.
12
 
13
module Flash_Multiplexer(       //      Host Side
14
                                                        oHS_DATA,iHS_DATA,iHS_ADDR,iHS_CMD,oHS_Ready,iHS_Start,
15
                                                        //      Async Side 1
16
                                                        oAS1_DATA,iAS1_ADDR,
17
                                                        //      Async Side 2
18
                                                        oAS2_DATA,iAS2_ADDR,
19
                                                        //      Async Side 3
20
                                                        oAS3_DATA,iAS3_ADDR,
21
                                                        //      Flash Side
22
                                                        oFL_DATA,iFL_DATA,oFL_ADDR,oFL_CMD,iFL_Ready,oFL_Start,
23
                                                        //      Control Signals
24
                                                        iSelect,iCLK,iRST_n);
25
//      Host Side
26
input   [21:0]   iHS_ADDR;
27
input   [7:0]    iHS_DATA;
28
input   [2:0]    iHS_CMD;
29
input                   iHS_Start;
30
output  [7:0]    oHS_DATA;
31
output                  oHS_Ready;
32
//      Async Side 1
33
input   [21:0]   iAS1_ADDR;
34
output  [7:0]    oAS1_DATA;
35
//      Async Side 2
36
input   [21:0]   iAS2_ADDR;
37
output  [7:0]    oAS2_DATA;
38
//      Async Side 3
39
input   [21:0]   iAS3_ADDR;
40
output  [7:0]    oAS3_DATA;
41
//      Flash Side
42
input   [7:0]    iFL_DATA;
43
input                   iFL_Ready;
44
output  [21:0]   oFL_ADDR;
45
output  [7:0]    oFL_DATA;
46
output  [2:0]    oFL_CMD;
47
output                  oFL_Start;
48
//      Control Signals
49
input   [1:0]    iSelect;
50
input                   iCLK;
51
input                   iRST_n;
52
//      Internal Register
53
reg             [7:0]    mFL_DATA;
54
reg             [1:0]    ST;
55
reg                             mFL_Start;
56
 
57
//      Host Side Select
58
assign  oHS_DATA        =       (iSelect==0)     ?       iFL_DATA        :       8'h00   ;
59
assign  oHS_Ready       =       (iSelect==0)     ?       iFL_Ready       :       1'b1    ;
60
//      ASync Side
61
assign  oAS1_DATA       =       (iSelect==1)    ?       mFL_DATA        :       8'h00   ;
62
assign  oAS2_DATA       =       (iSelect==2)    ?       mFL_DATA        :       8'h00   ;
63
assign  oAS3_DATA       =       (iSelect==3)    ?       mFL_DATA        :       8'h00   ;
64
//      Flash Side
65
assign  oFL_DATA        =       (iSelect==0)     ?       iHS_DATA        :       8'hFF   ;
66
assign  oFL_ADDR        =       (iSelect==0)     ?       iHS_ADDR        :
67
                                                (iSelect==1)    ?       iAS1_ADDR       :
68
                                                (iSelect==2)    ?       iAS2_ADDR       :
69
                                                                                        iAS3_ADDR       ;
70
assign  oFL_CMD         =       (iSelect==0)     ?       iHS_CMD         :       3'b000  ;
71
assign  oFL_Start       =       (iSelect==0)     ?       iHS_Start       :       mFL_Start;
72
 
73
//      mFL_Start Control & Flash Data Lock
74
always@(posedge iCLK or negedge iRST_n)
75
begin
76
        if(!iRST_n)
77
        begin
78
                mFL_DATA        <=0;
79
                mFL_Start       <=0;
80
                ST                      <=0;
81
        end
82
        else
83
        begin
84
                if(iSelect!=0)
85
                begin
86
                        case(ST)
87
                        0:       begin
88
                                        mFL_Start<=1;
89
                                        ST<=1;
90
                                end
91
                        1:      begin
92
                                        if(iFL_Ready)
93
                                        begin
94
                                                mFL_DATA<=iFL_DATA;
95
                                                mFL_Start<=0;
96
                                                ST<=2;
97
                                        end
98
                                end
99
                        2:      ST<=3;
100
                        3:      ST<=0;
101
                        endcase
102
                end
103
                else
104
                begin
105
                        mFL_Start<=0;
106
                        ST<=0;
107
                end
108
        end
109
end
110
endmodule
111
 

powered by: WebSVN 2.1.0

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