arc-lab-uf / vga-simulator Goto Github PK
View Code? Open in Web Editor NEWModern Python implementation of the legendary VGA Simulator by @MadLittleMods
License: MIT License
Modern Python implementation of the legendary VGA Simulator by @MadLittleMods
License: MIT License
Currently the output files are on the order of 50-100MB in size. This is hugely space-inefficient. Consider a way to optimize this!
Just in case anyone ever wants it
Add a file with common VGA modes, something like this:
@dataclass
class VGAMode:
width: int
height: int
pixel_clock_MHz: float
h_back_porch_length: int
v_back_porch_length: int
# http://tinyvga.com/vga-timing/640x480@60Hz
vga_modes = {
"640x480_60": VGAMode(640, 480, 25.175, 48, 33),
# Add more here...
}
Then, all you'd need to do to operate the CLI is
$ ./vga_sim.py input_file.txt 640x480_60
Despite the vga core typically using 12-bit color depth, the output log tends to have the following output:
50 ns: 1 1 000 000 00
I don't know why it shows up like this, but it isn't consistent (b
is only 2 bits and the others are 3). Something must be wrong here...
Because we can't assume this, we have to determine the length each time rather than being able to have one color_depth
flag...
def parse_line(line: str):
"""Parses a line from the vga text file.
Lines tend to look like this:
`50 ns: 1 1 000 000 00`
The function returns a tuple of each of these in appropriate data types (see below).
NOTE: I'm not sure why blue channel only has 2 digits... bug?
"""
time, unit, hsync, vsync, r, g, b = line.replace(':', '').split()
return (
time_conversion(int(time), unit, "sec"),
int(hsync),
int(vsync),
bin_to_color(int(r, 2), len(r)), # Have to do this once per color... ugh
bin_to_color(int(g, 2), len(g)),
bin_to_color(int(b, 2), len(b))
)
that way this repo is one-stop for everything you need
This one should be easy since it's just one file.
Lines 11 to 18 in cb34f55
I'm not sure why it was removed. Is it able to be brought back?
The : is unnecessary. These logs are never going to be read by a human, so why make them human-readable?
The example write_log.txt
from EE's website is 2,301,150 lines, with 63,876,645 characters. One ':' per line is 2,301,150 colons throughout the file.
By removing this, we save about 3.6% file space. Not much, but it's effortless to achieve.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.