[util] Add Licence Checker

This commit adds a script which can checks the licence headers in our
source code against an expected licence header.

The script can check most text file formats that we have checked into
the repository, though it has some limitations. It ensures the entire
licence appears on consecutive lines in the first comment in the file,
and those lines contain nothing else.

The primary limitation of the checker is that each file suffix can only
match one comment style, which is used for checking for the licence
header. In text formats which accept multiple comment styles, there is
now a canonical one that the licence must use. Where available, the
licence should use a line comment style.

The other limitation is for files where the canonical style is block
comments, like `/* */`, each line must be wrapped in the comment prefix
and suffix, rather than the whole licence header being wrapped in a
single comment prefix and suffix. This is an artefact of how the checker
searches for the licence.

The checker is configured using a hjson file, which contains the exact
licence header, and a list of file patterns to exclude from checking the
licence for, which is used to exclude vendored and other externally
sourced files.

Signed-off-by: Sam Elliott <selliott@lowrisc.org>
diff --git a/util/licence-checker.hjson b/util/licence-checker.hjson
new file mode 100644
index 0000000..53efcfa
--- /dev/null
+++ b/util/licence-checker.hjson
@@ -0,0 +1,61 @@
+// Copyright lowRISC contributors.
+// Licensed under the Apache License, Version 2.0, see LICENSE for details.
+// SPDX-License-Identifier: Apache-2.0
+{
+  licence:
+    '''
+    Copyright lowRISC contributors.
+    Licensed under the Apache License, Version 2.0, see LICENSE for details.
+    SPDX-License-Identifier: Apache-2.0
+    ''',
+  exclude_paths: [
+    # Exclude anything in vendor directories
+    '*/vendor/*/*',
+
+    ## Hardware Exclusions
+
+    # DV Vendored test vectors
+    'hw/dv/sv/test_vectors',
+    # Vendored CRC model
+    'hw/dv/dpi/usbdpi/usb_crc.c',
+    # Vendored HMAC model
+    'hw/ip/hmac/dv/cryptoc_dpi/*',
+    # Vendored FPGA information
+    'hw/top_earlgrey/data/*.xdc',
+    'util/fpga/bram_load.mmi',
+    # Manually checked, files contain additional copyright header lines
+    'hw/ip/usb_fs_nb_pe/rtl/*',
+    'hw/ip/usbdev/rtl/usbdev_iomux.sv',
+    'hw/ip/usbuart/rtl/usb_serial_*_ep.sv',
+
+    ## Software Exclusions
+
+    # Coremark Vendored Files
+    'sw/device/benchmarks/coremark/top_earlgrey/*',
+    # Tock Vendored Files
+    'sw/device/tock/chips/opentitan_common/src/uart.rs',
+    'sw/device/tock/chips/opentitan_common/src/lib.rs',
+    'sw/device/tock/chips/opentitan_common/src/gpio.rs'
+    'sw/device/tock/chips/earlgrey/src/uart.rs',
+    'sw/device/tock/chips/earlgrey/src/timer.rs',
+    'sw/device/tock/chips/earlgrey/src/plic.rs',
+    'sw/device/tock/chips/earlgrey/src/lib.rs',
+    'sw/device/tock/chips/earlgrey/src/interrupts.rs',
+    'sw/device/tock/chips/earlgrey/src/gpio.rs',
+    'sw/device/tock/chips/earlgrey/src/chip.rs',
+    'sw/device/tock/boards/opentitan/src/main.rs',
+    'sw/device/tock/boards/opentitan/src/io.rs',
+    'sw/device/tock/boards/opentitan/layout.ld',
+    'sw/device/tock/boards/opentitan/build.rs',
+    'sw/device/tock/**/*.lock',
+    'sw/device/tock/boards/opentitan/rust-toolchain',
+
+    ## Other Exclusions
+
+    # Other Licences,
+    'util/wavegen/LICENSE.wavedrom',
+    # Site Assets
+    'site/**/assets/scss/**',
+    'site/landing/static/js/tiny-slider.js',
+  ],
+}