708 miniMAC

708 : miniMAC

Design render

What is this miniMAC

IMPORTANT: This custom circuit and protocol is not at all compliant or even compatible, even remotely linked to any 802.3 standard. It's all explained and detailed on Hackaday at https://hackaday.io/project/198914

The miniMAC is a (currently partial) Media Access Controller for a simplified data link over twisted pairs. It provides error detection and scrambling of 16-bit data words, which are combined with a 17th bit for data/control framing (C/D). The 18-bit result is suitable for sending to a (custom) PHY (see https://hackaday.io/project/203186 ) for serialisation and line coding. This unit chains two sophisticated circuits:

  • The term "gPEAC" means "generalised Pisano with End-Around Carry" (see https://hackaday.io/project/178998 ), a class of PRNG/scrambler/checksum that uses different mathematics than Galois-based LFSR. The gPEAC18 unit is a non-power-of-two additive-based scrambler-checksum, with modulus=258114 and its state is impossible to flush and freeze. It combines the 17 bits and creates an extra check bit. They both work as super-parity bits.

  • "Hammer" is a contraction of the "Hamming distance maximiser". The Hammer18 unit is a XOR-based (bijective) scrambler that boosts the Hamming distance on the scrambled 18-bit word. This version contains 3 layers of taylored permutations between 64 XOR2 gates, with very strong avalanche:

Conveniently, the same sea-of-XOR is identical, both for encoding and decoding, and the decoding side is "recursive" such that it amplifies any transmission error at the receiving end. The sorted avalanche for a single bitflip is : 7 8 8 8 8 9 9 9 9 1 12 13 14 15 15 15 15 15 (total=200). The 64 XOR2 gates have a propagation delay of 10 gates, yet the effective latency in the system is just one XOR in the critical datapath:

These very different types of circuits are complementary, together they provide very strong scrambling, eliminate problems inherent with classical LFSRs, and detect errors very early. With an equivalent of 56 bits of state and uncrashable mathematics, the system remains fast, compact and tailored for safety and early retransmission to save bandwidth/latency and reduce buffer sizes (and cost).

An external circuit is required to implement the higher-level protocol, buffering and retransmission logic.

How it works

The gPEAC requires two cycles, two passes through the adder: first to compute the sums, then to adjust the modulus. OTOH the Hammer18 circuit requires one depth of XOR, but at different places:

  • For encoding, the input data goes through gPEAC then Hammer is inserted at the end of the last cycle.

  • For decoding, the scrambled data goes through Hammer at the start of the first cycle of gPEAC descrambling.

Due to pin constraints, the 18-bit data words are transmitted in two cycles with 9-bit half-words. Counting input and output (2 cycles each), the overall latency is 5 cycles, following a sequence that is internally started when data is initially input with Den=1. Even at the low default 50MHz clock speed, that's still a bandwidth of 25M×18=450Mbps: fast enough to oversaturate a Cat5 twisted pair.

This tile contains four main pipelined units, sequenced by a shift register:

  • the input unit assembles a 18-bit word from two consecutive 9-bit halfwords
  • the encode unit scrambles 17 bits and generates a 18-bit word
  • the decode unit descrambles the 18-bit word, restores the 17-bit word and eventually generates an error flag.
  • the output unit splits the 18-bit words back into two consecutive 9-bit halfwords

The encode and decode units can be tested separately or together in the "loopback" mode.

How to test

First let's examine the pinout. The inputs:

  • CLK is the main clock, driving the whole circuit.
  • Reset synchronously restores the registers' initial values.
  • Enc and Dec select the pipeline routing mode:
    • Enc=0, Dec=0 : bypass mode => the output is copied to the output after 3 cycles,
    • Enc=0, Dec=1 : decode mode => the cleartext input is scrambled and output after 5 cycles,
    • Enc=1, Dec=0 : encode mode => the scrambled input is restored to cleartext after 5 cycles,
    • Enc=1, Dec=1 : loopback mode => encodes then decodes, the delayed output (8 cycles) must be identical to the input.
  • DI0 to DI8 are 9-bit data half-words that are sampled at the rising edge of CLK.
  • DEN is Data ENable input, signalling the presence of the first 9-bit half-word of the pair on DI0:8. The second half MUST follow immediately, during the next cycle of CLK.

The outputs:

  • CLK_out provides an appropriate clock, adjusted for phase and delay due to onchip routing, for easy chaining: output signals are updated on the falling edge of CLK_out.
  • DO0 to DO8 are the data half-word.
  • QEN is the "output enable" generated by the internal sequencer, that signals that a first half-word is available.
  • Z is a flag set to 1 when the decoded output has DO[15:0] cleared (think of a 16-bit NOR), useful to implement the higher-level protocol.

Notes :

  • Data half-words are clock-sourced, to allow seamless chaining of multiple chips.
  • Decoding errors (and Zero) are signalled but not managed/acted upon, a FSM and appropriate circuits must reset the registers.
  • The input/plaintext word contains the C/D bit and an unused bit. C/D should be on Dx8 of the first halfword for fastest detection.
  • The output/scrambled word contains the C/D bit and an error bit (saves a pin)
  • Asserting DEN during more than one cycle is an error condition.
  • The Zero output is always active (encoding as well as decoding) but gives a valid result only when QEN is asserted. It does only check the data bits: [7:0] and [17:9], conveniently mapped to the output byte pins.
  • Do not change the Enc and Dec while data are in the pipeline, do it during the Reset state.

External hardware

Custom boards or adapters will be made. I will try to get a pair of chips to connect together, such that I can verify a whole transmission chain.

(to be continued)

IO

#InputOutputBidirectional
0DI0DO0D08
1DI1DO1QEN
2DI2DO2CLK_out
3DI3DO3Zero
4DI4DO4Enc
5DI5DO5Dec
6DI6DO6DEN
7DI7DO7DI8

Chip location

Controller Mux Mux Mux Mux Mux Mux Mux Mux Mux Mux Mux Mux Mux Mux Analog Mux Analog 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_oscillating_bones (Oscillating Bones) tt_um_mlyoung_wedgetail (Wedgetail TCDE REV01) tt_um_adex_neuron_ncs (AdEx Neuron NCS) tt_um_opamp_gfcwfzkm (Operational Amplifier Test Circuits) tt_um_analog_genesis (Genesis) tt_um_techhu_analog_trial (SoilZ v1 Lock-In Impedance Analyzer) tt_um_rejunity_vga_logo (VGA Tiny Logo Roto Zoomer) tt_um_rebeccargb_universal_decoder (Universal Binary to Segment Decoder) tt_um_rebeccargb_hardware_utf8 (Hardware UTF Encoder/Decoder) tt_um_rebeccargb_intercal_alu (INTERCAL ALU) tt_um_rebeccargb_vga_pride (VGA Pride) tt_um_urish_simon (Simon Says memory game) tt_um_silicon_art (Silicon Art - Pixel Pig + Canary Token) tt_um_aksp_mbist_mbisr (MBIST + MBISR Built-In Memory Test & Repair) tt_um_wokwi_450492230413445121 (RandomNum) tt_um_wokwi_450492214548484097 (test) tt_um_wokwi_450491696806684673 (Snake) tt_um_wokwi_450491302960427009 (TinyTapeout test) tt_um_wokwi_450492208120711169 (Tadder) tt_um_wokwi_450492222691728385 (test_prj) tt_um_not_a_dinosaur (Not a Dinosaur) tt_um_vga_example (Silly Dog) tt_um_mo_module (vga test project) tt_um_snake_game (SnakeGame) tt_um_cic_filter_demo (Discrete-to-ASIC Delta-Sigma Acquisition System) tt_um_spi_aggregator (Quad SPI Aggregator) tt_um_herald (Herald) tt_um_wokwi_453664332125344769 (Digital Lock with Easter Eggs) tt_um_floAfentaki_top (tinyTapeVerilog_out) tt_um_chrismoos_6502_mcu (m6502 Microcontroller) tt_um_piggy_top (Piggybag) tt_um_wokwi_454491386271657985 (6 Bit Roulette) tt_um_ro_puf_trng (RO-based security primitives) tt_um_wokwi_453674671092670465 (My first Wokwi design) tt_um_ezelioli_blockvga (VGABlock) tt_um_SotaSoC (SotaSoC) tt_um_wokwi_455292199922428929 (Second TT experiment) tt_um_wokwi_455301361268988929 (7-Segment-Wokwi-Design) tt_um_hexcnt_elfuchso ((Hexa)Decimal Counter) tt_um_tobiasgreiser_move_vga_square (move VGA square) tt_um_wokwi_455291603750154241 (Temporary Title) tt_um_wokwi_455297270449581057 (RGB PWM) tt_um_wokwi_455291640579325953 (Primitive clock divider) tt_um_wokwi_455291654653337601 (Tiny Ape Out) tt_um_wokwi_455291618175430657 (adder) tt_um_wokwi_455291689699908609 (test) tt_um_wokwi_455291713774178305 (Just logic) tt_um_wokwi_455291560479595521 (title) tt_um_neb_top (neb tt26a first asic) tt_um_wokwi_455291650915156993 (tiny-tapeout-workshop-result) tt_um_joh1x_prng (8-bit PRNG) tt_um_wokwi_455293127747668993 (Tiny Tapeout) tt_um_wokwi_455291727376311297 (custom_lol) tt_um_wokwi_455291594023558145 (Tiny Tapeout) tt_um_wokwi_455291650157032449 (Tiny Tapeout N) tt_um_tomolt_rasterizer (Tiny Triangle Rasterizer) tt_um_wokwi_455291872587345921 (Test) tt_um_wokwi_455299783033986049 (Example) tt_um_wokwi_455299761916711937 (Try1) tt_um_wokwi_455291701422995457 (Clock Divider Test Project) tt_um_wokwi_455291654560013313 (Test) tt_um_hopfield (Hopfield Associative Memory — Odd Digit Recall on 7-Segment) tt_um_wokwi_455291651646015489 (Workshop Day) tt_um_wokwi_455291845594899457 (83rk: Tiny Tapeout) tt_um_wokwi_455301826476070913 (FirstTapeOut2) tt_um_dranoel06_SAP1 (Programmable 8-BIT CPU) tt_um_wokwi_455300379278483457 (test) tt_um_wokwi_455291837898350593 (Custom_ASIC) tt_um_wokwi_455300931094822913 (Tiny Tapeout Accumulator) tt_um_nampukk_top (Miniproc) tt_um_krimmel_mini_synth (Mini Synth) tt_um_wokwi_455291688143820801 (My first tapeout) tt_um_wokwi_455299760551464961 (Freddys tapeout) tt_um_fir_filter (UART-Programmable 2-Tap FIR Filter) tt_um_arthfink_ddmtd (DDMTD) tt_um_wokwi_455291792579934209 (Test) tt_um_wokwi_455291642603080705 (Test) tt_um_wokwi_455303220350374913 (Simon Says) tt_um_wokwi_455292153909854209 (simple XOR cipher) tt_um_wokwi_455300425088680961 (Hello tinyTapout) tt_um_wokwi_455291692145189889 (^My first design) tt_um_wokwi_455290751669808129 (Tiny Tapeout - Riddle Implementation) tt_um_wokwi_455291724163472385 (Tobias first Wokwi design) tt_um_wokwi_455291807082792961 (My Tiny Tapeout) tt_um_wokwi_455303592417686529 (Count Upwards) tt_um_wokwi_455291645628225537 (Nielss first failure) tt_um_wokwi_455291698669433857 (Tiny_Tapeout_Test) tt_um_wokwi_455293379343017985 (Switch Puzzle) tt_um_yniklas_ma (Multiply-Add) tt_um_yjulian_alu (uCore) tt_um_wokwi_455291641368904705 (WIP Title) tt_um_wokwi_455303526551376897 (just copy 4 not gates) tt_um_wokwi_455303914893650945 (WIP) tt_um_fpga_can_lehmann (FPGA) tt_um_wokwi_455291728585320449 (gatekeeping the gates) tt_um_wokwi_455291738750219265 (RTX 8090) tt_um_ct4111_buzzer (Two Song Buzzer Player) tt_um_wokwi_455291631430488065 (Tudor BCD Test) tt_um_wokwi_455300137923517441 (Tiny Tapeout 1) tt_um_wokwi_455300818767153153 (little frequency divider) tt_um_wokwi_455291748212573185 (Test - clock divider) tt_um_wokwi_455291611094391809 (Counter) tt_um_wokwi_455331155298538497 (WIP) tt_um_mattvenn_vgatest (VGA demo) tt_um_matth_fischer_vgaTT (VGA Squares) tt_um_phsauter_vga_maze (VGA Maze Runner) tt_um_themightyduckofdoom_bitserial_collatz_checker (Bit-Serial Collatz Conjecture Checker) tt_um_tt_tinyQV (Borg - Tiny GPU) tt_um_pgfarley_tophat_top (tophat) tt_um_jamesbuchanan_silly (Silly demo) tt_um_sid (SID Voice Synthesizer) tt_um_tinymoa_ihp26a (TinyMOA: RISC-V CPU with Compute-in-Memory Accelerator) tt_um_embeddedinn_vga (Cyber EMBEDDEDINN) tt_um_urish_rings (VGA Rings) tt_um_swenson_cqs (quad-sieve) tt_um_brmurrell3_m31_accel (M31 Mersenne-31 Arithmetic Accelerator) tt_um_corey (Bernstein-Yang Modular Inverse (secp256k1)) tt_um_wokwi_456019228852926465 (Johnson counter) tt_um_posit_mac_stream (8Bit Posit MAC Unit) tt_um_wokwi_453110263532536833 (Tiny tapeout MAC unit) tt_um_wokwi_456131795093444609 (Test) tt_um_calonso88_spi_i2c_reg_bank (Register bank accessible through SPI and I2C) tt_um_tinyperceptron_karlmose (Tiny Perceptron) tt_um_wokwi_456571536458697729 (Full Adder) tt_um_wokwi_456571856158098433 (MJ Wokwi project) tt_um_pong (TinyPong) tt_um_wokwi_456574262189506561 (Simple counter) tt_um_wokwi_456571610504973313 (4ish bit adder) tt_um_wokwi_456571875721383937 (Hello World) tt_um_tsetlin_machine (Tsetlin Machine for low-power AI) tt_um_wokwi_456574528376856577 (Cremedelcreme) tt_um_wokwi_456571730084640769 (tiny tapeout half adder) tt_um_romultra_top (SPI RAM Driver) tt_um_wokwi_456575247946496001 (4-bit full adder) tt_um_wokwi_456576478636229633 (Alex first circuit) tt_um_wokwi_456571639638628353 (Malthes First Template) tt_um_wokwi_456573048893551617 (And_Or) tt_um_wokwi_456571585305580545 (WIP Bin to Dec) tt_um_wokwi_456571687437989889 (TinyTapeNkTest) tt_um_wokwi_456573098517424129 (2 Digit Display) tt_um_wokwi_456571798679348225 (nand_gate) tt_um_luke_meta (TTIHP26a_Luke_Meta) tt_um_wokwi_456576238411624449 (Tiny Tapeout Amaury Basic test) tt_um_wokwi_456571702278493185 (JayF-HA) tt_um_wokwi_456571626036491265 (Tiny Tapeout First Design) tt_um_wokwi_456571568465442817 (First tinytapeout 234) tt_um_wokwi_456577873995405313 (Switch deBounce for Rotary Encoder) tt_um_wokwi_456571625108498433 (Scott's first Wokwi design) tt_um_wokwi_456578179564131329 (idk) tt_um_wokwi_456573141570913281 (Tiny Tapeout chip) tt_um_wokwi_456578608558661633 (Hidden combination) tt_um_carlhyldborglundstroem_code (8_cool_modes) tt_um_wokwi_456572140961867777 (TestWorkShop) tt_um_wokwi_456575744901356545 (Design_test_workshop) tt_um_wokwi_456571628648495105 (Tiny Tapeout Test Gates) tt_um_wokwi_456578790697395201 (vis_3) tt_um_ISC77x8_HansAdam2077 (ISC77x16) tt_um_wokwi_456571702213480449 (Tiny Tapeout Test Gates) tt_um_wokwi_456575028603245569 (Test) tt_um_wokwi_456571746867102721 (fullAdder) tt_um_wokwi_456576548374933505 (My first design) tt_um_wokwi_456571983499280385 (Tiny Tapeout Test) tt_um_wokwi_456579003210233857 (Tiny Tapeout placeholder) tt_um_wokwi_456572032892464129 (Workshop) tt_um_hoene_smart_led_digital (Smart LED digital) tt_um_wokwi_456572126761001985 (test project) tt_um_schoeberl_undecided (Undecided) tt_um_flummer_ltc (Linear Timecode (LTC) generator with I2C control) tt_um_jalcim (tiny_tester) tt_um_ECM24_serv_soc_top (FH Joanneum TinyTapeout) tt_um_fabulous_ihp_26a (Tiny FABulous FPGA) tt_um_LnL_SoC (Lab and Lectures SoC) tt_um_ygdes_hdsiso8_dlhq (ttihp-HDSISO8) tt_um_algofoogle_fomo (FOMO) tt_um_chrbirks_top (ADPLL) tt_um_MichaelBell_photo_frame (Photo Frame) tt_um_miniMAC (miniMAC) tt_um_crockpotveggies_neuron (Neuromorphic Tile) tt_um_coastalwhite_canright_sbox (Canright SBOX) tt_um_ebeam_pixel_core (E-Beam Inspection Pixel Core) tt_um_DelosReyesJordan_SEM (8-bit SEM Floating-Point Multiplier) tt_um_chisel_template (One One) tt_um_vga_tetris (VGA Tetris) tt_um_wokwi_457062377137305601 (Count To Ten) tt_um_techhu_rv32_trial (LoRa Edge SoC) tt_um_risc_v_wg_swc1 (ttihp-26a-risc-v-wg-swc1) tt_um_andreasp00 (TT6581) tt_um_pakesson_glitcher (Glitcher) tt_um_intv0id_kalman (Kalman Filter for IMU) tt_um_neuromurf_seq_mac_inf (SEQ_MAC_INF_16H3 - Neural Network Inference Accelerator) tt_um_obrhubr (8-bit Prime Number Detector) tt_um_anujic_rng (True(er) Random Number Generator (TRNG)) tt_um_async_test (Chisel Async Test) tt_um_wokwi_458140717611045889 (O2ELHd 7segment display) tt_um_libormiller_SIMON_SPI (SIMON) tt_um_tschai_yim_mill (Tschai's Tic-Tac-Toe) tt_um_microlane_demo (microlane demo project) tt_um_vga_leonllrmc (LLR simple VGA GPU) tt_um_mchiriac (TinyTapeout-Processor2) tt_um_RongGi_tiny_dino (tiny_dino) tt_um_kianv_sv32_soc (KianV SV32 TT Linux SoC) tt_um_chatelao_fp8_multiplier (OCP MXFP8 Streaming MAC Unit) tt_um_filterednoise_infinity_core (Infinity Core) tt_um_alessio8132 (4-bit processor) tt_um_pwm_controller_atudoroi (UART interfaced 8ch PWM controller) tt_um_uart_alu (UART-ALU Processor) tt_um_ALU_t_rick (A fully functional ALU (Arithmetic logic unit)) tt_um_TscherterJunior_top (smolCPU) tt_um_lkhanh_vga_trng (VGA multiplex with TRNG) tt_um_wokwi_456572315745884161 (Tiny tape out test) tt_um_tmr_voter (Triple Modular Redundancy) tt_um_adriantrummer_checker (TinyTapeout VGA Checker) tt_um_jamesbuchanan_silly_mixer (Silly Mixer) tt_um_wokwi_456576419565744129 (tinytapeout_henningp_2bin_to_4bit_decoder) tt_um_ztimer_top (Tiny Tapeout Factory Test for ttihp-timer) tt_um_michaelstambach_vogal (VoGAl) tt_um_teenyspu (TeenySPU) tt_um_wokwi_458752568884674561 (7 segmant ihp resistcode) tt_um_Xelef2000 (RNG) tt_um_gschultz_bouncingcheckers (Bouncing Checkers) tt_um_ygdes_hdsiso8_rs (ttihp-HDSISO8RS) tt_um_malik_tiny_npu (Tiny NPU: 4-Way Parallel INT8 Inference Engine) tt_um_malik_mac_ripple (Gate-Level 8-bit MAC with Ripple-Carry Accumulator) tt_um_faaaa (Demoscreen full of RICH) tt_um_sat_add_blanluc (8 bit saturated adder) tt_um_wokwi_455303279136701441 (Spell. My. Name.) tt_um_thomasherzog_plasma (Plasma) tt_um_YannGuidon_TinyScanChain (TinyScanChain) tt_um_moss_display (moss_display) tt_um_delta (Delta Wing Flight Control Mixer with PWM Output) tt_um_maluei_badstripes (badstripes) tt_um_float_synth_nikleberg (float_synth) tt_um_catalinlazar_ihp_osc_array (IHP Gate Delay Characterizer (3-Flavor)) tt_um_essen (2x2 Systolic array with DFT and bfloat16 - v2) tt_um_ecc_gf2_8 (Tiny_ECC) tt_um_wokwi_459117403524075521 (4-bit ALU) tt_um_gfcwfzkm_scope_bfh_mht1_3 (Basic Oszilloscope and Signal Generator) tt_um_recursivetree_tmmu_top (Tiny MMU) tt_um_prime (8-bit Prime Number Detector) tt_um_gian_alu (tt_gian_alu) tt_um_multitool_soc_mauro_ciccone (Multi-Tool SoC) tt_um_FTEVE_FISH (Flying Fish) tt_um_wscore (8-bit RISC-V Lite CPU) tt_um_wokwi_459234034322375681 (TinyTapeout Signal Box) tt_um_anna_vee (2 digit minute timer) tt_um_zettpe_mini_psg (Mini PSG) tt_um_pmiotti_squares_hypnosis (hypnotic squares) tt_um_mzollin_glitch_detector (Glitch Detector) tt_um_spongent88 (Spongent-88 Hash Accelerator) tt_um_8bit_mac (8bit-mac-unit) tt_um_wokwi_459285910800527361 (4-Bit Counter and Registers Demo) tt_um_tobisma_random_snake (Random Snake) tt_um_maze_game (Maze Explorer Game) tt_um_ihp26a_ring_osc (Verilog ring oscillator) tt_um_vga_ca (vga_ca) tt_um_wokwi_459299619699169281 (TinySRAM) tt_um_jmkr_ece_git_code_lock (Code Lock) tt_um_wokwi_459303685175910401 (Bday Candle Chip) tt_um_wokwi_455293203542942721 (1-4 Counter) tt_um_wokwi_454935456504261633 (2 Bit Adder) tt_um_wokwi_455291660779120641 (74LS138) tt_um_wokwi_455291682546516993 (Mein Hund Gniesbert) tt_um_wokwi_455291649462874113 (Tiny Tapeout Full Adder) tt_um_wokwi_455293410637770753 (Yturkeri_Mytinytapeout) tt_um_wokwi_455291642978471937 (2-Bit Adder) tt_um_wokwi_456118923713667073 (4-Bit Adder) tt_um_wokwi_456571724337390593 (7 Segment Binary Viewer) tt_um_wokwi_456578784059908097 (7 segment number viewer) tt_um_wokwi_456571605697249281 (Hello) tt_um_wokwi_456576571487651841 (7 Segment BCD) tt_um_wokwi_456571686260436993 (Tiny Tapeout Workshop Test) tt_um_wokwi_455291787137823745 (TinyTapeout logic gate test) tt_um_wokwi_455291649222749185 (lriglooCs-first-Wokwi-design) tt_um_wokwi_456578694921494529 (sree) tt_um_wokwi_456571638794523649 (GDS Test) tt_um_2048_vga_game (2048 sliding tile puzzle game (VGA)) tt_um_urish_usb_cdc (USB CDC (Serial) Device) tt_um_tippfehlr_nyan_cat (NYAN CAT) tt_um_wokwi_459210187582694401 (Simple Counter) tt_um_zouzias (Yet another VGA tinytapeout) tt_um_Jan_three_body_solution (Three Body Solution) Available Available Available Available Available Available Available Available Available Available Available Available Available Available Available Available Available Available Available Available Available Available Available Available Available Available Available Available Available Available Available Available Available Available Available Available Available Available Available Available Available Available Available Available Available Available Available Available Available Available Available Available Available Available Available Available Available Available Available Available Available Available Available Available