
This project streams in a 20 byte IPv4 header one byte per clock cycle and decides whether to allow or drop the packet. It checks the header for errors, verifies the checksum, and identifies the protocol as TCP, UDP, or ICMP. After the final byte it outputs its decision based on whether the header is valid, has a valid checksum, and doesn't match the blocked protocol. Which protocol is blocked can be configured (ICMP by default).
Drive ui_in with the bytes of a 20 byte IPv4 header one byte per clock cycle and hold uio_in[0] (data valid) high throughout. Pulse uio_in[1] (packet start) high on the first byte. After the 20th byte, uo_out reports the result: allow/drop, done, malformed, checksum valid, and protocol type (TCP/UDP/ICMP). To block a different protocol, pulse uio_in[2] (configuration load) with the desired protocol number on ui_in (6 for TCP, 17 for UDP, and 1 for ICMP). A full testbench is in test/test.py.
None.
| # | Input | Output | Bidirectional |
|---|---|---|---|
| 0 | packet byte[0] | allow | data valid (input) |
| 1 | packet byte[1] | drop | packet start (input) |
| 2 | packet byte[2] | done | configuration load (input) |
| 3 | packet byte[3] | malformed header | |
| 4 | packet byte[4] | checksum valid | |
| 5 | packet byte[5] | tcp packet | |
| 6 | packet byte[6] | udp packet | |
| 7 | packet byte[7] | icmp packet |