Subversion Repositories pentevo

Rev

Rev 467 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 467 Rev 668
Line 1... Line -...
1
`include "../include/tune.v"
-
 
2
 
-
 
3
// PentEvo project (c) NedoPC 2008-2011
1
// ZX-Evo Base Configuration (c) NedoPC 2008,2009,2010,2011,2012,2013,2014
4
//
2
//
5
// DRAM arbiter. Shares DRAM between processor and video data fetcher
3
// DRAM arbiter. Shares DRAM between processor and video data fetcher
6
//
-
 
7
 
-
 
8
 
4
 
-
 
5
/*
-
 
6
    This file is part of ZX-Evo Base Configuration firmware.
9
 
7
 
-
 
8
    ZX-Evo Base Configuration firmware is free software:
-
 
9
    you can redistribute it and/or modify it under the terms of
-
 
10
    the GNU General Public License as published by
-
 
11
    the Free Software Foundation, either version 3 of the License, or
-
 
12
    (at your option) any later version.
-
 
13
 
-
 
14
    ZX-Evo Base Configuration firmware is distributed in the hope that
-
 
15
    it will be useful, but WITHOUT ANY WARRANTY; without even
-
 
16
    the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-
 
17
    See the GNU General Public License for more details.
-
 
18
 
-
 
19
    You should have received a copy of the GNU General Public License
-
 
20
    along with ZX-Evo Base Configuration firmware.
-
 
21
    If not, see <http://www.gnu.org/licenses/>.
-
 
22
*/
10
 
23
 
11
 
24
 
12
// 14.06.2011:
25
// 14.06.2011:
13
// removed cpu_stall and cpu_waitcyc.
26
// removed cpu_stall and cpu_waitcyc.
14
// changed cpu_strobe behavior (only strobes read data arrival now).
27
// changed cpu_strobe behavior (only strobes read data arrival now).
15
// added cpu_next signal (shows whether next DRAM cycle CAN be grabbed by CPU)
28
// added cpu_next signal (shows whether next DRAM cycle CAN be grabbed by CPU)
16
//
29
//
17
// Now it is a REQUIREMENT for 'go' signal only starting and ending on
30
// Now it is a REQUIREMENT for 'go' signal only starting and ending on
18
// beginning of DRAM cycle (i.e. right after 'cend' strobe).
31
// beginning of DRAM cycle (i.e. right after 'cend' strobe).
19
//
-
 
20
 
32
 
21
 
33
 
22
// 13.06.2011:
34
// 13.06.2011:
23
// ╧Ёшф╕Єё  яюЄЁхсютрЄ№, ўЄюс go єёЄрэртыштрыё  ёЁрчє яюёых cend (є ьхэ  [lvd] ¤Єю Єръ).
35
// Придётся потребовать, чтоб go устанавливался сразу после cend (у меня [lvd] это так).
24
// ¤Єю фы  Єюую, ўЄюс√ яЁюЎхёёюЁ эр 14ьуЎ ьюу чрЁрэхх ш т ы■сющ ьюьхэЄ чэрЄ№, эр
36
// это для того, чтобы процессор на 14мгц мог заранее и в любой момент знать, на
25
// ёъюы№ъю чртхщЄшЄ№ё . ┬ьхёЄю cpu_ack ттхфхь фЁєующ ёшуэры, ъюЄюЁ√щ т Єхўхэшх тёхую
37
// сколько завейтиться. Вместо cpu_ack введем другой сигнал, который в течение всего
26
// фЁрь-Ўшъыр сєфхЄ яюърч√трЄ№, ўхщ ьюцхЄ с√Є№ ёыхфє■∙шщ Ўшъы - яЁюЎхёёюЁр шыш Єюы№ъю
38
// драм-цикла будет показывать, чей может быть следующий цикл - процессора или только
27
// тшфхю. ╧ю ёєЄш ¤Єю ш сєфхЄ Єръцх cpu_ack, эю трышфэ√щ т ьюьхэЄ cpu_req (Є.х.
39
// видео. По сути это и будет также cpu_ack, но валидный в момент cpu_req (т.е.
28
// т ьюьхэЄ cend) ш Ёрэхх.
40
// в момент cend) и ранее.
29
 
41
 
30
// 12.06.2011:
42
// 12.06.2011:
31
// яЁюсыхьр: хёыш Ўяє яЁюёшЄ Ўшъы ўЄхэш , р хую фрЄ№ эх ьюуєЄ,
43
// проблема: если цпу просит цикл чтения, а его дать не могут,
32
// Єю юэ фюыцхэ фхЁцрЄ№ cpu_req. юфэръю, ёэ Є№ юэ хую ьюцхЄ
44
// то он должен держать cpu_req. однако, снять он его может
33
// Єюы№ъю яю cpu_strobe, яЁш ¤Єюь Єръцх юЄяЁртшЄё  х∙х юфшэ
45
// только по cpu_strobe, при этом также отправится еще один
34
// чряЁюё ўЄхэш !!!
46
// запрос чтения!!!
35
// Ёх°хэшх: фюсртшЄ№ ёшуэры cpu_ack, яю ъюЄюЁюьє єчэр╕Єё , ўЄю
47
// решение: добавить сигнал cpu_ack, по которому узнаётся, что
36
// рЁсшЄЁ чюїртры чряЁюё (чряшёш шыш ўЄхэш ), ъюЄюЁ√щ сєфхЄ
48
// арбитр зохавал запрос (записи или чтения), который будет
37
// ёютярфрЄ№ ё э√эх°эшь cpu_strobe эр чряшёш (cbeg), р сєфє∙шщ
49
// совпадать с нынешним cpu_strobe на записи (cbeg), а будущий
38
// cpu_strobe ёфхырЄ№ Єюы№ъю ъръ ёЄЁюс фрээ√ї эр чюїртрээюь
50
// cpu_strobe сделать только как строб данных на зохаванном
39
// чряЁюёх ўЄхэ .
51
// запросе чтеня.
40
// ¤Єю, тючьюцэю, яючтюышЄ єфрышЄ№ тё ъшх cpu_waitcyc...
52
// это, возможно, позволит удалить всякие cpu_waitcyc...
41
 
53
 
42
 
54
 
43
// Arbitration is made on full 8-cycle access blocks. Each cycle is defined by dram.v and consists of 4 fpga clocks.
55
// Arbitration is made on full 8-cycle access blocks. Each cycle is defined by dram.v and consists of 4 fpga clocks.
44
// During each access block, there can be either no videodata access, 1 videodata access, 2, 4 or full 8 accesses.
56
// During each access block, there can be either no videodata access, 1 videodata access, 2, 4 or full 8 accesses.
45
// All spare cycles can be used by processor. If nobody uses memory in the given cycle, refresh cycle is performed
57
// All spare cycles can be used by processor. If nobody uses memory in the given cycle, refresh cycle is performed
Line 71... Line 83...
71
// access block begins at any dram cycle, then blocks go back-to-back
83
// access block begins at any dram cycle, then blocks go back-to-back
72
//
84
//
73
// key signals are go and cpu_req, sampled at the end of each dram cycle. Must be set to the module
85
// key signals are go and cpu_req, sampled at the end of each dram cycle. Must be set to the module
74
// one clock cycle earlier the clock of the beginning current dram cycle
86
// one clock cycle earlier the clock of the beginning current dram cycle
75
 
87
 
-
 
88
`include "../include/tune.v"
-
 
89
 
76
module arbiter(
90
module arbiter(
77
 
91
 
78
        input clk,
92
        input clk,
79
        input rst_n,
93
        input rst_n,
80
 
94