2016-03-05 16:36:58 -05:00
|
|
|
GPIO: General Purpose Software Programmable IO
|
2016-03-05 16:42:41 -05:00
|
|
|
==============================================
|
2016-02-26 19:06:38 -05:00
|
|
|
|
2016-03-05 16:36:58 -05:00
|
|
|
## Features
|
|
|
|
* Input pins accessible through GPIO_IN register read
|
2016-03-10 14:17:33 -05:00
|
|
|
* Output pins controllable through GPIO_OUT register writes
|
2016-03-05 16:36:58 -05:00
|
|
|
* Vector wide "OR" interrupt on edge detection
|
2016-04-10 23:24:26 -04:00
|
|
|
* Maskable input data and interrupts
|
|
|
|
* Special And/or/xor register access modes for atomic control of output pins
|
2016-03-05 16:36:58 -05:00
|
|
|
|
|
|
|
## Registers
|
|
|
|
|
2016-04-10 23:24:26 -04:00
|
|
|
| Register Name |Addr[6:3]|Access |Default| Description |
|
|
|
|
|---------------|---------|-------|-------|---------------------------------|
|
|
|
|
| GPIO_DIR | 0x0 | WR | L | Direction(0=input, 1=output) |
|
|
|
|
| GPIO_IN | 0x1 | RD | n/a | Input pin value |
|
|
|
|
| GPIO_OUT | 0x2 | WR | L | Output pin value |
|
|
|
|
| GPIO_OUTCLR | 0x3 | WR | n/a | Output = output & ~value |
|
|
|
|
| GPIO_OUTSET | 0x4 | WR | n/a | Output = output "or" value |
|
|
|
|
| GPIO_OUTXOR | 0x5 | WR | n/a | Output = output ^ value |
|
|
|
|
| GPIO_IMASK | 0x6 | WR | H | Interrupt mask (1=mask) |
|
2016-05-03 20:44:07 +02:00
|
|
|
| GPIO_ITYPE | 0x7 | WR | n/a | IRQ type (0=edge,1=level) |
|
2016-04-10 23:24:26 -04:00
|
|
|
| GPIO_IPOL | 0x8 | WR | H | IRQ polarity (1=rising edge/high)|
|
|
|
|
| GPIO_ILAT | 0x9 | RD | L | IRQ Status (1=latched irq) |
|
|
|
|
| GPIO_ILATCLR | 0xA | WR | n/a | Clears ILAT(1=clear) |
|
2016-03-05 16:36:58 -05:00
|
|
|
|
|
|
|
## Interface
|
|
|
|
|
|
|
|
* clk
|
|
|
|
* active low async reset
|
|
|
|
* emesh register access interface
|
|
|
|
* IO pin interface (in/out/tristate)
|
|
|
|
|
|
|
|
## Parameters
|
2016-03-05 16:42:41 -05:00
|
|
|
* AW : address space width (32/64)
|
|
|
|
* N : number of IO (1-64)
|
|
|
|
|
|
|
|
## Code
|
|
|
|
* [gpio.v](hdl/gpio.v)
|
|
|
|
* [gpio_regmap.vh](hdl/gpio_regmap.vh)
|
2016-03-05 16:36:58 -05:00
|
|
|
|
|
|
|
## Building
|
|
|
|
|
|
|
|
```cd
|
|
|
|
cd $OH_HOME/gpio/dv
|
|
|
|
./build.sh # build with Icarus
|
|
|
|
./run.sh tests/test_regs.emf # run test
|
|
|
|
gtkwave waveform.vcd # open waveform
|
|
|
|
```
|
|
|
|
|
|
|
|
## Language
|
|
|
|
* Verilog
|
|
|
|
|
|
|
|
## Authors
|
|
|
|
* Andreas Olofsson
|
|
|
|
|
|
|
|
## License
|
|
|
|
* MIT
|
2016-02-26 19:06:38 -05:00
|
|
|
|
|
|
|
|