English version draft

Assisted-by: Claude:claude-4.6-sonnet
This commit is contained in:
Andrei Solodovnikov
2026-04-12 13:53:25 +03:00
parent 63260f434e
commit f3fcd27387
74 changed files with 5133 additions and 5875 deletions

View File

@@ -1,101 +1,105 @@
# Проверка работы регистрового файла на ПЛИС
# Testing the Register File on FPGA
После того, как вы проверили на моделировании регистровый файл, вам необходимо проверить его работу на прототипе в ПЛИС.
After verifying the register file in simulation, you need to test it on an FPGA prototype.
Инструкция по реализации прототипа описана [здесь](../../../Vivado%20Basics/07.%20Program%20and%20debug.md).
Instructions for implementing the prototype are described [here](../../../Vivado%20Basics/07.%20Program%20and%20debug.md).
На _рис. 1_ представлена схема прототипа в ПЛИС.
_Fig. 1_ shows the prototype schematic on the FPGA.
![../../../.pic/Labs/board%20files/nexys_rf_riscv_structure.drawio.svg](../../../.pic/Labs/board%20files/nexys_rf_riscv_structure.drawio.svg)
_Рисунок 1. Структурная схема модуля `nexys_rf_riscv`._
_Figure 1. Block diagram of the `nexys_rf_riscv` module._
## Описание используемой периферии
## Peripheral Description
Периферия показана на _рис. 2_.
The peripherals are shown in _Fig. 2_.
![../../../.pic/Labs/board%20files/nexys_rf_riscv_control.drawio.svg](../../../.pic/Labs/board%20files/nexys_rf_riscv_control.drawio.svg)
_Рисунок 2. Периферия, доступная прототипу._
_Figure 2. Peripherals available to the prototype._
- ### Переключатели и кнопки.
- ### Switches and Buttons
Для работы с регистровым файлом необходимо выставлять сигналы адресов и данных.
У платы недостаточно переключателей для такого количества входов регистрового файла, поэтому адреса и данные задаются одним источником ввода:
Working with the register file requires setting address and data signals.
The board does not have enough switches for all register file inputs, so addresses and data are provided from a single input source:
1. Ввод **адресов** (`read_addr1_i`/`read_addr2_i`/`write_addr_i`) регистрового файла осуществляется через переключатели `SW[14:0]`. Соответствие следующее:
1. **Address** inputs (`read_addr1_i` / `read_addr2_i` / `write_addr_i`) of the register file are set via switches `SW[14:0]` as follows:
- `SW[ 4: 0]``write_addr_i`
- `SW[ 9: 5]``read_addr2_i`
- `SW[14:10]``read_addr1_i`
Для того чтобы выставить введенные адреса на входные порты регистрового файла, необходимо нажать кнопку `BTND` (`addr_en` на _рис. 2_). Таким образом, происходит запоминание адресов в элемент памяти.
1. Ввод **данных** (`write_data_i`) регистрового файла осуществляется через переключатели `SW[15:0]`. Таким образом, можно выставить только младшие 16 бит данных. Для записи введенных данных по адресу `write_addr_i` используется кнопка `BTNR` (`we` на _рис. 2_).
- ### Светодиоды
To latch the entered addresses onto the register file input ports, press button `BTND` (`addr_en` in _Fig. 2_). This stores the addresses in a memory element.
Светодиоды `LED[14:0]` отображают адреса (`read_addr1_i`/`read_addr2_i`/`write_addr_i`), которые выставлены в данный момент на порты регистрового файла:
1. **Data** input (`write_data_i`) of the register file is set via switches `SW[15:0]`. Only the lower 16 bits of data can be entered this way. To write the entered data to the `write_addr_i` address, press button `BTNR` (`we` in _Fig. 2_).
- ### LEDs
LEDs `LED[14:0]` display the addresses (`read_addr1_i` / `read_addr2_i` / `write_addr_i`) currently set on the register file ports:
- `LED[ 4: 0]``write_addr_i`
- `LED[ 9: 5]``read_addr2_i`
- `LED[14:10]``read_addr1_i`
- ### Семисегментные индикаторы
- ### Seven-Segment Displays
На левом блоке семисегментных индикаторов (индикаторы 7-4) отображется значение младших 16-ти бит порта `read_data1_o`, а на правом блоке семисегментных индикаторов (индикаторы 3-0) отображается значение младших 16-ти бит порта `read_data2_o`.
The left block of seven-segment displays (displays 74) shows the lower 16 bits of port `read_data1_o`, and the right block (displays 30) shows the lower 16 bits of port `read_data2_o`.
Числа отображаются в **шестнадцатеричном** формате.
Numbers are displayed in **hexadecimal** format.
## Выполнение операций с регистровым файлом на прототипе
## Performing Register File Operations on the Prototype
Доступные операции: запись, чтение.
Available operations: write, read.
- ### Запись
- ### Write
Рассмотрим последовательность действий, которые надо осуществить для записи в регистровый файл, на примере.
The following example walks through the steps required to write to the register file.
1. Запишем значение `0x1234` в регистр `5`.
1. Write the value `0x1234` to register `5`.
1. Сразу после прошивки, как видно по негорящим светодиодам, на портах регистрового файла выставлены нулевые адреса. Нам нужно изменить адрес записи, поэтому выставим на переключателях значение `5` и нажмем кнопку `BTND` (см. _рис. 3_).
1. Immediately after programming, as indicated by the unlit LEDs, all register file ports have zero addresses. We need to change the write address, so set the switches to `5` and press button `BTND` (see _Fig. 3_).
![../../../.pic/Labs/board%20files/nexys_rf_riscv_write_addr_5.drawio.svg](../../../.pic/Labs/board%20files/nexys_rf_riscv_write_addr_5.drawio.svg)
_Рисунок 3. Выставление адреса `5` на порт `write_addr_i` регистрового файла._
_Figure 3. Setting address `5` on the `write_addr_i` port of the register file._
Обратите внимание: на светодиодах сразу после нажатия кнопки отображается адрес `5`.
1. Чтобы записать данные в указанный (пятый) регистр, выставим на переключателях значение `0x1234` и нажмем кнопку `BTNR` (см. _рис. 4_).
Note: the LEDs immediately display address `5` after the button is pressed.
1. To write data to the specified (fifth) register, set the switches to `0x1234` and press button `BTNR` (see _Fig. 4_).
![../../../.pic/Labs/board%20files/nexys_rf_riscv_write_data_1234.drawio.svg](../../../.pic/Labs/board%20files/nexys_rf_riscv_write_data_1234.drawio.svg)
_Рисунок 4. Запись `0x1234` в регистр `5`._
_Figure 4. Writing `0x1234` to register `5`._
1. Запишем значение `0x5678` в регистр `6`.
1. Write the value `0x5678` to register `6`.
1. Выставим на блок переключателей, отвечающих за порт записи, значение `6` и нажмем кнопку `BTND` (см. _рис. 5_).
1. Set the write-address switches to `6` and press button `BTND` (see _Fig. 5_).
![../../../.pic/Labs/board%20files/nexys_rf_riscv_write_addr_6.drawio.svg](../../../.pic/Labs/board%20files/nexys_rf_riscv_write_addr_6.drawio.svg)
_Рисунок 5. Выставление адреса `6` на порт `write_addr_i` регистрового файла._
_Figure 5. Setting address `6` on the `write_addr_i` port of the register file._
Обратите внимание: на светодиодах сразу после нажатия кнопки отображается адрес `6`.
1. Чтобы записать данные в указанный (шестой) регистр, выставим на переключателях значение `0x5678` и нажмем кнопку `BTNR` (см. _рис. 6_).
Note: the LEDs immediately display address `6` after the button is pressed.
1. To write data to the specified (sixth) register, set the switches to `0x5678` and press button `BTNR` (see _Fig. 6_).
![../../../.pic/Labs/board%20files/nexys_rf_riscv_write_data_5678.drawio.svg](../../../.pic/Labs/board%20files/nexys_rf_riscv_write_data_5678.drawio.svg)
_Рисунок 6. Запись `0x5678` в регистр `6`._
_Figure 6. Writing `0x5678` to register `6`._
- ### Чтение
- ### Read
Рассмотрим последовательность действий, которые надо осуществить для чтения из регистрового файла, на примере. Прочитаем из регистров `5` и `6` заранее записанные значения `0x1234` и `0x5678` соответственно и выведем его на оба блока семисегментных индикаторов 7-0 и 3-0.
The following example walks through the steps required to read from the register file. We will read the previously written values `0x1234` and `0x5678` from registers `5` and `6` respectively, and display them on both seven-segment display blocks (74 and 30).
Выставим значение `5` и `6` на блоки переключателей `ra1` и `ra2` (см. _рис. 2_) соответственно, и нажмем кнопку `BTND`, чтобы обновить адрес значением с переключателей (см. _рис. 7_).
Set value `5` and `6` on the `ra1` and `ra2` switch groups (see _Fig. 2_) respectively, then press button `BTND` to update the address with the switch values (see _Fig. 7_).
![../../../.pic/Labs/board%20files/nexys_rf_riscv_read.drawio.svg](../../../.pic/Labs/board%20files/nexys_rf_riscv_read.drawio.svg)
_Рисунок 7. Чтение из регистров `5` и `6`._
_Figure 7. Reading from registers `5` and `6`._
Обратите внимание на то, что для чтения достаточно выставить нужный адрес на порт регистрового файла, и содержимое регистра оказывается считанным.
Note that for a read operation, it is sufficient to set the desired address on the register file port — the register contents are immediately available on the output.
> [!NOTE]
> Кнопка сброса `CPU_RESETN` не сбрасывает содержимое регистрового файла, т.к. сигнал сброса не заведен в модуль регистрового файла, а модуль `nexys_rf_riscv` самостоятельно его не сбрасывает. Для сброса можно осуществить перепрошивку ПЛИС.
> The `CPU_RESETN` reset button does not clear the contents of the register file, because the reset signal is not connected to the register file module, and the `nexys_rf_riscv` module does not reset it independently. To reset, you can reprogram the FPGA.
Попробуйте записать информацию в нулевой регистр, затем по другим адресам. После чего считайте записанную информацию и убедитесь, что она соответствует той, которую вы записывали (с учетом особенностей регистрового файла RISC-V).
Try writing data to register zero, then to other addresses. Then read back the written data and verify that it matches what you wrote (taking into account the special behavior of the RISC-V register file).