@@ -90,6 +90,12 @@ package espi_tb_pkg is
90
90
constant address: in std_logic_vector (15 downto 0 );
91
91
constant data : in std_logic_vector (31 downto 0 );
92
92
constant bad_crc : boolean := false ) return cmd_t;
93
+
94
+ impure function build_mem_write32(
95
+ constant address: in std_logic_vector (31 downto 0 );
96
+ constant payload_len : in std_logic_vector (11 downto 0 );
97
+ constant payload : queue_t;
98
+ constant bad_crc : boolean := false ) return cmd_t;
93
99
94
100
procedure compare_uart_loopback (
95
101
constant input_payload : queue_t;
@@ -378,14 +384,14 @@ package body espi_tb_pkg is
378
384
constant bad_crc : boolean := false ) return cmd_t is
379
385
variable cmd : cmd_t := (new_queue, 0 );
380
386
begin
381
- -- OPCODE_GET_PC (1 byte)
382
- push_byte(cmd.queue, to_integer (opcode_put_iowr_short_4byte));
383
- cmd.num_bytes := cmd.num_bytes + 1 ;
384
- -- address 2 bytes
385
- push_byte(cmd.queue, to_integer (address(15 downto 8 )));
386
- cmd.num_bytes := cmd.num_bytes + 1 ;
387
- push_byte(cmd.queue, to_integer (address(7 downto 0 )));
388
- cmd.num_bytes := cmd.num_bytes + 1 ;
387
+ -- OPCODE_PUT_IOWR_SHORT (1 byte)
388
+ push_byte(cmd.queue, to_integer (opcode_put_iowr_short_4byte));
389
+ cmd.num_bytes := cmd.num_bytes + 1 ;
390
+ -- address 2 bytes
391
+ push_byte(cmd.queue, to_integer (address(15 downto 8 )));
392
+ cmd.num_bytes := cmd.num_bytes + 1 ;
393
+ push_byte(cmd.queue, to_integer (address(7 downto 0 )));
394
+ cmd.num_bytes := cmd.num_bytes + 1 ;
389
395
-- data 4 bytes
390
396
push_byte(cmd.queue, to_integer (data(7 downto 0 )));
391
397
cmd.num_bytes := cmd.num_bytes + 1 ;
@@ -402,4 +408,44 @@ package body espi_tb_pkg is
402
408
return cmd;
403
409
end function ;
404
410
411
+ impure function build_mem_write32(
412
+ constant address: in std_logic_vector (31 downto 0 );
413
+ constant payload_len : in std_logic_vector (11 downto 0 );
414
+ constant payload : queue_t;
415
+ constant bad_crc : boolean := false ) return cmd_t is
416
+ variable cmd : cmd_t := (new_queue, 0 );
417
+ begin
418
+ -- OPCODE_GET_PC (1 byte)
419
+ push_byte(cmd.queue, to_integer (opcode_put_pc));
420
+ cmd.num_bytes := cmd.num_bytes + 1 ;
421
+ -- cycle type (1 byte)
422
+ push_byte(cmd.queue, to_integer (mem_write_32));
423
+ cmd.num_bytes := cmd.num_bytes + 1 ;
424
+ -- tag/length high
425
+ push_byte(cmd.queue, to_integer ("0000" & payload_len(11 downto 8 )));
426
+ cmd.num_bytes := cmd.num_bytes + 1 ;
427
+ -- length low
428
+ push_byte(cmd.queue, to_integer (payload_len(7 downto 0 )));
429
+ cmd.num_bytes := cmd.num_bytes + 1 ;
430
+ -- address 4 bytes
431
+ push_byte(cmd.queue, to_integer (address(31 downto 24 )));
432
+ cmd.num_bytes := cmd.num_bytes + 1 ;
433
+ push_byte(cmd.queue, to_integer (address(23 downto 16 )));
434
+ cmd.num_bytes := cmd.num_bytes + 1 ;
435
+ push_byte(cmd.queue, to_integer (address(15 downto 8 )));
436
+ cmd.num_bytes := cmd.num_bytes + 1 ;
437
+ push_byte(cmd.queue, to_integer (address(7 downto 0 )));
438
+ cmd.num_bytes := cmd.num_bytes + 1 ;
439
+ -- data length bytes
440
+ while not is_empty(payload) loop
441
+ push_byte(cmd.queue, pop_byte(payload));
442
+ cmd.num_bytes := cmd.num_bytes + 1 ;
443
+ end loop ;
444
+ -- CRC (1 byte)
445
+ push_byte(cmd.queue, to_integer (crc8(cmd.queue)));
446
+ cmd.num_bytes := cmd.num_bytes + 1 ;
447
+
448
+ return cmd;
449
+ end function ;
450
+
405
451
end package body ;
0 commit comments