Skip to content

Upstream VHLD cleanup: indentation, case, tabs#1

Open
raszpl wants to merge 17 commits intomaniekx86:mainfrom
raszpl:upstream
Open

Upstream VHLD cleanup: indentation, case, tabs#1
raszpl wants to merge 17 commits intomaniekx86:mainfrom
raszpl:upstream

Conversation

@raszpl
Copy link
Copy Markdown

@raszpl raszpl commented Mar 30, 2026

Just a formatting cleanup for a start. I have some more changes coming after that.

I have been keeping a journal and meant to reply earlier, but forgot and just kept writing notes instead :| Cumulative reply continuing from https://old.reddit.com/r/homebrewcomputer/comments/1q55r7q/my_kinda_pc_compatible_486_homebrew_computer_can/o17od7q/ troche mieszany jezyk:

Burst

My earlier half baked idea of linking RDY and BRDY is a no go, I must have been asleep "If RDY is returned simultaneously with BRDY, BRDY is ignored and the cycle is converted to a non-burst cycle."
Burst would not be beneficial here anyway with 70ns ram. Makes more sense with fast on board L2 caches and VLB cards.

In the recent update, I managed to improve performance a bit on the RAM by kinda simulating burst transfers - basically, after a read, the RAM driver holds the RAM OE active. If next transfer cycle is again on the RAM, on the same RAM bank and is a read too, the OE stays active so I can skip some waitstates of next read because times are already met (due to ADS phase).

Widzialem. 26MB/s to wiecej niz nie jedna pelnoprawna plyta chodzaca na 33MHz z wczesnych lat dziewiedziesiatych :o Miodzio. Sprawdz jeszcze https://vetusware.com/download/VIDSPEED%203.0
"vidspeed * L" wyswietli wynik dla ramu i VGA 320x200. Ciekaw jestem czy bedziesz miec duza roznice pomiedzy Tridentem a GD5428, zwlaszcza z BALE podciagnietym na 5V.

RESET_REQ_OUT

P76 RESET_REQ_OUT / FPGA_REQ_RESET looks unneeded at this point. AVR controls both bitstream load and reset, can be handled without listening for FPGA explicit reset signal by monitoring DONE as you already do in

if (FPGA_DONE_PIN & (1<<FPGA_DONE_BIT)) { // high
, 5 ms is plenty of time for FPGA to start fully running. Spartan-II datasheet page 20 Figure 13 shows when DONE goes high bitstream has already loaded and GTS/GSR/GWE will go low in a couple cycles meaning bitstream will take effect. You could check this with logic analyser or modified AVR firmware monitoring both PE4 FPGA_DONE and PF1 FPGA_REQ_RESET pins. Would there be any need for Chipset to ever initiate reset? Only thing that comes to my mind is Fully emulated keyboard controller resetting CPU while switching protected->real mode, but that was only needed on 286, 386 and later used tripple fault trick to reset CPU, not to mention it requires separation of ISA RSTDRV and CPU Reset. In conclusion imo FPGA_REQ_RESET is a free IO for reuse.
I made the changes in my fork by just ripping RESET_REQ_OUT out raszpl@58ba8fa
If I understand

M8SBC-486/avr/main.c

Lines 375 to 377 in f8e8425

if (load_fpga_from_flash() != 0) {
// Fail, hold reset
RESET_OUT_PORT |= (1<<RESET_OUT_BIT);
correctly it will already wait for DONE and then issue reset so everything should work fine without chipset trying to reset too.

FPGA_INIT

FPGA_INIT is open drain and should be pulled high to work, you never enable pullup on PE6 (PORTE |= (1 << 6)). How does

while (!(FPGA_INIT_PIN & (1<<FPGA_INIT_BIT))) {
ever read high? :o

Power_Good

Old school 286/386 and early 486 boards used Power_Good directly in Reset signal generator. Probably should be linked to AVR and checked? On the other hand ATmega128L internal Reset generator already monitors 5V and issues reset when its stable so its a bit redundant.

track length

Longest Address tracks might even see ~200pF ~200 nH :0 At stock 12mA output thats ~50ns rise times. Frankly Im shocked its working :), I think the only thing saving you is 70ns ram thus nothing runs above 14MHz over those huge loads. I would love to see scope probing A17/18/19 while computer is running something sufficiently big to flip those lines fast, must be ringing like crazy.
Intelowski datasheet 240440-006 ma wykresy "TYPICAL OUTPUT VALID DELAY VERSUS LOAD CAPACITANCE UNDER WORST CASE CONDITIONS FOR THE 25 MHz AND 33 MHz Intel486 CPU" i koncza sie na 150pF :) mozna spokojnie liczyc minimum extra 16ns rise/fall time. Zakladajac ze normalnie ma pewnie z 15ns to obecna PCB jest na granicy poprawnej pracy z fall/rise na poziomie >30ns podczas dostepu do ramu (~14mhz).
Nastepny krytyczny pin W/R polaczyles na stale z 245kami, 20cm + 14 vias = ~33pF, + 6x 74LS245 5-10pF = 60-90pF. Afaik wszytkie wazne piny (W/R D/C M/IO ADS) powinny laczyc sie tylko bezposrednio z FPGA bez zmian stron pcb. IMO W/R dla transceiverow powinien generowac FPGA (ewentualnie jakis buforek), nie beda wtedy obciazac cpu poczas normalnej pracy.

thinning out

Got an idea on how to get rid of U23 74LS573. Currently its sole purpose is driving power LED (by bios? autoexec? cant find any use) and PIT Gate2. LED can be turned on/off by AVR reusing same communication CMOS uses or just being triggered by CMOS fetch in the first place. U23 is latched by PIT_LATCH_LE, but wiring PIT_LATCH_LE directly to Gate2 makes U23 redundant and gains 2cm2 of space. Lost almost 100 Vias doing this and some chip flipping :-)
w forku wprowadzilem te zmiany tutaj raszpl@85988e4 raszpl@2f34af8
plusy pozbycie sie U23
minusy brak D7_LED

thermal relief

3V3REG_COOL 2V5REG_COOL maja byc radiatorami wiec trzeba ustawic 0 thermal relief albo zmienic typ na Solid.

RAM_CACHE_EN/ROM_CACHE_EN lookup

RAM_CACHE_EN/ROM_CACHE_EN ... Lookup could be moved into CMOS.vhd

CACHE_EN jumpers and ATMega: I am aware of this, simplicity again. Anyway, ATMega128 could have more features in the system. If I knew that I could do chipset-AVR communication back then, I would use it to save pins like you said.

zrobione, nietestowane "moved RAM_CACHE_EN ROM_CACHE_EN to CMOS, updated BIOS code to display and set those variables, untested if compiles/runs" raszpl@0e443ec

BALE i karty graficzne

Covering this pin by sticking a piece of tape on an ISA card (and optionally pulling it high on the card, as it might float) fixes cards that use this pin.

Tez znalazmem ze tak mozna :
1 Trident https://www.vogons.org/viewtopic.php?p=1294259#p1294259
"I just modified the only ISA VGA card I have, so I can use it in an XT Im restoring (Im reconstructing the CGA card). It is 8-bit compatible but it doesn't work on the XT, apparently because of the ALE signal problem. I put a jumper so I can easily configure it in "normal" (card signal to ISA bus) mode or "XT" mode (card signal to +5v). Also, the trace cuts were minimal, so I can remove the mod and reconnect the trace in an almost "invisible" way. I'll leave the test for tomorrow night, fingers crossed... I really need to look for more 8-bit compatible VGA ISA video cards."

2 to samo, podciagniecie ALE na tridencie do 5V https://www.vogons.org/viewtopic.php?p=1367152#p1367152

3 glithes when using CF to IDE adapters shorting ALE to ground https://www.vogons.org/viewtopic.php?p=1142705#p1142705

Z tego co pamietam BALE bylo w 16 bitowej ISA uzyte do tego aby chipset mogl wrzucic adres nastepnej tranzakcji na LA17-23 jeszcze w trakcie poprzedniej. Karty mogly sobie interpretowac LA17-23 zawsze gdy BALE jest wysokie, a lapac na opadajacym zboczu jak SA. Wyglada na to ze jedynym efektem ubocznym BALE na stale do +5V byloby wylaczenie/zepsucie address pipelining ... gdyby chipset obslugiwal address pipelining :) ale ze go nie obsluguje to efekt jest zaden i wszystko powinno smigac.
Do pelnej obslugi 'ISA address pipelining' SA0-19 musza siedziec na oddzielnym wyjsciu z chipsetu i nie byc bezposrednio spiete z szyna adresowa CPU. Nie wiem dokladnie jak to wyglada wewnetrznie, na pewno Czipset laczuje SA0-19 i jedzie dalej, ale data bus jest nadal spieta z CPU wiec nie bardzo jeszcze lapie to cale 'ISA address pipelining'.
Wlasciwie to w literaturze o tym pipelining wspominali tylko w kontekscie kart rozszerzajacych ram po szynie ISA. Ciekawe czy cokolwiek innego uzywa pipelining i czy/ktore czipsety to obsluguja w pelni. Rozpedzilem sie i w forku juz nawet pociagnalem BALE do FPGA, ale jak teraz o tym mysle to to by mialo tylko sens z w pelni dzialajacym address pipelining. Musze zrobic jakis szerszy risercz jakie generacje chipsetow oraz jakie karty to w pelni obslugiwaly i jaka jest roznica w predkosci.

A20M

brak obslugi A20M? pewnie odpowiada za zgon windows 3.11 i himem.sys. W311 powinno sie dac odpalic z emm386. EMM386.EXE potrafi emulowac A20gate programowo (fState_A20Ena) przechwytujac 92h (i klawiature 60/64h) https://github.com/AR1972/astro/blob/91e0bc1f5cd213a6e682294e2f628f3f3d99ffe4/dev/emm386/a20trap.asm#L302
i zawija mape pamieci w MMU https://github.com/AR1972/astro/blob/91e0bc1f5cd213a6e682294e2f628f3f3d99ffe4/dev/emm386/util.asm#L450 Prawdopodobnie trzeba tez wymusic wylaczenie HMA w dosie, inaczej IO.sys moze probowac kombinowac z A20 i to sie bedzie konczyc zwisem.

A31

pin A31 niepotrzebny? :-) CPU uzywa go tylko podczas startu gdy reset vector jest 0xFFFFFFF0. Czipset nie moze byc tak naprawne nigdy 100% pewny kiedy byl reset bo CPU moze wewnetrznie zrobic triple fault, ale mozna za to skopiowac co robily czipsety 386SX obslugujace 16MB ramu i nie tylko zmapowac bios pod 0xF0000 ale rowniez permanentnie gorne 64KB biosu pod 0xFF0000, albo probowac byc sprytnym i zmapowac tylko ostatnie 16 bajtow pod 0xFFFFF0 + pomniejszyc odpowiednio EXT_RAM_SIZE jesli bedzie zachaczac o ram w hipotetycznej wersji obslugujacej 16MB ramu.

ISE

ISE - AMD najpierw nie chcialo mi dac autoryzacji do sciagania, a potem olalo wyslanie klucza :| na szczescie jest w sieci klucz do pelnej wersji.

old Xilinx ISE 10.1 actually has a plenty of features - testing stuff with test benches is cool and that helped me do it without having hardware yet.

wait, jak sie uzywa test benches ? :) czy to nie wymaga symulacji? za chiny ludowe nie bylem w stanie znalezc softu ktory by chcial symulowac Spartana2 w ISE 10.1. Afaik nie ma zbundlowanego simCostam bo im sie licencja skonczyla. 14.7 ma jakis symulator autorstwa Xilinxa, ale obsluguje tylko spartan 3/4.

DLLs

Widze ze utylizacja pokazuje tylko 2 of 4 DLL, co za tym idzie mam takie podejrzenie ze ...
CLKDV_DIVIDE => 12.0, -- "invalid" but works?!

jednak wyglada mi to ze moze nie works :) i dostajesz albo /8 albo /16. Mierzyles to? Zeby to przetestowac to hmm trzeba nausznie sprawdzic ton PC speakera albo czestotliwosc CLK_PIT. Xilinx jakos nie chwali sie obsluga dzielnika przez 12 a synteza pokazuje tylko dwa uzyte DLL, clock_section_pit.vhd i clock_section.vhd.

pytanie - widze w clock_section.vhd 2 wersje, jedna z recznym licznikiem i zakomentowana DLL. Cos bylo nie tak z dzielnikami 1.5,2.0,2.5,3.0 w DLLu? Troche poeksperymentowalem syntezujac obydwie wersje i wypadaly ~tak samo.

==========================

Removing clocks

removing 14.318 MHz OSC will cause issues! It also clocks PIT (OSC / 12 gives freq for PIT) and actually, a lot more hardware use it - sound cards, graphics cards (not only that GD5422 you linked, from my collection of three ISA graphics cards, two of them use it: TVGA9000 and GD5428) and many others.

myslalem raczej o uzyciu tylko 14MHz + PLL w FPGA. Tyle ze spartan2 ma biedne DLL i slabo to wychodzi. DLL moze tylko x2 i wtedy zostaje 28.6MHz ktore pewnie bedzie za szybkie na FSB z obecna PCB.

Inna ciekawa opcja jest Si5351. Chinskie plytki (fioletowa z 3x sma) sa smiesznie tanie $2 free shipping. 3 wyjscia zegarowe z bardzo precyzyjnymi ustawieniami.

MEM

MEM_WR, MEM_RD: These are signals that I felt I will need, but in the end, they were completely useless.

tak przeczuwalem i wywalilem w moim forku raszpl@047a45f

technikum

PS. Tak, jestem jeszcze w technikum (technik elektronik).

Tez mialem ta przyjemnosc dawno temu :)

Aktualnie pracuję nad filmikiem na mój kanał YT, taki w sumie skupiający się sporo na historii tego projektu - ostrzegam, będzie długi.

czekam :)

@raszpl raszpl marked this pull request as ready for review March 30, 2026 15:47
@maniekx86
Copy link
Copy Markdown
Owner

Hello! Thanks for the pull request and the long description. As for the PR, the cleanup is great (I like to write VHDL syntax in uppercase but I often forgot to). There is one problem: the indentation and tabs. The thing is, maybe on GitHub and in other editors, this doesn't look and format neat, but Xilinx ISE 10.1, which I am using for development, it looks okay (I am writing sources in it, too. Maybe it's not the best editor, but having it integrated is nice). The result of tab formatting in it looks very nice. For test, I imported one file from your changes, and it kinda breaks the formatting. So what I am saying, I would keep tabs as they are.

Source after your fixes
Przechwycenie obrazu ekranu_2026-04-18_15-35-59

Current version
image

Trochę zajęło mi zobaczenie tych zmian bo ciągle coś się u mnie działo - szkoła itp. W ogóle to nawet byłem na ogólnopolskim konkursie z tym komputerem ostatnio ("Elektronika by żyło się łatwiej", zająłem 1 miejsce :D). No i jak chodzi o te wszystkie sprawy o jakich się rozpisałeś i tą naszą konserwacje z Reddita, nie chcesz może skontaktować się bezpośrednio przez jakiegoś Discorda, Telegrama czy coś podobnego? Było by wygodniej odpisać bo widzę, że jesteś zafascynowanym moim projektem (za co szanuję bardzo) i zakładam, że pewnie narodzi się jeszcze więcej pytań. (Akurat wysłałem ci podobne zapytanie jakiś czas temu na Twojego emaila ale chyba nie odczytałeś go). Jak nie to rozpiszę się tutaj o tym wszystkim ale to później.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants