198 easy PAL

198 : easy PAL

Design render

How it works

This project is a PAL (programmable array logic device). It is programmed with a shift register. It was written by Matthias Musch and included in TTGF180 by me (Ken).

easy_pal is a simple and naive PAL implementation that can be (re)programmed via a shift-register chain. The PAL is fully parametric and thus number of inputs (N), number of intermediate stages (P) and the number of outputs (M) can be configured in a flexible way in the verilog sources.

Example configuration

To generate a bitstream the python script has to be run. In the top of the file the logic function and the size of the PAL-device has to be provided. After displaying the truth table the script generates the following output:

The logic function was given in the following way in the Python code: "O0 = ~I0 | I1 & ~(I2 & I3) "

Looking at the following waveform we can see that it does indeed work! :)

Taped-out configuration and pin assignment

Because I do not want to update the text below too often I write the configuration of the physical PAL device in terms of:

  • Number of inputs
  • Number of itermediatory stages
  • Number of outputs ...only once. In the following this will be refered to however the exact number is only mentioned here. The numbers are:
  • 8 inputs
  • 26 intermediatory stages
  • 7 outputs
Pin assignment
  • The eight inputs are connected to the eight uio_in wires.
  • The enable pin to put the logic function on the outputs is connected to the uio_in[1] pin.
  • The clock for the shift register is connected to uio_in[2]
  • The configuration bit pin, which holds the data that is next shifted in is connected to the uio_in[0]. Aka here the bitstream is fed into - bit by bit!
  • The outputs are displayed on the first four uo_out[3:0] bits.
  • The rising edges are (clock for the shift register) are supplied via the uio_in[2] pin.

Programming

At every rising edge of the programming-clock the shift register takes in a value from the config_bit pin. When the configuration is done the PAL implements the programmed combinatorial function(s). However in order to get the programmed function(s) to generate outputs the enable pin has to be asserted.

Generate bitstreams

To generate bitstreams for the shift register a Python script is provided in this repository. It is important to set the right number of inputs, intermediate stages and outputs. This has to be exactly like the physical PAL-device you have at hand. A boolean logic function is denoted in the following way: O0 = ~I0 | I1 & ~(I2 & I3) It is important to declare the used variables before. See the Python script as it was done for O0, I1, I2, I3. You can add or remove variables. However keep in mind that the physical number of variables is limited. You can check the physical number that will be on the device in the project.v file.

At this point in time the bitstream generation in the Python script has some of limitations.

Using the PAL

Okay now that you have transmitted the bitstream onto the PALs shift register you can set the enable pin (uio-pin) to output the programmed logic functions on the outputs.

How to test

By first shifting in a bitstream configuration into the device the AND/OR matrix of the device can be programmed to implement boolean functions with a set of inputs and outputs. You can test the design by clocking in a bitstream with a microcontroller (I will provide some example code for that) and by connecting buttons to the inputs and maybe LEDs to the outputs.

External hardware

No external HW is needed. However to see your glorious boolean functions come to life you might want to connect some switches to the inputs and LEDs to the outputs.

IO

#InputOutputBidirectional
0Combinatorial input 0Combinatorial output 0Config pin: This pin is used to apply the config bit that will be shifted in on a rising clock edge.
1Combinatorial input 1Combinatorial output 1Enable pin: If HIGH (1) the result of the logic function is applied to all outputs.
2Combinatorial input 2Combinatorial output 2Clock pin: Used for the shift register to sample in the [config pin] data (see uio[0]).
3Combinatorial input 3Combinatorial output 3unused
4Combinatorial input 4Combinatorial output 3unused
5Combinatorial input 5unused - tied to 0unused
6Combinatorial input 6unused - tied to 0unused
7Combinatorial input 7unused - tied to 0unused

Chip location

Controller Mux Mux Mux Mux Mux Mux Mux Mux Mux Mux Mux Mux Mux Mux Mux tt_um_chip_rom (Chip ROM) tt_um_factory_test (Tiny Tapeout Factory Test) tt_um_htfab_asicle2 (Asicle v2) tt_um_urish_simon (Simon Says memory game) tt_um_dlmiles_ringosc_5inv (Ring Oscillator (5 inverter)) tt_um_rejunity_vga_logo (VGA Tiny Logo) tt_um_rejunity_sn76489 (Classic 8-bit era Programmable Sound Generator SN76489) tt_um_wokwi_392873974467527681 (PILIPINAS_IC) tt_um_wokwi_442081253563458561 (PRISM 8 with TinySnake) tt_um_waferspace_vga_screensaver (Wafer.space Logo VGA Screensaver) tt_um_rejunity_z80 (Zilog Z80) tt_um_MichaelBell_tinyQV (TinyQV Risc-V SoC) tt_um_calonso88_spi_i2c_reg_bank (Register bank accessible through SPI and I2C) tt_um_htfab_caterpillar (Simon's Caterpillar) tt_um_gf0p2_faust_top (Silly-Faust) tt_um_htfab_cells (Cell mux) tt_um_zedtc1_top (Zedulo TestChip1) tt_um_essen (2x2 MAC Systolic array with DFT) tt_um_BLE_RX (SCµM-BLE-RX) tt_um_kianV_rv32ima_uLinux_SoC (KianV uLinux SoC) tt_um_schoeberl_wildcat (Wildcat RISC-V) tt_um_vga_clock (VGA clock) tt_um_digital_clock_example (7-Segment Digital Desk Clock) tt_um_rejunity_vga_test01 (VGA Drop (audio/visual demo)) tt_um_a1k0n_nyancat (VGA Nyan Cat) tt_um_proppy_megabytebeat (megabytebeat) tt_um_javibajocero_top (MarcoPolo) tt_um_kercrafter_leds_racer (LEDs Racer) tt_um_noritsuna_CAN_CTRL (CAN Controller for Rocket) tt_um_algofoogle_raybox_zero (raybox-zero TTGF0p2 edition) tt_um_flummer_ltc (Linear Timecode (LTC) generator) tt_um_dlmiles_bad_synchronizer (Example of Bad Synchronizer) tt_um_multi_bit_puf_wrapper (One Bit PUF) tt_um_algofoogle_vgaringosc (Ring osc on VGA) tt_um_lisa (LISA 8-Bit Microcontroller) tt_um_mmorri22_lockpick_game (Notre Dame - Lockpick Game TT Example) tt_um_simple_riscv (Simple RISC-V) tt_um_mmorri22_cse_30342 (Notre Dame - CSE 30342 - DIC - Advanced FSM Final Project Example) tt_um_zacky1972_PVTMonitorSuite (PVTMonitorSuite) tt_um_SophusAndreassen_dogbattle (Dog Battle Game) tt_um_frequency_counter (Frequency Counter SSD1306 OLED) tt_um_wokwi_445338187869298689 (WokwiPWM) tt_um_kbeckmann_flame (Flame demo) tt_um_2048_vga_game (2048 sliding tile puzzle game (VGA)) tt_um_spi_cpu_top (Super-Simple-SPI-CPU) tt_um_urish_usb_cdc (USB CDC (Serial) Device) tt_um_htfab_vga_tester (Video mode tester) tt_um_dlmiles_ddr_throughput_test (DDR throughput and flop aperature test) tt_um_dlmiles_loopback (GF180MCU loopback tile with input skew measurement) tt_um_thezoq2_quickscope (Quickscope) tt_um_MATTHIAS_M_PAL_TOP_WRAPPER (easy PAL) tt_um_htfab_rotfpga2 (ROTFPGA v2)