Giter VIP home page Giter VIP logo

vga-simulator's People

Contributors

benjamin051000 avatar cmvinod avatar

Watchers

 avatar

vga-simulator's Issues

Optimize text output file

Currently the output files are on the order of 50-100MB in size. This is hugely space-inefficient. Consider a way to optimize this!

Add common vga modes

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

Looks like the process doesn't respect color depth?

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))
    )

Bring back `test_bin_to_color` unit test

def test_bin_to_color(self):
# for i in range(1, 5):
# self.assertEqual(vga_sim.bin_to_color(0, i), 0)
#
# self.assertEqual(vga_sim.bin_to_color(1, 1), 255)
# self.assertEqual(vga_sim.bin_to_color(3, 2), 255)
# self.assertEqual(vga_sim.bin_to_color(7, 3), 255)
pass

I'm not sure why it was removed. Is it able to be brought back?

Remove colons in log

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.