added a simple register example

This commit is contained in:
Antonin Bas
2015-11-12 10:40:43 -08:00
parent a1c21604d4
commit ca39826949
6 changed files with 205 additions and 0 deletions

View File

@@ -0,0 +1,20 @@
# Register
## Description
This program illustrates as simply as possible how to use registers in P4 and
read / write the register state using the bmv2 runtime CLI.
This will probably change in the future but as of now the data plane is not
doing anything (so don't try to send packets). However you can take a look at
the P4 source code and at the read_register and write_register scripts. You can
also run the following demo:
### Running the demo
To run the demo:
- start the switch with `./run_switch.sh`.
- write a register cell with `write_register.sh`. For example:
`./write_register.sh 123 88` to set `my_register[123]` to 88.
- read a register cell with `read_register.sh`. For example:
`./read_register.sh 123` to read `my_register[123]`.