Skip to content

Commit 2ed34a2

Browse files
author
Maurus Item
committed
Made aux chain modules lane-agnostic.
1 parent 2bb668d commit 2ed34a2

File tree

4 files changed

+148
-181
lines changed

4 files changed

+148
-181
lines changed

src/fpnew_aux.sv

Lines changed: 5 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -21,32 +21,25 @@
2121
module fpnew_aux #(
2222
parameter int unsigned NumPipeRegs = 0,
2323
parameter type TagType = logic,
24-
parameter type AuxType = logic,
25-
parameter int unsigned NumLanes = 1
24+
parameter type AuxType = logic
2625
) (
2726
input logic clk_i,
2827
input logic rst_ni,
2928
// Input signals
3029
input TagType tag_i,
3130
input AuxType aux_i,
32-
input logic is_vector_i,
33-
input logic [NumLanes-1:0] lane_active_i,
3431
// Input Handshake
3532
input logic in_valid_i,
3633
output logic in_ready_o,
3734
input logic flush_i,
3835
// Output signals
3936
output TagType tag_o,
4037
output AuxType aux_o,
41-
output logic is_vector_o,
42-
output logic [NumLanes-1:0] lane_active_o,
4338
// Output handshake
4439
output logic out_valid_o,
4540
input logic out_ready_i,
4641
// Register Enable for Lanes
4742
output logic [NumPipeRegs-1:0] reg_enable_o,
48-
output logic [NumPipeRegs-1:0] vector_reg_enable_o,
49-
output logic [NumLanes-1:0][NumPipeRegs-1:0] lane_reg_enable_o,
5043
// Indication of valid data in flight
5144
output logic busy_o
5245
);
@@ -58,8 +51,6 @@ module fpnew_aux #(
5851
// Input pipeline signals, index i holds signal after i register stages
5952
TagType [0:NumPipeRegs] tag;
6053
AuxType [0:NumPipeRegs] aux;
61-
logic [0:NumPipeRegs] is_vector;
62-
logic [0:NumPipeRegs][NumLanes-1:0] lane_active;
6354
logic [0:NumPipeRegs] valid;
6455

6556
// Ready signal is combinatorial for all stages
@@ -68,9 +59,7 @@ module fpnew_aux #(
6859
// First element of pipeline is taken from inputs
6960
assign tag [0] = tag_i;
7061
assign aux [0] = aux_i;
71-
assign is_vector [0] = is_vector_i;
7262
assign valid [0] = in_valid_i;
73-
assign lane_active[0] = lane_active_i;
7463

7564
// Propagate pipeline ready signal to upstream circuitry
7665
assign in_ready_o = ready[0];
@@ -88,23 +77,12 @@ module fpnew_aux #(
8877
// Valid: enabled by ready signal, synchronous clear with the flush signal
8978
`FFLARNC(valid[i+1], valid[i], ready[i], flush_i, 1'b0, clk_i, rst_ni)
9079

91-
// Enable register if pipleine ready and a valid data item is present
92-
assign reg_ena = ready[i] & valid[i];
93-
94-
// Drive external registers with reg enable
95-
assign reg_enable_o[i] = reg_ena;
96-
97-
// Drive external vector registers with reg enable if operation is a vector
98-
assign vector_reg_enable_o[i] = reg_ena & is_vector[i];
99-
for (genvar l = 0; l < NumLanes; l++) begin
100-
assign lane_reg_enable_o[l][i] = reg_ena & lane_active[i][l];
101-
end
80+
// Enable register if pipeline ready and a valid data item is present
81+
assign reg_enable_o[i] = ready[i] & valid[i];
10282

10383
// Generate the pipeline registers within the stages, use enable-registers
104-
`FFL( tag[i+1], tag[i], reg_ena, TagType'('0))
105-
`FFL( aux[i+1], aux[i], reg_ena, AuxType'('0))
106-
`FFL( is_vector[i+1], is_vector[i], reg_ena, '0 )
107-
`FFL(lane_active[i+1], lane_active[i], reg_ena, '0 )
84+
`FFL( tag[i+1], tag[i], reg_enable_o[i], TagType'('0))
85+
`FFL( aux[i+1], aux[i], reg_enable_o[i], AuxType'('0))
10886
end
10987

11088
// Ready travels backwards from output side, driven by downstream circuitry
@@ -113,9 +91,7 @@ module fpnew_aux #(
11391
// Assign module outputs
11492
assign tag_o = tag [NumPipeRegs];
11593
assign aux_o = aux [NumPipeRegs];
116-
assign is_vector_o = is_vector [NumPipeRegs];
11794
assign out_valid_o = valid [NumPipeRegs];
118-
assign lane_active_o = lane_active[NumPipeRegs];
11995

12096
// Assign output Flags: Busy if any element inside the pipe is valid
12197
assign busy_o = |valid;

src/fpnew_aux_fsm.sv

Lines changed: 15 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -23,37 +23,28 @@ module fpnew_aux_fsm #(
2323
parameter int unsigned NumPipeRegs = 0,
2424
parameter fpnew_pkg::pipe_config_t PipeConfig = fpnew_pkg::BEFORE,
2525
parameter type TagType = logic,
26-
parameter type AuxType = logic,
27-
parameter int unsigned NumLanes = 1
26+
parameter type AuxType = logic
2827
) (
2928
input logic clk_i,
3029
input logic rst_ni,
3130
// Input signals
3231
input TagType tag_i,
3332
input AuxType aux_i,
34-
input logic is_vector_i,
35-
input logic [NumLanes-1:0] lane_active_i,
3633
// Input Handshake
3734
input logic in_valid_i,
3835
output logic in_ready_o,
3936
input logic flush_i,
4037
// Output signals
4138
output TagType tag_o,
4239
output AuxType aux_o,
43-
output logic is_vector_o,
44-
output logic [NumLanes-1:0] lane_active_o,
4540
// Output handshake
4641
output logic out_valid_o,
4742
input logic out_ready_i,
4843
// Register Enable for Lanes
4944
output logic [NumPipeRegs-1:0] reg_enable_o,
50-
output logic [NumPipeRegs-1:0] vector_reg_enable_o,
51-
output logic [NumLanes-1:0][NumPipeRegs-1:0] lane_reg_enable_o,
5245
// Signals for the Lane FSMs
53-
// Signal to start the FSM, will be asserted for one cycle
54-
output logic [NumLanes-1:0] lane_fsm_start_o,
55-
// Signal that the FSM finished it's operation, should be asserted continuously
56-
input logic [NumLanes-1:0] lane_fsm_ready_i,
46+
output logic fsm_start_o,
47+
input logic fsm_ready_i,
5748
// Indication of valid data in flight
5849
output logic busy_o
5950
);
@@ -79,8 +70,6 @@ module fpnew_aux_fsm #(
7970
// Input pipeline signals, index i holds signal after i register stages
8071
TagType [0:NUM_INP_REGS] in_tag;
8172
AuxType [0:NUM_INP_REGS] in_aux;
82-
logic [0:NUM_INP_REGS] in_is_vector;
83-
logic [0:NUM_INP_REGS][NumLanes-1:0] in_lane_active;
8473
logic [0:NUM_INP_REGS] in_valid;
8574

8675
// Ready signal is combinatorial for all stages
@@ -89,16 +78,14 @@ module fpnew_aux_fsm #(
8978
// First element of pipeline is taken from inputs
9079
assign in_tag [0] = tag_i;
9180
assign in_aux [0] = aux_i;
92-
assign in_is_vector [0] = is_vector_i;
9381
assign in_valid [0] = in_valid_i;
94-
assign in_lane_active[0] = lane_active_i;
9582

9683
// Propagate pipeline ready signal to upstream circuitry
9784
assign in_ready_o = in_ready[0];
9885

9986
// Generate the register stages
10087
for (genvar i = 0; i < NUM_INP_REGS; i++) begin : gen_input_pipeline
101-
88+
10289
// Internal register enable for this stage
10390
logic reg_ena;
10491
// Determine the ready signal of the current stage - advance the pipeline:
@@ -110,22 +97,11 @@ module fpnew_aux_fsm #(
11097
`FFLARNC(in_valid[i+1], in_valid[i], in_ready[i], flush_i, 1'b0, clk_i, rst_ni)
11198

11299
// Enable register if pipleine ready and a valid data item is present
113-
assign reg_ena = in_ready[i] & in_valid[i];
114-
115-
// Drive external registers with reg enable
116-
assign reg_enable_o[i] = reg_ena;
117-
118-
// Drive external vector registers with reg enable if operation is a vector
119-
assign vector_reg_enable_o[i] = reg_ena & in_is_vector[i];
120-
for (genvar l = 0; l < NumLanes; l++) begin
121-
assign lane_reg_enable_o[l][i] = reg_ena & in_lane_active[i][l];
122-
end
100+
assign reg_enable_o[i] = in_ready[i] & in_valid[i];
123101

124102
// Generate the pipeline registers within the stages, use enable-registers
125-
`FFL( in_tag[i+1], in_tag[i], reg_ena, TagType'('0))
126-
`FFL( in_aux[i+1], in_aux[i], reg_ena, AuxType'('0))
127-
`FFL( in_is_vector[i+1], in_is_vector[i], reg_ena, '0 )
128-
`FFL(in_lane_active[i+1], in_lane_active[i], reg_ena, '0 )
103+
`FFL( in_tag[i+1], in_tag[i], reg_enable_o[i], TagType'('0))
104+
`FFL( in_aux[i+1], in_aux[i], reg_enable_o[i], AuxType'('0))
129105
end
130106

131107
// ----------
@@ -140,28 +116,22 @@ module fpnew_aux_fsm #(
140116
logic fsm_in_valid, fsm_in_ready;
141117
logic fsm_out_valid, fsm_out_ready;
142118

143-
// Synchronisazion signals
144-
logic fsm_start, fsm_ready, fsm_busy;
119+
logic fsm_busy;
145120

146121
// Data holding signals
147122
TagType held_tag;
148123
AuxType held_aux;
149-
logic held_is_vector;
150-
logic [NumLanes-1:0] held_lane_active;
151124

152125
// Upstream Handshake Connection
153126
assign fsm_in_valid = in_valid[NUM_INP_REGS];
154127
assign in_ready[NUM_INP_REGS] = fsm_in_ready;
155128

156-
// Done when all active lanes are done
157-
assign fsm_ready = &lane_fsm_ready_i;
158-
159129
// FSM to safely apply and receive data from DIVSQRT unit
160130
always_comb begin : flag_fsm
161131
// Default assignments
162132
fsm_out_valid = 1'b0;
163133
fsm_in_ready = 1'b0;
164-
fsm_start = 1'b0;
134+
fsm_start_o = 1'b0;
165135
fsm_busy = 1'b0;
166136
state_d = state_q;
167137

@@ -170,19 +140,19 @@ module fpnew_aux_fsm #(
170140
fsm_in_ready = '1;
171141
if (fsm_in_valid) begin
172142
state_d = BUSY;
173-
fsm_start = 1'b1;
143+
fsm_start_o = 1'b1;
174144
end
175145
end
176146
BUSY: begin
177147
fsm_busy = 1'b1;
178148
// If all active lanes are done send data down chain
179-
if (fsm_ready) begin
149+
if (fsm_ready_i) begin
180150
fsm_out_valid = 1'b1;
181151
if (fsm_out_ready) begin
182152
fsm_in_ready = 1'b1;
183153
if (fsm_in_valid) begin
184154
state_d = BUSY;
185-
fsm_start = 1'b1;
155+
fsm_start_o = 1'b1;
186156
end else begin
187157
state_d = IDLE;
188158
end
@@ -198,7 +168,7 @@ module fpnew_aux_fsm #(
198168
fsm_in_ready = 1'b1;
199169
if (fsm_in_valid) begin
200170
state_d = BUSY;
201-
fsm_start = 1'b1;
171+
fsm_start_o = 1'b1;
202172
end else begin
203173
state_d = IDLE;
204174
end
@@ -220,19 +190,12 @@ module fpnew_aux_fsm #(
220190

221191
`FF(state_q, state_d, IDLE);
222192

223-
// Start Lanes when FSM starts and lane is active
224-
for (genvar l = 0; l < NumLanes; l++) begin
225-
assign lane_fsm_start_o[l] = fsm_start && in_lane_active[NUM_INP_REGS][l];
226-
end
227-
228193
// ----------------
229194
// Data Holding FFs
230195
// ----------------
231196

232-
`FFL( held_tag, in_tag[NUM_INP_REGS], fsm_start, TagType'('0));
233-
`FFL( held_aux, in_aux[NUM_INP_REGS], fsm_start, AuxType'('0));
234-
`FFL( held_is_vector, in_is_vector[NUM_INP_REGS], fsm_start, '0);
235-
`FFL(held_lane_active, in_lane_active[NUM_INP_REGS], fsm_start, '0);
197+
`FFL( held_tag, in_tag[NUM_INP_REGS], fsm_start_o, TagType'('0));
198+
`FFL( held_aux, in_aux[NUM_INP_REGS], fsm_start_o, AuxType'('0));
236199

237200
// ---------------
238201
// Output pipeline
@@ -241,8 +204,6 @@ module fpnew_aux_fsm #(
241204
// Output pipeline signals, index i holds signal after i register stages
242205
TagType [0:NUM_OUT_REGS] out_tag;
243206
AuxType [0:NUM_OUT_REGS] out_aux;
244-
logic [0:NUM_OUT_REGS] out_is_vector;
245-
logic [0:NUM_OUT_REGS][NumLanes-1:0] out_lane_active;
246207
logic [0:NUM_OUT_REGS] out_valid;
247208

248209
// Ready signal is combinatorial for all stages
@@ -255,8 +216,6 @@ module fpnew_aux_fsm #(
255216
// Connect to Hold Register
256217
assign out_tag [0] = held_tag;
257218
assign out_aux [0] = held_aux;
258-
assign out_is_vector [0] = held_is_vector;
259-
assign out_lane_active[0] = held_lane_active;
260219

261220
// Generate the register stages
262221
for (genvar i = 0; i < NUM_OUT_REGS; i++) begin : gen_output_pipeline
@@ -277,17 +236,9 @@ module fpnew_aux_fsm #(
277236
// Drive external registers with reg enable
278237
assign reg_enable_o[NUM_INP_REGS + i] = reg_ena;
279238

280-
// Drive external vector registers with reg enable if operation is a vector
281-
assign vector_reg_enable_o[NUM_INP_REGS + i] = reg_ena & out_is_vector[i];
282-
for (genvar l = 0; l < NumLanes; l++) begin
283-
assign lane_reg_enable_o[l][NUM_INP_REGS + i] = reg_ena & out_lane_active[i][l];
284-
end
285-
286239
// Generate the pipeline registers within the stages, use enable-registers
287240
`FFL( out_tag[i+1], out_tag[i], reg_ena, TagType'('0))
288241
`FFL( out_aux[i+1], out_aux[i], reg_ena, AuxType'('0))
289-
`FFL( out_is_vector[i+1], out_is_vector[i], reg_ena, '0 )
290-
`FFL(out_lane_active[i+1], out_lane_active[i], reg_ena, '0 )
291242
end
292243

293244
// Ready travels backwards from output side, driven by downstream circuitry
@@ -296,9 +247,7 @@ module fpnew_aux_fsm #(
296247
// Assign module outputs
297248
assign tag_o = out_tag [NUM_OUT_REGS];
298249
assign aux_o = out_aux [NUM_OUT_REGS];
299-
assign is_vector_o = out_is_vector [NUM_OUT_REGS];
300250
assign out_valid_o = out_valid [NUM_OUT_REGS];
301-
assign lane_active_o = out_lane_active[NUM_OUT_REGS];
302251

303252
// Assign output Flags: Busy if any element inside the pipe is valid
304253
assign busy_o = |in_valid | |out_valid | fsm_busy;

0 commit comments

Comments
 (0)