This project is a 15 bit Greatest Common Divisor module. Hand it two integers and it will calculate the GCD and output it.
15 bits input on ui and uio, where ui[0] is lsb, and uio[6] is MSB. So:
MSB | LSB | |||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
uio[6] | uio[5] | uio[4] | uio[3] | uio[2] | uio[1] | uio[0] | ui[7] | ui[6] | ui[5] | ui[4] | ui[3] | ui[2] | ui[1] | ui[0] |
uio[7] is used as request signal to signal when first number and second number has been inputted. Request should be hold high when second number has inputted.
uo[7] is used as acknowledge signal, signalling when first input has been received and when GCD has been calculated.
uo[0] to uo[6] will output the GCD when acknowledge is high.
MSB | LSB | |||||
---|---|---|---|---|---|---|
uo[6] | uo[5] | uo[4] | uo[3] | uo[2] | uo[1] | uo[0] |
Assign and hold an integer to the first 15 bits of ui_in and uio_in. Set REQ high. Wait for ACK. Set REQ low. Assign and hold an integer to the first 15 bits of ui_in and uio_in. Set REQ high. Wait for ACK. Read out the GCD. Release REQ to allow for a new calculation.
Buttons and LEDs.
# | Input | Output | Bidirectional |
---|---|---|---|
0 | ui_in[0] | uo_out[0] | uio_in[0] |
1 | ui_in[1] | uo_out[1] | uio_in[1] |
2 | ui_in[2] | uo_out[2] | uio_in[2] |
3 | ui_in[3] | uo_out[3] | uio_in[3] |
4 | ui_in[4] | uo_out[4] | uio_in[4] |
5 | ui_in[5] | uo_out[5] | uio_in[5] |
6 | ui_in[6] | uo_out[6] | uio_in[6] |
7 | ui_in[7] | uo_out[7] | uio_in[7] |