Skip to content

Commit cad4458

Browse files
committed
removing linear zise option, renaming module
1 parent a451b36 commit cad4458

16 files changed

+42
-244
lines changed

README.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,11 @@ for the rest of the code.
3636

3737
### VIP (Verification IP)
3838

39-
| module | status | description |
40-
|---------------------------------------------|--------|-------------|
41-
| [`tcb_vip_pkg`](hdl/tbn/vip/tcb_vip_pkg.sv) | VIP | Package containing manager/monitor/subordinate code. |
42-
| [`tcb_vip_mem`](hdl/tbn/vip/tcb_vip_mem.sv) | VIP | Multi port memory model. |
43-
| [`tcb_vip_tb` ](hdl/tbn/vip/tcb_vip_tb.sv ) | VIP | Testbench for core VIP functionality. |
39+
| module | status | description |
40+
|--------------------------------------------------|--------|-------------|
41+
| [`tcb_vip_pkg`](hdl/tbn/vip/tcb_vip_pkg.sv) | VIP | Package containing manager/monitor/subordinate code. |
42+
| [`tcb_vip_memory`](hdl/tbn/vip/tcb_if_memory.sv) | VIP | Multi port memory model. |
43+
| [`tcb_vip_tb` ](hdl/tbn/vip/tcb_vip_tb.sv ) | VIP | Testbench for core VIP functionality. |
4444

4545
### Reference implementation library
4646

@@ -76,4 +76,4 @@ for the rest of the code.
7676
1. OpenHW Group [OBI](https://github.com/openhwgroup/obi) (OpenBus Interface)
7777
1. TileLink [1.8.0](https://github.com/chipsalliance/omnixtend/blob/c192bb6862846a24535b3808dc2f8612d44f2ff8/OmniXtend-1.0.3/spec/TileLink-1.8.0.pdf),
7878
[1.8.1](https://starfivetech.com/uploads/tilelink_spec_1.8.1.pdf)
79-
1. OpenTitan [TileLink IP](https://docs.opentitan.org/hw/ip/tlul/doc/)
79+
1. OpenTitan [TileLink IP](https://docs.opentitan.org/hw/ip/tlul/doc/)

doc/TCB.md

+2-8
Original file line numberDiff line numberDiff line change
@@ -464,7 +464,6 @@ The following parameters affect data packing.
464464
| parameter | default | type (enumeration) | description |
465465
|-----------|------------------|--------------------|-------------|
466466
| `PHY.ALW` | `clog2(DBW/SLW)` | `int unsigned` | Alignment width, number of least significant address bits which are zero. |
467-
| `PHY.SIZ` | `LOGARITHMIC` | `tcb_par_size_t` | Transfer size encoding, logarithmic or linear. |
468467
| `PHY.MOD` | `REFERENCE` | `tcb_par_mode_t` | Data position mode. |
469468
| `PHY.ORD` | `DESCENDING` | `tcb_par_order_t` | Byte order, ascending or descending. |
470469

@@ -497,6 +496,8 @@ other values in between can be used for custom implementations.
497496

498497
##### Transfer size encoding
499498

499+
TODO: remove references to LINEAR size.
500+
500501
The `SIZ` parameter encoding defines the following options.
501502
- `LOGARITHMIC`,
502503
- `LINEAR`.
@@ -523,13 +524,6 @@ The width of the transfer size signal `siz` in the logarithmic case is
523524
NOTE: The linear option is an experimental proposal and
524525
is not yet compatible with any other standard or implementation.
525526

526-
A more generic option `LINEAR` allows for any number of bytes
527-
up to the data bus width to be transferred.
528-
In this case the number of transferred bytes is `num=siz+1`.
529-
530-
The width of the transfer size signal `siz` in the linear case is
531-
`clog2(DBW/SLW)==clog2(BEW)`.
532-
533527
The byte enable signal `ben` is restricted in both the logarithmic and linear cases to
534528
only number long sequences of adjacent active bits (representing data bytes),
535529
with all other bits inactive.

hdl/rtl/lib/tcb_lib_decoder.sv

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,12 @@ module tcb_lib_decoder
2020
import tcb_pkg::*;
2121
#(
2222
// TCB parameters (contains address width)
23-
parameter tcb_par_phy_t PHY = TCB_PAR_PHY_DEF,
23+
parameter tcb_par_phy_t PHY = TCB_PAR_PHY_DEF,
2424
// interconnect parameters (manager port number and logarithm)
2525
parameter int unsigned MPN = 2,
2626
localparam int unsigned MPL = $clog2(MPN),
2727
// decoder address and mask array
28-
parameter logic [PHY.ABW-1:0] DAM [MPN-1:0] = '{MPN{PHY.ABW'('x)}}
28+
parameter logic [PHY.ABW-1:0] DAM [MPN-1:0] = '{default: 'x}
2929
)(
3030
// TCB interfaces
3131
tcb_if.sub tcb, // TCB subordinate port (manager device connects here)

hdl/rtl/tcb_if.sv

+2-8
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,7 @@ interface tcb_if
3636
localparam int unsigned PHY_BEW = PHY.DBW / PHY.SLW;
3737

3838
// transfer size width calculation
39-
localparam int unsigned PHY_SZW_LIN = $clog2( PHY_BEW ); // linear
40-
localparam int unsigned PHY_SZW_LOG = $clog2($clog2(PHY_BEW)+1); // logarithmic (default)
41-
// transfer size width selection
42-
localparam int unsigned PHY_SZW = (PHY.SIZ == TCB_LINEAR) ? PHY_SZW_LIN : PHY_SZW_LOG;
39+
localparam int unsigned PHY_SZW = $clog2($clog2(PHY_BEW)+1);
4340

4441
////////////////////////////////////////////////////////////////////////////////
4542
// I/O ports
@@ -132,10 +129,7 @@ interface tcb_if
132129
generate
133130
if (PHY.MOD == TCB_REFERENCE) begin: byteenable
134131
for (genvar b=0; b<PHY_BEW; b++) begin
135-
case (PHY.SIZ)
136-
TCB_LOGARITHMIC: assign req_ben[b] = b < (2** req.siz );
137-
TCB_LINEAR : assign req_ben[b] = b < (2**(2**req.siz));
138-
endcase
132+
assign req_ben[b] = b < (2**req.siz);
139133
end
140134
end: byteenable
141135
else begin

hdl/rtl/tcb_pkg.sv

+1-11
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,6 @@ package tcb_pkg;
3535
// size/mode/order/channel (used for compile time parameters)
3636
////////////////////////////////////////////////////////////////////////////////
3737

38-
// transfer size encoding
39-
typedef enum bit {
40-
TCB_LOGARITHMIC = 1'b0, // logarithmic (2^n)
41-
TCB_LINEAR = 1'b1 // linear (n)
42-
} tcb_par_size_t;
43-
4438
// data position mode
4539
typedef enum bit {
4640
TCB_REFERENCE = 1'b0, // always LSB aligned
@@ -68,7 +62,7 @@ package tcb_pkg;
6862

6963
// physical interface parameter structure
7064
// TODO: the structure is packed to workaround a Verilator bug
71-
typedef struct {
65+
typedef struct packed {
7266
// protocol
7367
int unsigned DLY; // response delay
7468
// signal widths
@@ -77,7 +71,6 @@ package tcb_pkg;
7771
int unsigned DBW; // data bus width
7872
int unsigned ALW; // alignment width
7973
// data packing parameters
80-
tcb_par_size_t SIZ; // transfer size encoding
8174
tcb_par_mode_t MOD; // data position mode
8275
tcb_par_order_t ORD; // byte order
8376
// channel configuration
@@ -94,7 +87,6 @@ package tcb_pkg;
9487
DBW: 32,
9588
ALW: 2, // $clog2(DBW/SLW)
9689
// data packing parameters
97-
SIZ: TCB_LOGARITHMIC,
9890
MOD: TCB_MEMORY,
9991
ORD: TCB_DESCENDING,
10092
// channel configuration
@@ -129,7 +121,6 @@ package tcb_pkg;
129121
status.ABW = phy_val.ABW ==? phy_ref.ABW;
130122
status.DBW = phy_val.DBW ==? phy_ref.DBW;
131123
status.ALW = phy_val.ALW ==? phy_ref.ALW;
132-
status.SIZ = phy_val.SIZ ==? phy_ref.SIZ;
133124
status.MOD = phy_val.MOD ==? phy_ref.MOD;
134125
status.ORD = phy_val.ORD ==? phy_ref.ORD;
135126
status.CHN = phy_val.CHN ==? phy_ref.CHN;
@@ -140,7 +131,6 @@ package tcb_pkg;
140131
if (status.ABW) $error("parameter mismatch PHY.ABW=%d != PHY.ABW=%d", phy_val.ABW, phy_ref.ABW);
141132
if (status.DBW) $error("parameter mismatch PHY.DBW=%d != PHY.DBW=%d", phy_val.DBW, phy_ref.DBW);
142133
if (status.ALW) $error("parameter mismatch PHY.ALW=%d != PHY.ALW=%d", phy_val.ALW, phy_ref.ALW);
143-
if (status.SIZ) $error("parameter mismatch PHY.SIZ=%d != PHY.SIZ=%d", phy_val.SIZ, phy_ref.SIZ);
144134
if (status.MOD) $error("parameter mismatch PHY.MOD=%d != PHY.MOD=%d", phy_val.MOD, phy_ref.MOD);
145135
if (status.ORD) $error("parameter mismatch PHY.ORD=%d != PHY.ORD=%d", phy_val.ORD, phy_ref.ORD);
146136
if (status.CHN) $error("parameter mismatch PHY.CHN=%d != PHY.CHN=%d", phy_val.CHN, phy_ref.CHN);

hdl/tbn/lib/tcb_lib_converter_tb.sv

+1-1
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ module tcb_lib_converter_tb
165165
////////////////////////////////////////////////////////////////////////////////
166166

167167
// memory model subordinate
168-
tcb_vip_mem mem (.tcb (tcb_mem));
168+
tcb_vip_memory mem (.tcb (tcb_mem));
169169

170170
// connect interfaces to interface array
171171
tcb_lib_passthrough pas [0:0] (.sub (tcb_sub), .man (tcb_mem));

hdl/tbn/lib/tcb_lib_register_backpressure_tb.sv

+5-5
Original file line numberDiff line numberDiff line change
@@ -75,10 +75,10 @@ module tcb_lib_register_backpressure_tb
7575
// VIP instances
7676
////////////////////////////////////////////////////////////////////////////////
7777

78-
tcb_vip_dev #("MAN") man (.tcb (tcb_man)); // manager
79-
tcb_vip_dev #("MON") mon_man (.tcb (tcb_man)); // manager monitor
80-
tcb_vip_dev #("MON") mon_sub (.tcb (tcb_sub)); // subordinate monitor
81-
tcb_vip_mem #("SUB") mem (.tcb (tcb_mem)); // subordinate
78+
tcb_vip_dev #("MAN") man (.tcb (tcb_man)); // manager
79+
tcb_vip_dev #("MON") mon_man (.tcb (tcb_man)); // manager monitor
80+
tcb_vip_dev #("MON") mon_sub (.tcb (tcb_sub)); // subordinate monitor
81+
tcb_vip_memory #("SUB") mem (.tcb (tcb_mem)); // subordinate
8282

8383
// connect interfaces to interface array
8484
tcb_lib_passthrough pas [0:0] (.sub (tcb_sub), .man (tcb_mem));
@@ -104,4 +104,4 @@ module tcb_lib_register_backpressure_tb
104104
$dumpvars;
105105
end
106106

107-
endmodule: tcb_lib_register_backpressure_tb
107+
endmodule: tcb_lib_register_backpressure_tb

hdl/tbn/lib/tcb_lib_register_request_tb.sv

+5-5
Original file line numberDiff line numberDiff line change
@@ -76,10 +76,10 @@ module tcb_lib_register_request_tb
7676
// VIP instances
7777
////////////////////////////////////////////////////////////////////////////////
7878

79-
tcb_vip_dev #("MAN") man (.tcb (tcb_man)); // manager
80-
tcb_vip_dev #("MON") mon_man (.tcb (tcb_man)); // manager monitor
81-
tcb_vip_dev #("MON") mon_sub (.tcb (tcb_sub)); // subordinate monitor
82-
tcb_vip_mem mem (.tcb (tcb_mem)); // subordinate
79+
tcb_vip_dev #("MAN") man (.tcb (tcb_man)); // manager
80+
tcb_vip_dev #("MON") mon_man (.tcb (tcb_man)); // manager monitor
81+
tcb_vip_dev #("MON") mon_sub (.tcb (tcb_sub)); // subordinate monitor
82+
tcb_vip_memory mem (.tcb (tcb_mem)); // subordinate
8383

8484
// connect interfaces to interface array
8585
tcb_lib_passthrough pas [0:0] (.sub (tcb_sub), .man (tcb_mem));
@@ -105,4 +105,4 @@ module tcb_lib_register_request_tb
105105
$dumpvars;
106106
end
107107

108-
endmodule: tcb_lib_register_request_tb
108+
endmodule: tcb_lib_register_request_tb

hdl/tbn/lib/tcb_lib_register_response_tb.sv

+5-5
Original file line numberDiff line numberDiff line change
@@ -76,10 +76,10 @@ module tcb_lib_register_response_tb
7676
// VIP instances
7777
////////////////////////////////////////////////////////////////////////////////
7878

79-
tcb_vip_dev #("MAN") man (.tcb (tcb_man)); // manager
80-
tcb_vip_dev #("MON") mon_man (.tcb (tcb_man)); // manager monitor
81-
tcb_vip_dev #("MON") mon_sub (.tcb (tcb_sub)); // subordinate monitor
82-
tcb_vip_mem mem (.tcb (tcb_mem)); // subordinate
79+
tcb_vip_dev #("MAN") man (.tcb (tcb_man)); // manager
80+
tcb_vip_dev #("MON") mon_man (.tcb (tcb_man)); // manager monitor
81+
tcb_vip_dev #("MON") mon_sub (.tcb (tcb_sub)); // subordinate monitor
82+
tcb_vip_memory mem (.tcb (tcb_mem)); // subordinate
8383

8484
// connect interfaces to interface array
8585
tcb_lib_passthrough pas [0:0] (.sub (tcb_sub), .man (tcb_mem));
@@ -105,4 +105,4 @@ module tcb_lib_register_response_tb
105105
$dumpvars;
106106
end
107107

108-
endmodule: tcb_lib_register_response_tb
108+
endmodule: tcb_lib_register_response_tb

hdl/tbn/vip/tcb_vip_mem.sv hdl/tbn/vip/tcb_vip_memory.sv

+6-8
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
// limitations under the License.
1717
////////////////////////////////////////////////////////////////////////////////
1818

19-
module tcb_vip_mem
19+
module tcb_vip_memory
2020
import tcb_pkg::*;
2121
// import tcb_vip_pkg::*;
2222
#(
@@ -69,7 +69,6 @@ module tcb_vip_mem
6969
int unsigned start_addr = 0,
7070
int unsigned finish_addr = SIZ-1
7171
);
72-
int code; // status code
7372
int fd; // file descriptor
7473
fd = $fopen(fn, "w");
7574
for (int unsigned addr=start_addr; addr<finish_addr; addr+=4) begin
@@ -80,7 +79,6 @@ module tcb_vip_mem
8079
// end
8180
end
8281
$fclose(fd);
83-
return code;
8482
endfunction: write_hex
8583

8684
////////////////////////////////////////////////////////////////////////////////
@@ -106,10 +104,10 @@ module tcb_vip_mem
106104
// map write data to a packed array
107105
assign tmp_req_wdt = tcb[i].req.wdt;
108106

109-
assign tmp_req_siz = (tcb[i].PHY.SIZ == TCB_LINEAR) ? tcb[i].req.siz : 2**tcb[i].req.siz;
107+
assign tmp_req_siz = 2**tcb[i].req.siz;
110108

111109
// write access
112-
always @(posedge tcb[i].clk)
110+
always_ff @(posedge tcb[i].clk)
113111
if (tcb[i].trn) begin
114112
if (tcb[i].req.wen) begin: write
115113
// temporary variables
@@ -139,13 +137,13 @@ module tcb_vip_mem
139137
end
140138

141139
// combinational read data
142-
always @(*)
140+
always_comb
143141
if (tcb[i].trn) begin
144142
if (~tcb[i].req.wen) begin: read
145143
// temporary variables
146144
automatic int unsigned adr;
147145
if (tcb[i].PHY.MOD == TCB_REFERENCE) begin: reference
148-
tmp_rsp_rdt = '{default: 'x};
146+
tmp_rsp_rdt[0] = '{default: 'x};
149147
for (int unsigned b=0; b<tmp_req_siz; b++) begin: byteenable
150148
adr = b + int'(tcb[i].req.adr);
151149
tmp_rsp_rdt[0][b] = mem[adr%SIZ];
@@ -184,4 +182,4 @@ module tcb_vip_mem
184182
end: port
185183
endgenerate
186184

187-
endmodule: tcb_vip_mem
185+
endmodule: tcb_vip_memory

hdl/tbn/vip/tcb_vip_pkg.sv

+3-3
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ package tcb_vip_pkg;
4141
localparam int unsigned PHY_SZW_LIN = $clog2( PHY_BEW ); // linear
4242
localparam int unsigned PHY_SZW_LOG = $clog2($clog2(PHY_BEW)+1); // logarithmic (default)
4343
// transfer size width selection
44-
localparam int unsigned PHY_SZW = (PHY.SIZ == TCB_LINEAR) ? PHY_SZW_LIN : PHY_SZW_LOG;
44+
localparam int unsigned PHY_SZW = PHY_SZW_LOG;
4545

4646
////////////////////////////////////////////////////////////////////////////////
4747
////////////////////////////////////////////////////////////////////////////////
@@ -367,10 +367,10 @@ package tcb_vip_pkg;
367367
transfer_array[i].req.ndn = transaction_req.ndn;
368368
transfer_array[i].req.adr = transaction_req.adr;
369369
transfer_array[i].req.ben = '0;
370-
transfer_array[i].req.siz = (PHY.SIZ == TCB_LINEAR) ? PHY_BEW : $clog2(PHY_BEW);
370+
transfer_array[i].req.siz = $clog2(PHY_BEW);
371371
end
372372
if (siz <= PHY_BEW) begin
373-
transfer_array[0].req.siz = (PHY.SIZ == TCB_LINEAR) ? siz : $clog2( siz);
373+
transfer_array[0].req.siz = $clog2( siz);
374374
end
375375
// data signals
376376
for (int unsigned i=0; i<siz; i++) begin

hdl/tbn/vip/tcb_vip_tb.sv

+1-1
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ module tcb_vip_tb
246246
////////////////////////////////////////////////////////////////////////////////
247247

248248
// memory model subordinate
249-
tcb_vip_mem mem (.tcb (tcb_mem));
249+
tcb_vip_memory mem (.tcb (tcb_mem));
250250

251251
////////////////////////////////////////////////////////////////////////////////
252252
// DUT instance

sim/edaplayground/Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ RTL+=${PATH_HDL}/rtl/lib/tcb_lib_converter.sv
3030
# SystemVerilog VIP
3131
TBN+=${PATH_HDL}/tbn/vip/tcb_vip_pkg.sv
3232
TBN+=${PATH_HDL}/tbn/vip/tcb_vip_dev.sv
33-
TBN+=${PATH_HDL}/tbn/vip/tcb_vip_mem.sv
33+
TBN+=${PATH_HDL}/tbn/vip/tcb_vip_memory.sv
3434
#TBN+=${PATH_HDL}/tbn/vip/tcb_vip_tb.sv
3535
## LIBrary
3636
#TBN+=${PATH_HDL}/tbn/lib/tcb_lib_passthrough_tb.sv

sim/filelist.mk

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ RTL+=${PATH_HDL}/rtl/lib/tcb_lib_converter.sv
2929

3030
# SystemVerilog VIP
3131
TBN+=${PATH_HDL}/tbn/vip/tcb_vip_pkg.sv
32-
TBN+=${PATH_HDL}/tbn/vip/tcb_vip_mem.sv
32+
TBN+=${PATH_HDL}/tbn/vip/tcb_vip_memory.sv
3333
#TBN+=${PATH_HDL}/tbn/vip/tcb_vip_tb.sv
3434
# LIBrary
3535
#TBN+=${PATH_HDL}/tbn/lib/tcb_lib_passthrough_tb.sv

0 commit comments

Comments
 (0)