惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

F
Full Disclosure
WordPress大学
WordPress大学
小众软件
小众软件
Cloudbric
Cloudbric
AWS News Blog
AWS News Blog
腾讯CDC
量子位
人人都是产品经理
人人都是产品经理
大猫的无限游戏
大猫的无限游戏
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
V
Vulnerabilities – Threatpost
Scott Helme
Scott Helme
Hugging Face - Blog
Hugging Face - Blog
博客园_首页
C
CXSECURITY Database RSS Feed - CXSecurity.com
The Hacker News
The Hacker News
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
IT之家
IT之家
Jina AI
Jina AI
Attack and Defense Labs
Attack and Defense Labs
S
SegmentFault 最新的问题
Simon Willison's Weblog
Simon Willison's Weblog
The Cloudflare Blog
阮一峰的网络日志
阮一峰的网络日志
T
Tailwind CSS Blog
Last Week in AI
Last Week in AI
博客园 - 【当耐特】
Google Online Security Blog
Google Online Security Blog
美团技术团队
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
V
Visual Studio Blog
罗磊的独立博客
L
LINUX DO - 最新话题
博客园 - Franky
博客园 - 叶小钗
Apple Machine Learning Research
Apple Machine Learning Research
The Last Watchdog
The Last Watchdog
J
Java Code Geeks
AI
AI
C
Cisco Blogs
酷 壳 – CoolShell
酷 壳 – CoolShell
C
Cyber Attacks, Cyber Crime and Cyber Security
Cisco Talos Blog
Cisco Talos Blog
博客园 - 三生石上(FineUI控件)
雷峰网
雷峰网
Help Net Security
Help Net Security
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
云风的 BLOG
云风的 BLOG
I
Intezer
S
Securelist

KittenLabs

Casiomania Marantz UD5007 power supply replacement AnotterKiosk GPD Pocket 4 Speaker DSP IP-over-Toslink FX3 LVDS Frame grabber Extreme Pi Boot Optimization WiFi auth with OsmoHLR/SIM cards Windows 11 tweaks & usability improvements Using custom domains as a Fediverse redirect 25GBit/s on macOS & iOS Router overclocking Real gaming router Manage RDP certificates on Windows using SSH 20 port USB-C charger Reviving a dead Gigabyte MJ11-EC1 mainboard NVMe BIOS Option ROM 2.5GbE PCIe NIC mod board Blinkekatze ThinkPad T41/T43 USB-C HomeSwitch 4 DC UPS (Lithium) OLED nametag Thermal camera macro LPT printer emulator PC104 ISA adapter Palm IIIc USB-C OtterCast Gigaset DECT debug adapter M.2 NVMe -> miniPCIe Analog floppy synthesizer Dead TROTEC PAC2000S air conditioner Typewriter Teletype SolarCamPi Palm IIIc LED backlight IrDA to RS232 RGB LED nametag PlutoSDR standalone ADS-B FR24 feeder Five meter LED wall ATAPI Audio-CD player TCP/IP for Casio calculators eMMC (micro)SD card ISA8019 NIC Micro8088 build log ISA-over-USB FlexibleLOM PCIe adapter Graphical 128x64px VFD GPIO PATA/IDE on Linux CMM2 PCB OpenWRT als WireGuard-Appliance NeonMatrix Pinebook Pro M.2 WiFi Environmental sensor GPS locked Raspberry Pi Es'hail-2 transceiver setup ThinkPad PowerSeries 820 PlutoSDR clock input WiFi over satellite TV coax Search Results
Programmable logic in PHP
By Manawyrm | Sunday, November 08, 2020 · 2020-11-08 · via KittenLabs

PHPPLD - Use EEPROMs as PLAs/logic gates with PHP

LCD monitor, showing a pixelated rainbow PHP elephant Breadboard setup, connected to a VGA plug, Macronix flash IC visible

What is it?

Parallel ROMs (OTP-ROMs, EPROMs, EEPROMs, NOR flash, etc.) can be used as simple, programmable logic devices.
They can be programmed to hold a lookup-table / bit stream, which will emulate logic functions (like 74-series logic) by responding to a certain pattern on the “input” (aka address lines) with a pre-calculated “output” (on the data lines).

Generating the bit patterns to flash onto such an EEPROM can be tedious and error-prone, when done by hand (with a hex-editor).

PHPPLD provides a simple and easy way to generate complex logic as a bit stream. The user can provide a small function, written in the PHP programming language. This function is then called for each possible combination of bits on the EEPROM’s “input”/address-lines. For a 128KiB flash ROM (like a MX29F001B), this means the function will get called 131072 times.

How does it work?

The PHP function can react to the input bits in various ways.
They can be used as booleans (provided as an $input array) and combined with logical functions:

// NOT gate
$output[0] = !$input[0];

// AND gate
$output[1] = $input[1] && $input[2];

It can also convert the input into a number (useful when connected to a microprocessor bus) and work as an address decoder:

$address = integer_value($input);

if ($address >= 0x20 && $address <= 0x40)
{
	$cs_soundchip = 1; 
}
if ($address >= 0x60 && $address <= 0x65)
{
	$cs_videochip = 1; 
}

$output[0] = $cs_soundchip; 
$output[1] = !$cs_videochip; // Note the inversion for active-low signals

VGA signal generation

A rather extreme example of PHPPLD is the vga.php.
It uses a binary counter connected to the address inputs of the EEPROM. This counter is being fed from an external clock.

The output bits of the EEPROM are:

  • 2 bits of red color information
  • 2 bits of green color information
  • 1 bit of blue color information
  • pattern finish bit / counter reset
  • horizontal sync
  • vertical sync

While evaluating the script, PHPPLD can use GDlib (an image manipulation library) to look at individual pixels of an image file and store the appropriate color values into the bit stream. It will also calculate the timing information/sync signals required for a VGA monitor.

This generates a fixed 800x600 signal, with an effective resolution of 100x600 pixels.

LCD monitor, showing a pixelated/low-res photo of a colorful bird

ISA bus decoder

PHPPLD was used to generate a bitstream to map a RC2014 (Z80-based computer) extension card onto a x86-PC ISA bus.

Prototype ISA card, with EEPROM as address decoder and RTL8019 RC2014 card Backside of prototype ISA card, lots of flying wires everywhere

This allowed the use of the RTL8019 network chip on the RC2014 card on a regular PC before the ISA8019 card was finished.

  • PHPPLD: Source code
  • Examples: PHP example functions (address decoders, VGA)