hyperbus
¶
Initializie Hyperbus library.
Modules:
-
hbc_fsm–Contains HyperBus_FSM class for the State Machine in hyperbus protocol.
-
hyperbus_controller–HyperBusController class.
Classes:
-
HyperBusController–HyperBus Controller class with methods.
-
HyperBus_FSM–State machine class for hyperbus.
HyperBusController
¶
HyperBusController(dut: SimHandleBase)
Bases: HyperBus_FSM
HyperBus Controller class with methods.
Reset, ReadReg, WriteReg, ReadMem, WriteMem, clk_cycle, ck_cycle, int_to_8bit_array, arr_io_dq, Assign, wait_100ns, drive_dq, monitor_dq, wait_until_mem_ready.
Methods:
-
Assign–Drives and Monitors signals between controllor and dut.
-
Init–Initialize clock, Controller FSM and connects dut with controllor.
-
ReadMem–Reads the memory content form the starting address for a specified number of bytes.
-
ReadReg–Reads from a register based on the address, returns 2 bytes.
-
Reset–Reset based on timing requirement of the rtl model.
-
WriteMem–Writes the memory content form the starting address for specified bytes of data.
-
WriteReg–Writes 2 bytes to a register based on the address.
-
arr_io_dq–Returns the bit at an index for the 8 bit array.
-
ca_words–Splits the 48bit CA into 6 bytes for transmission.
-
ck_cycle–Updates the derived clock based on reset and chip select lines.
-
clk_cycle–Generate the clock for the test.
-
drive_dq–Drives the data bus.
-
fsm–FSM for states IDLE, CAs, WR_LATENCY, WRITE, READ, DONE.
-
fsm_reset–Resets the fsm to IDLE state.
-
generate_random_data–Generate random num number of byte.
-
get_time–Get simulation time.
-
int_to_8bit_array–Converts Integer into a 8 bit binary string array.
-
is_rwdsvalid–Samples the RWDS input signal every 5ns and stores it in rwds_d.
-
log–Logs a message value with prefixed simulation time.
-
monitor_dq–Moniters the data bus.
-
rwds_valid–Returns True if RWDS is valid.
-
rx_data–Returns hex string of a 32 bit number.
-
swap_halves–Swaps the upper and lower 16 bits of a 32-bit value used for word alignment, endianess conversion into little endian.
-
update_ca–Builds the 48-bit command/address word using write strobe, config access, and memory address fields.
-
wait_100ns–Waits for 100ns.
-
wait_until_mem_ready–Continously polls for every half clock cycle to check if the memory is ready.
-
wdata_words–Splits the 32 bit write data into bytes, with special arrangement if CA[46]=1.
-
wstrb_words–Splits Write strobe into bits for each byte lane.
Source code in src/cocotbext/hyperbus/hyperbus_controller.py
16 17 18 19 | |
Assign
async
¶
Assign(dut: SimHandleBase) -> None
Drives and Monitors signals between controllor and dut.
Source code in src/cocotbext/hyperbus/hyperbus_controller.py
185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 | |
Init
¶
Init(dut: SimHandleBase) -> None
Initialize clock, Controller FSM and connects dut with controllor.
Source code in src/cocotbext/hyperbus/hyperbus_controller.py
21 22 23 24 25 26 27 | |
ReadMem
async
¶
Reads the memory content form the starting address for a specified number of bytes.
Each transaction is 4 bytes.
Source code in src/cocotbext/hyperbus/hyperbus_controller.py
113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 | |
ReadReg
async
¶
Reads from a register based on the address, returns 2 bytes.
Source code in src/cocotbext/hyperbus/hyperbus_controller.py
40 41 42 43 44 45 46 47 48 49 50 51 52 | |
Reset
async
¶
Reset(dut: SimHandleBase) -> None
Reset based on timing requirement of the rtl model.
Source code in src/cocotbext/hyperbus/hyperbus_controller.py
30 31 32 33 34 35 36 37 38 | |
WriteMem
async
¶
Writes the memory content form the starting address for specified bytes of data.
Each transaction is 4 bytes.
Source code in src/cocotbext/hyperbus/hyperbus_controller.py
72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 | |
WriteReg
async
¶
Writes 2 bytes to a register based on the address.
Source code in src/cocotbext/hyperbus/hyperbus_controller.py
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 | |
arr_io_dq
¶
Returns the bit at an index for the 8 bit array.
Source code in src/cocotbext/hyperbus/hyperbus_controller.py
180 181 182 183 | |
ca_words
¶
Splits the 48bit CA into 6 bytes for transmission.
Source code in src/cocotbext/hyperbus/hbc_fsm.py
176 177 178 | |
ck_cycle
¶
ck_cycle(dut: SimHandleBase) -> None
Updates the derived clock based on reset and chip select lines.
Source code in src/cocotbext/hyperbus/hyperbus_controller.py
163 164 165 166 167 168 169 | |
clk_cycle
async
¶
clk_cycle(dut: SimHandleBase) -> None
Generate the clock for the test.
Source code in src/cocotbext/hyperbus/hyperbus_controller.py
154 155 156 157 158 159 160 161 | |
drive_dq
¶
Drives the data bus.
Source code in src/cocotbext/hyperbus/hyperbus_controller.py
209 210 211 212 213 214 215 216 217 218 | |
fsm
async
¶
fsm(dut: SimHandleBase) -> None
FSM for states IDLE, CAs, WR_LATENCY, WRITE, READ, DONE.
Source code in src/cocotbext/hyperbus/hbc_fsm.py
80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 | |
fsm_reset
¶
fsm_reset() -> None
Resets the fsm to IDLE state.
Source code in src/cocotbext/hyperbus/hbc_fsm.py
72 73 74 75 76 77 78 | |
generate_random_data
¶
Generate random num number of byte.
Source code in src/cocotbext/hyperbus/hbc_fsm.py
235 236 237 238 239 240 241 242 | |
get_time
¶
get_time() -> int
Get simulation time.
Source code in src/cocotbext/hyperbus/hbc_fsm.py
197 198 199 | |
int_to_8bit_array
¶
Converts Integer into a 8 bit binary string array.
Source code in src/cocotbext/hyperbus/hyperbus_controller.py
172 173 174 175 176 177 178 | |
is_rwdsvalid
async
¶
is_rwdsvalid() -> None
Samples the RWDS input signal every 5ns and stores it in rwds_d.
Source code in src/cocotbext/hyperbus/hbc_fsm.py
191 192 193 194 195 | |
log
¶
log(msg: str) -> None
Logs a message value with prefixed simulation time.
Source code in src/cocotbext/hyperbus/hbc_fsm.py
201 202 203 | |
monitor_dq
¶
monitor_dq(dut: SimHandleBase) -> None
Moniters the data bus.
Source code in src/cocotbext/hyperbus/hyperbus_controller.py
220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 | |
rwds_valid
¶
rwds_valid() -> int
Returns True if RWDS is valid.
Used for data sampling.
Source code in src/cocotbext/hyperbus/hbc_fsm.py
169 170 171 172 173 174 | |
rx_data
¶
Returns hex string of a 32 bit number.
Source code in src/cocotbext/hyperbus/hbc_fsm.py
205 206 207 208 209 210 | |
swap_halves
¶
Swaps the upper and lower 16 bits of a 32-bit value used for word alignment, endianess conversion into little endian.
Source code in src/cocotbext/hyperbus/hbc_fsm.py
227 228 229 230 231 232 233 | |
update_ca
¶
Builds the 48-bit command/address word using write strobe, config access, and memory address fields.
Source code in src/cocotbext/hyperbus/hbc_fsm.py
212 213 214 215 216 217 218 219 220 221 222 223 224 225 | |
wait_100ns
async
¶
wait_100ns(dut: SimHandleBase) -> None
Waits for 100ns.
Source code in src/cocotbext/hyperbus/hyperbus_controller.py
205 206 207 | |
wait_until_mem_ready
async
¶
wait_until_mem_ready() -> None
Continously polls for every half clock cycle to check if the memory is ready.
Source code in src/cocotbext/hyperbus/hyperbus_controller.py
239 240 241 242 243 244 | |
wdata_words
¶
Splits the 32 bit write data into bytes, with special arrangement if CA[46]=1.
Source code in src/cocotbext/hyperbus/hbc_fsm.py
180 181 182 183 184 185 | |
wstrb_words
¶
Splits Write strobe into bits for each byte lane.
Source code in src/cocotbext/hyperbus/hbc_fsm.py
187 188 189 | |
HyperBus_FSM
¶
HyperBus_FSM()
State machine class for hyperbus.
Methods:
-
ca_words–Splits the 48bit CA into 6 bytes for transmission.
-
fsm–FSM for states IDLE, CAs, WR_LATENCY, WRITE, READ, DONE.
-
fsm_reset–Resets the fsm to IDLE state.
-
generate_random_data–Generate random num number of byte.
-
get_time–Get simulation time.
-
is_rwdsvalid–Samples the RWDS input signal every 5ns and stores it in rwds_d.
-
log–Logs a message value with prefixed simulation time.
-
rwds_valid–Returns True if RWDS is valid.
-
rx_data–Returns hex string of a 32 bit number.
-
swap_halves–Swaps the upper and lower 16 bits of a 32-bit value used for word alignment, endianess conversion into little endian.
-
update_ca–Builds the 48-bit command/address word using write strobe, config access, and memory address fields.
-
wdata_words–Splits the 32 bit write data into bytes, with special arrangement if CA[46]=1.
-
wstrb_words–Splits Write strobe into bits for each byte lane.
Source code in src/cocotbext/hyperbus/hbc_fsm.py
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 | |
ca_words
¶
Splits the 48bit CA into 6 bytes for transmission.
Source code in src/cocotbext/hyperbus/hbc_fsm.py
176 177 178 | |
fsm
async
¶
fsm(dut: SimHandleBase) -> None
FSM for states IDLE, CAs, WR_LATENCY, WRITE, READ, DONE.
Source code in src/cocotbext/hyperbus/hbc_fsm.py
80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 | |
fsm_reset
¶
fsm_reset() -> None
Resets the fsm to IDLE state.
Source code in src/cocotbext/hyperbus/hbc_fsm.py
72 73 74 75 76 77 78 | |
generate_random_data
¶
Generate random num number of byte.
Source code in src/cocotbext/hyperbus/hbc_fsm.py
235 236 237 238 239 240 241 242 | |
get_time
¶
get_time() -> int
Get simulation time.
Source code in src/cocotbext/hyperbus/hbc_fsm.py
197 198 199 | |
is_rwdsvalid
async
¶
is_rwdsvalid() -> None
Samples the RWDS input signal every 5ns and stores it in rwds_d.
Source code in src/cocotbext/hyperbus/hbc_fsm.py
191 192 193 194 195 | |
log
¶
log(msg: str) -> None
Logs a message value with prefixed simulation time.
Source code in src/cocotbext/hyperbus/hbc_fsm.py
201 202 203 | |
rwds_valid
¶
rwds_valid() -> int
Returns True if RWDS is valid.
Used for data sampling.
Source code in src/cocotbext/hyperbus/hbc_fsm.py
169 170 171 172 173 174 | |
rx_data
¶
Returns hex string of a 32 bit number.
Source code in src/cocotbext/hyperbus/hbc_fsm.py
205 206 207 208 209 210 | |
swap_halves
¶
Swaps the upper and lower 16 bits of a 32-bit value used for word alignment, endianess conversion into little endian.
Source code in src/cocotbext/hyperbus/hbc_fsm.py
227 228 229 230 231 232 233 | |
update_ca
¶
Builds the 48-bit command/address word using write strobe, config access, and memory address fields.
Source code in src/cocotbext/hyperbus/hbc_fsm.py
212 213 214 215 216 217 218 219 220 221 222 223 224 225 | |
wdata_words
¶
Splits the 32 bit write data into bytes, with special arrangement if CA[46]=1.
Source code in src/cocotbext/hyperbus/hbc_fsm.py
180 181 182 183 184 185 | |
wstrb_words
¶
Splits Write strobe into bits for each byte lane.
Source code in src/cocotbext/hyperbus/hbc_fsm.py
187 188 189 | |