HRM components | # | CPU components |
---|---|---|
Office Worker | 1 | Register |
In/Out belts | 2, 3 | I/O |
Floor Tiles | 4 | Memory (RAM) |
Program | 5 | Program Memory |
6 | Program Counter | |
7 | Instruction Register |
Para ver esta conversación en el sitio web, visita https://groups.google.com/d/msgid/fpga-wars-explorando-el-lado-libre/f138de9d-919a-465e-b96b-b56e7df232c4%40googlegroups.com.--
Has recibido este mensaje porque estás suscrito al grupo "FPGAwars: explorando el lado libre" de Grupos de Google.
Para cancelar la suscripción a este grupo y dejar de recibir sus mensajes, envía un correo electrónico a fpga-wars-explorando-el-lado-libre+unsubscribe@googlegroups.com.
Para publicar en este grupo, envía un correo electrónico a fpga-wars-explorando-el-lado-li...@googlegroups.com.
Visita este grupo en https://groups.google.com/group/fpga-wars-explorando-el-lado-libre.
--
Has recibido este mensaje porque estás suscrito a un tema del grupo "FPGAwars: explorando el lado libre" de Grupos de Google.
Para cancelar la suscripción a este tema, visita https://groups.google.com/d/topic/fpga-wars-explorando-el-lado-libre/f8mjYT8JR5k/unsubscribe.
Para cancelar la suscripción a este grupo y a todos sus temas, envía un correo electrónico a fpga-wars-explorando-el...@googlegroups.com.
Para publicar en este grupo, envía un correo electrónico a fpga-wars-explora...@googlegroups.com.
Visita este grupo en https://groups.google.com/group/fpga-wars-explorando-el-lado-libre.
Para ver esta conversación en el sitio web, visita https://groups.google.com/d/msgid/fpga-wars-explorando-el-lado-libre/44550101-c738-4beb-8f90-32fec26bc351%40googlegroups.com.
Respondo de nuevo para comentar que los videojuegos referenciados en el articulo que se enlaza en el README merecen un vistazo: http://www.zachtronics.com/shenzhen-io/, http://www.zachtronics.com/tis-100/
Un par de comentarios sobre tu diseño:
- Por la descripción de INBOX (https://github.com/adumont/hrm-cpu#inbox) parece que lo que quieres es una FIFO. Si es así, gestionar "a mano" cuantos elementos hay en cada momento es ineficiente. Puedes usar el truco de generar dos punteros que tengan un bit más que los necesarios para representar la profundidad de la memoria. Por ejemplo, para una FIFO de cuatro posiciones, generas dos punteros de tres bits. Con ello, las señales de Empty y Full se calculan utilizando un comparador de igualdad y una puerta XOR. Ver ejemplo en VHDL: https://github.com/VUnit/vunit/blob/master/examples/vhdl/array_axis_vcs/src/fifo.vhd#L80-L82 He visto que las issues 1 y 5 están relacionadas. Pero, como indicas que escribes explícitamente el número de elementos de un bloque, supongo que utilizar FIFOs implica cambios en la lógica de control, y no solo en el datapath.
- En este mismo sentido. Si lo que quieres con la FIFO es enviar diferentes secuencias de datos de longitud variable, pero necesitas saber cuándo ha terminado un bloque y cuándo empieza otro, te recomiento echar un vistazo a AXI Stream. El siguiente ejemplo muestra cómo convertir una FIFO en un maestro/esclavo AXI Stream.
- En el mismo apartado indicas que "The INBOX FSM is very simple. (for some reason, I was unable to create it in Logisim with 2-bit states encoding, that's probaby a bug. That's why it has 3 bit state encoding.)". Si te fijas, esto es debido a que se está utilizando codificación "one-hot" para la FSM. Como el nombre indica, esto requiere un bit por cada estado de la FSM (menos uno), de forma que en cualquier momento de la ejecución todos los bits están a cero excepto uno (salvo en standby, que no hay ninguno). Para "optimizarlo" y utilizar 2-bits tienes que mirar si es posible indicar a la herramienta que utilice codificación "binary" o "gray": https://en.wikipedia.org/wiki/One-hot
--
Has recibido este mensaje porque estás suscrito a un tema del grupo "FPGAwars: explorando el lado libre" de Grupos de Google.
Para cancelar la suscripción a este tema, visita https://groups.google.com/d/topic/fpga-wars-explorando-el-lado-libre/f8mjYT8JR5k/unsubscribe.
Para cancelar la suscripción a este grupo y a todos sus temas, envía un correo electrónico a fpga-wars-explorando-el...@googlegroups.com.
Para publicar en este grupo, envía un correo electrónico a fpga-wars-explora...@googlegroups.com.
Visita este grupo en https://groups.google.com/group/fpga-wars-explorando-el-lado-libre.
Para ver esta conversación en el sitio web, visita https://groups.google.com/d/msgid/fpga-wars-explorando-el-lado-libre/51d3da69-a579-49c1-a4d6-26e2d1ec849a%40googlegroups.com.
This level is more complex. In level 32 there are 14 letters on the tiles, plus a 0. For each letters that comes into the Inbox, you have to compute how many tiles have the same letter, and send the total count to the Outbox.
This is how I did it in the real game:
Now let see how my HRM CPU behaves with the same program. First let's have a look at the program itself:
Here's my solution for Level 32. It involves direct (COPYFROM 14
) and indirect adressing mode (COPYFROM [19]
).
init:
00: 20 0e ; COPYFROM 14
02: 30 13 ; COPYTO 19
04: 30 10 ; COPYTO 16
06: 00 00 ; INBOX
07: 30 0f ; COPYTO 15
nexttile:
09: 28 13 ; COPYFROM [19]
0b: 90 19 ; JUMPZ outputcount
0d: 50 0f ; SUB 15
0f: 90 15 ; JUMPZ inccount
inctileaddr:
11: 60 13 ; BUMP+ 19
13: 80 09 ; JUMP nexttile
inccount:
15: 60 10 ; BUMP+ 16
17: 80 11 ; JUMP inctileaddr
outputcount:
19: 20 10 ; COPYFROM 16
1b: 10 00 ; OUTBOX
1c: 80 00 ; JUMP init
(This is the output of my Assembler)
The corresponding Logisim memory dump (machine languag, ready for loading into Logisim) is:
v2.0 raw
20 0e 30 13 30 10 00 30 0f 28 13 90 19 50 0f 90 15 60 13 80 09 60 10 80 11 20 10 10 80 00
Below we can see it is loaded into the program memory (PROG) of the CPU:
Now let's see the Inbox:
We'll load 5 elements: 1
, 2
, 5
, 3
and 4
into the INBOX. As we have to load first the number of elements, it is in total 6 items:
INBOX |
---|
0x05 |
0x01 |
0x02 |
0x05 |
0x03 |
0x04 |
In Logisim format that is:
v2.0 raw
05 01 02 05 03 04
We load the INBOX in Logisim:
In this level, we also have to pre-load the tiles in MEMORY. Here's the file:
v2.0 raw
02 01 04 02 03 04 01 02 01 04 03 02 01 02 00
Let's pause and count mentally how many of each item we have in the Tiles:
Item | Count |
---|---|
0x01 | 4 |
0x02 | 5 |
0x03 | 2 |
0x04 | 3 |
0x05 | 0 |
(That is what we expect to get in the OUTBOX)
Before running the program, let's clear the OUTBOX:
And finally we run the program:
The program will finish when the last item in the inbox is processed. Let's see the result we get in OUTBOX:
OUTBOX |
---|
0x05 |
0x04 |
0x00 |
0x02 |
0x03 |
Indeed, we can verify that this is the total count of each item (from the INBOX) in the tiles: 4 x 0x01, 5 x 0x02, 0 x 0x05, 2 x 0x03 and 3 x 0x04.
So it works!!!
--
Has recibido este mensaje porque estás suscrito al grupo "FPGAwars: explorando el lado libre" de Grupos de Google.
Para cancelar la suscripción a este grupo y dejar de recibir sus mensajes, envía un correo electrónico a fpga-wars-explorando-el-lado-libre+unsubscribe@googlegroups.com.
Para publicar en este grupo, envía un correo electrónico a fpga-wars-explorando-el-lado-li...@googlegroups.com.
Visita este grupo en https://groups.google.com/group/fpga-wars-explorando-el-lado-libre.
Para ver esta conversación en el sitio web, visita https://groups.google.com/d/msgid/fpga-wars-explorando-el-lado-libre/74876e5c-e052-4071-97ea-38d62f0acd0b%40googlegroups.com.