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

Subversion Repositories cxd9731

[/] [cxd9731/] [Reg38.v] - Blame information for rev 5

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 5 regttycomi
`timescale 1ns / 1ps
2
//////////////////////////////////////////////////////////////////////////////////
3
// Company: 
4
// Engineer: 
5
// 
6
// Create Date:    12:24:03 11/08/2008 
7
// Design Name: 
8
// Module Name:    Reg38 - Behavioral 
9
// Project Name: 
10
// Target Devices: 
11
// Tool versions: 
12
// Description: 
13
//
14
// Dependencies: 
15
//
16
// Revision: 
17
// Revision 0.01 - File Created
18
// Additional Comments: 
19
//
20
//////////////////////////////////////////////////////////////////////////////////
21
 
22
//// Uncomment the following library declaration if instantiating
23
//// any Xilinx primitives in this code.
24
//library UNISIM;
25
//use UNISIM.VComponents.all;
26
////- Reg0038 has the following bits being mapped
27
////    bcIRQ   cDQ     cDK     iIRQ    iDQ     ibDK    Mo86    Mo87            
28
////    1               0                0                0                0                1               0060    ----    // bus idle
29
////    1               0                0                0                1               0                0020    ----    // IDE side doing transaction buffer not full
30
////    1               0                0                0                1               0                ----    0020    // IDE side doing transaction buffer not full
31
////    1               1               0                0                1               0                ----    00A0    // IDE side doing transaction and buffer full
32
////    1               1               0                0                1               1               ----    0050    // just start DMA and drive not responding
33
////    1               1               0                0                1               0                0021,23,24      // buffer size
34
////    1               1               0                1               0                1               0021,22         // fixed ???
35
////==================================================
36
////  Design base on above measurements : note the {} value is iDK = NOT(ibDK)
37
////    cDQ     cDK     iIRQ    iDQ     ibDK    Mo86    Mo87            
38
////    x               x               1               x               x               21 for NOT(UDMA) 22 for UDMA
39
////    1               0                0                x               0{1}    buffer size (21,23,24,...27)
40
////    1               0                0                1               1{0}    -               50
41
////    0                x               0                0                x               60      bus idle
42
////    0                x               0                1               x               20 if buffer not full
43
////    0                x               0                1               x               A0 if buffer full
44
 
45
module Reg38(
46
        input UDMAC             ,
47
        input PS2WrIDE  ,
48
        input iIRQ              ,
49
        input cDQ               ,
50
        input iDQ               ,
51
        input iDK               ,
52
        input BufEmpty          ,
53
        input PB_HvSpace        ,               // Port A have space
54
        input [3:0] BufSize      ,
55
        output [7:0] DOut
56
);
57
 
58
/// Start of Register 38
59
 
60
wire [7:0] R381;
61
wire [7:0] W381;
62
wire WCond1;
63
wire WCond2,WCond2A,WCond2B1,WCond2B2;
64
wire WCond3;
65
//wire WCond3A,WCond3B;
66
//wire RCond1,RCond2;
67
wire Activity;
68
 
69
assign Activity = cDQ | iIRQ | iDQ | iDK | BufSize[3] | BufSize[2] | BufSize[1] | BufSize[0];    // if there is no DMA activity
70
//assign R381[7:2]      = 6'b00_1000; // fix as 2x
71
//assign R381[1]                = BufSize[2] | BufSize[1];
72
//assign R381[0]                = BufSize[2] | BufSize[0];
73
assign R381[7]  = 1'b0;         // always zero
74
assign R381[6] = ~Activity;     // no activity will be high
75
assign R381[5:4] = 2'b10;               // set as 2
76
assign R381[3:0] = BufSize[3:0];
77
 
78
assign W381[7:0] =
79
        (BufSize[3:0] == 4'b1000) ? 8'h20 :              // no space left, the buffer is full
80
        (BufSize[3:0] == 4'b0111) ? 8'h21 :              // one page has been taken, so one space left
81
        (BufSize[3:0] == 4'b0110) ? 8'h22 :              // two page taken
82
        (BufSize[3:0] == 4'b0000) ? 8'h24 :              // buffer empty
83
                                                                                 8'h23;         // otherwise
84
//assign W381[1]                = ~(BufSize[2] & BufSize[1]);
85
//assign W381[0]                = ~(BufSize[2] & BufSize[1] & BufSize[0]);
86
//assign W381[1]                = BufSize[2];                                           // take 0304 it representing very little space
87
//assign W381[0]                = PB_HvSpace;
88
//assign RCond1 = ~(PS2WrIDE) & ~(Activity);                    // DMA reading and bus not active
89
//assign RCond2 = ~(PS2WrIDE) & Activity;               // DMA reading and bus active
90
assign WCond1   = PS2WrIDE & ~(PB_HvSpace);                     // if there is no space in buffer
91
assign WCond2   = PS2WrIDE & ~(iDK);                    // bus active but drive side no transfer request
92
assign WCond2A  = WCond2 & BufEmpty;                                                            // we don't have data in output register
93
assign WCond2B1 = WCond2 & ~(BufEmpty) & UDMAC;                 // if there is data and we are UDMA mode, report as "22"
94
assign WCond2B2 = WCond2 & ~(BufEmpty) & ~(UDMAC);      // if there is data and we are MDMA mode, report as "21"
95
assign WCond3   = PS2WrIDE & iDK;                               // if there is drive side transfer, PS2 writing data to drive
96
//assign WCond3A        = WCond3 & BufEmpty;
97
//assign WCond3B        = WCond3 & ~(BufEmpty); // if something in buffer
98
 
99
 
100
assign DOut     =
101
//// 86 mode, PortA input, Port B output data //
102
//      (RCond1 == 1'b1) ? 8'h60 :
103
//      (RCond2 == 1'b1) ? R381  :
104
        (PS2WrIDE == 1'b0) ? R381 :             // PS2WrIDE = 0, reading from drive
105
//// 87 mode, PortB input, Port A output data //
106
        (WCond1 == 1'b1) ? 8'hA0 :              // if no space in buffer B, then buffer is full
107
//// if PortA have no transaction, iDK = 0 then
108
        (WCond2A        == 1'b1) ? 8'h50 :              // if bufferA is absolutely empty
109
        (WCond2B1 == 1'b1) ? 8'h22 :    // if bufferA is not empty
110
        (WCond2B2 == 1'b1) ? 8'h21 :
111
//// if PortA have transaction, iDK = 1
112
        (WCond3 == 1'b1) ? W381 :
113
//      (WCond3A        == 1'b1) ? 8'h24 :              // plenty of buffer space
114
//      (WCond3B        == 1'b1) ? W381 :
115
        8'hFF;
116
///////// end of reg38 ////////////////////////////
117
 
118
endmodule

powered by: WebSVN 2.1.0

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