Skip to content

Commit 426ce89

Browse files
committed
Commented nets in design
1 parent 5805201 commit 426ce89

File tree

7 files changed

+102
-45
lines changed

7 files changed

+102
-45
lines changed

src/ip/tis100_1.0/hdl/tis100_v1_0_S00_AXI.v

+5
Original file line numberDiff line numberDiff line change
@@ -501,6 +501,7 @@
501501
begin
502502
// Address decoding for reading registers
503503
case ( axi_araddr[ADDR_LSB+OPT_MEM_ADDR_BITS:ADDR_LSB] )
504+
// sign extend result from dut
504505
4'h0 : reg_data_out <= { {C_S_AXI_DATA_WIDTH-11{last_read[10]}}, last_read};
505506
4'h1 : reg_data_out <= slv_reg1;
506507
4'h2 : reg_data_out <= slv_reg2;
@@ -545,16 +546,20 @@
545546
begin
546547
if ( S_AXI_ARESETN == 1'b0 )
547548
begin
549+
// be ready to read first value available from dut
548550
down_out_ready <= 1'b1;
549551
up_in_valid <= 1'b0;
550552
last_read <= 11'd0;
551553
end
552554
else
553555
begin
556+
// write data received in slv_reg0 over AXI to the up_in_data port of dut
554557
if (slv_reg_rden && axi_araddr[ADDR_LSB+OPT_MEM_ADDR_BITS:ADDR_LSB] == 4'h0)
555558
begin
556559
down_out_ready <= 1'b1;
557560
end
561+
// make next data output from down_out_data from dut available to a
562+
// slv_reg0 AXI read
558563
if (slv_reg_wren && axi_awaddr[ADDR_LSB+OPT_MEM_ADDR_BITS:ADDR_LSB] == 4'h0)
559564
begin
560565
up_in_valid <= 1'b1;

src/ip/tis100_1.0/src/alu.v

+7
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,20 @@
11
`timescale 1ns / 1ps
22

3+
// Module to perform arithmatic operations
4+
35
module alu(
6+
// Code to control the operation the ALU should perform. See my_params.vh
47
input [1:0] instr,
8+
// The current value of the acc register
59
input signed [10:0] acc,
10+
// The value to add/sub from the acc register
611
input signed [10:0] src,
12+
// Result from the ALU operation
713
output signed [10:0] out
814
);
915
`include "my_params.vh"
1016

17+
// Saturate a 12 bit signed integer so it saturates at +-999
1118
function [10:0] saturate;
1219
input signed [11:0] in;
1320
localparam MIN_VAL = -11'sd999;

src/ip/tis100_1.0/src/dir_manager.v

+32-3
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,21 @@
11
`timescale 1ns / 1ps
22

3+
// Module to control comunication with adjacent nodes
4+
35
module dir_manager(
6+
// synchronize with posedge of clk
47
input clk,
8+
// active high reset
59
input reset,
10+
// source port for current operation
611
input [2:0] src,
12+
// destination port for current operation
713
input [2:0] dst,
14+
// data incoming from node to the left
815
input signed [10:0] left_in_data,
16+
// is that incoming data valid
917
input left_in_valid,
18+
// will this node be able to read the data this cycle
1019
output left_in_ready,
1120
input signed [10:0] right_in_data,
1221
input right_in_valid,
@@ -17,8 +26,11 @@ module dir_manager(
1726
input signed [10:0] down_in_data,
1827
input down_in_valid,
1928
output down_in_ready,
29+
// data to send from this node to the node to the left
2030
output signed [10:0] left_out_data,
31+
// is the output data valid this cycle
2132
output left_out_valid,
33+
// will the other node read the data this cycle
2234
input left_out_ready,
2335
output signed [10:0] right_out_data,
2436
output right_out_valid,
@@ -29,15 +41,23 @@ module dir_manager(
2941
output signed [10:0] down_out_data,
3042
output down_out_valid,
3143
input down_out_ready,
44+
// clk_en goes low if this node needs to stall to wait for another node
45+
// to read or write data
3246
output clk_en,
47+
// data read from another node as a source for an operation
3348
output signed [10:0] dir_src_data,
49+
// data to write to another as the destination of an operation
3450
input signed [10:0] dir_dst_data
3551
);
3652
`include "my_params.vh"
3753

54+
// idle, or waiting to source data from another node
3855
localparam STATE_SRC = 1'd0;
56+
// waiting to write data to another node
3957
localparam STATE_DST = 1'd1;
4058

59+
// does the targert source or destination port require communicating with
60+
// another node?
4161
function is_dir_target;
4262
input [2:0] target;
4363
begin
@@ -46,19 +66,28 @@ module dir_manager(
4666
end
4767
endfunction
4868

69+
// the state of internode communication
4970
reg state;
5071

72+
// does the current operation require input from another node
5173
wire perform_in;
74+
// does the current operation require output to another node
5275
wire perform_out;
76+
// register source data in case it needs to be buffered for a move operation
77+
// between direction ports (ie. MOV UP DOWN)
5378
reg signed [10:0] dir_src_data_reg;
79+
// use dir_src_data_reg instead of input dir_dst_data if performing move
80+
// between direction ports (ie. MOV UP DOWN)
5481
wire signed [10:0] dir_dst_data_internal;
82+
// the result choosing the source input from the different directions
5583
wire signed [10:0] dir_src_data_internal;
56-
84+
// when reading from another node, which direction should be selected
5785
wire [2:0] src_sel;
86+
// is this module looking for an input from another node this cycle
5887
wire src_waiting;
59-
88+
// does the current read operation need to wait for another node
6089
wire stall_read;
61-
90+
// is the correct adjacent node ready to receive this node's write data
6291
wire dst_available;
6392

6493
assign clk_en = (!stall_read && state == STATE_SRC && !perform_out) || (state == STATE_DST && dst_available);

src/ip/tis100_1.0/src/instr_rom.v

+17-20
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,39 @@
11
`timescale 1ns / 1ps
2-
//////////////////////////////////////////////////////////////////////////////////
3-
// Company:
4-
// Engineer:
5-
//
6-
// Create Date: 02/11/2020 05:35:21 PM
7-
// Design Name:
8-
// Module Name: InstrRom
9-
// Project Name:
10-
// Target Devices:
11-
// Tool Versions:
12-
// Description:
13-
//
14-
// Dependencies:
15-
//
16-
// Revision:
17-
// Revision 0.01 - File Created
18-
// Additional Comments:
19-
//
20-
//////////////////////////////////////////////////////////////////////////////////
2+
3+
// module to read instructions from rom and control program counter jumps
4+
215
module instr_rom(
6+
// synchronize with posedge of clk
227
input clk,
8+
// only update values when clk_en is high
239
input clk_en,
10+
// active high reset
2411
input reset,
12+
// code for whether to perform a jump
2513
input [3:0] instr,
14+
// current ACC register value
2615
input signed [10:0] acc,
16+
// address to jump to if jump is performed
2717
input signed [10:0] jmp_off,
18+
// instruction at current program counter
2819
output [20:0] opcode
2920
);
3021
`include "my_params.vh"
22+
// memory file to initialize ROM with
3123
parameter MEM_INIT_FILE = "";
24+
// number of valid instructions in ROM
3225
parameter NUM_ENTRIES = 5'd10;
3326

27+
// memory for storing instructinos
3428
reg [20:0] ram[31:0];
3529

30+
// program counter pointing to current instruction
3631
reg [4:0] pc;
32+
// does the current operation code for a jump
3733
wire jmp_en;
38-
34+
// address to jump to if jump is to be performed
3935
wire signed [11:0] pc_jmp;
36+
// sign extended pc to avoid signed arithmetic issue
4037
wire signed [5:0] pc_ext;
4138

4239
assign jmp_en = (instr == OP_JMP) ||

src/ip/tis100_1.0/src/op_decode.v

+11
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,25 @@
11
`timescale 1ns / 1ps
22

3+
// Module for decoding binary instructions
4+
35
module op_decode(
6+
// binary instruction loaded from memory
47
input [20:0] op_code,
8+
// the source port to load from (only used for some instructions)
59
output [2:0] src,
10+
// the constant value store in the instruction (only used for some instructions)
611
output signed [10:0] const,
12+
// the destination port to write to (only used for some instructions)
713
output [2:0] dst,
14+
// code to control program counter with jump operations
815
output [3:0] pc_instr,
16+
// code to select arithmatic opterations
917
output [1:0] alu_instr,
18+
// code to control writing to ACC and BAK registers
1019
output [1:0] registers_instr,
20+
// code to control routing input values
1121
output [1:0] in_mux_sel,
22+
// code to control routing output values
1223
output out_mux_sel
1324
);
1425
`include "my_params.vh"

src/ip/tis100_1.0/src/registers.v

+8
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,19 @@
11
`timescale 1ns / 1ps
22

3+
// Module to control storing values to BAK and ACC registers
4+
35
module registers(
6+
// synchronize with posedge of clk
47
input clk,
8+
// only update values when clk_en is high
59
input clk_en,
10+
// active high reset
611
input reset,
12+
// code to control what operation to perform. See my_params.vh
713
input [1:0] instr,
14+
// new value to store in ACC during write operation
815
input signed [10:0] val_in,
16+
// current value of ACC register
917
output reg signed [10:0] acc
1018
);
1119
`include "my_params.vh"

src/ip/tis100_1.0/src/t21_node.v

+22-22
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,17 @@
11
`timescale 1ns / 1ps
2-
//////////////////////////////////////////////////////////////////////////////////
3-
// Company:
4-
// Engineer:
5-
//
6-
// Create Date: 02/11/2020 05:34:23 PM
7-
// Design Name:
8-
// Module Name: T21Node
9-
// Project Name:
10-
// Target Devices:
11-
// Tool Versions:
12-
// Description:
13-
//
14-
// Dependencies:
15-
//
16-
// Revision:
17-
// Revision 0.01 - File Created
18-
// Additional Comments:
19-
//
20-
//////////////////////////////////////////////////////////////////////////////////
212

3+
// TIS100 T21 processing node
224

235
module t21_node(
6+
// synchronize with posedge of clk
247
input clk,
8+
// active high reset
259
input reset,
10+
// data incoming from node to the left
2611
input signed [10:0] left_in_data,
12+
// is that incoming data valid
2713
input left_in_valid,
14+
// will this node be able to read the data this cycle
2815
output signed left_in_ready,
2916
input signed [10:0] right_in_data,
3017
input right_in_valid,
@@ -35,8 +22,11 @@ module t21_node(
3522
input signed [10:0] down_in_data,
3623
input down_in_valid,
3724
output signed down_in_ready,
25+
// data to send from this node to the node to the left
3826
output signed [10:0] left_out_data,
27+
// is the output data valid this cycle
3928
output left_out_valid,
29+
// will the other node read the data this cycle
4030
input signed left_out_ready,
4131
output signed [10:0] right_out_data,
4232
output right_out_valid,
@@ -52,23 +42,33 @@ module t21_node(
5242
parameter MEM_INIT_FILE = "test_mult.mem";
5343
parameter NUM_ENTRIES = 5'd8;
5444

45+
// clk_en goes low to stall if dir_manager_0 needs to wait for an adjacent
46+
// node
5547
wire clk_en;
5648

49+
// current instruction to decode
5750
wire [20:0] op_code;
58-
51+
// code to control jumps
5952
wire [3:0] pc_instr;
53+
// which source and destination port does the current operation use
6054
wire [2:0] src, dst;
55+
// what arithmatic operation should be performed
6156
wire [1:0] alu_instr;
57+
// how should the BAK and ACC registers be updated
6258
wire [1:0] registers_instr;
59+
// controls source mux
6360
wire [1:0] in_mux_sel;
61+
// controls destination mux
6462
wire out_mux_sel;
63+
// constant value loaded from current instruction
6564
wire signed [10:0] const;
6665

6766
wire signed [10:0] acc_reg, alu_output;
68-
67+
// data from selected source (ACC, direction port, or constant)
6968
wire signed [10:0] src_input;
69+
// data to write to move destination (ALU output, or src_input)
7070
wire signed [10:0] dst_output;
71-
71+
// data read from direction source port
7272
wire signed [10:0] dir_output;
7373

7474
dir_manager dir_manager_0(

0 commit comments

Comments
 (0)