[dv/spi_device] Change logic to bit
As mentioned at #1545, clean up `logic` type as `bit` is better
Signed-off-by: Weicai Yang <weicai@google.com>
diff --git a/hw/dv/sv/spi_agent/seq_lib/spi_host_seq.sv b/hw/dv/sv/spi_agent/seq_lib/spi_host_seq.sv
index 5afb3bf..33b790c 100755
--- a/hw/dv/sv/spi_agent/seq_lib/spi_host_seq.sv
+++ b/hw/dv/sv/spi_agent/seq_lib/spi_host_seq.sv
@@ -7,7 +7,7 @@
`uvm_object_new
// data to be sent
- rand logic [7:0] data[$];
+ rand bit [7:0] data[$];
// constrain size of data sent / received to be at most 64kB
constraint data_size_c {
diff --git a/hw/dv/sv/spi_agent/spi_host_driver.sv b/hw/dv/sv/spi_agent/spi_host_driver.sv
index 75225d1..e2985e1 100644
--- a/hw/dv/sv/spi_agent/spi_host_driver.sv
+++ b/hw/dv/sv/spi_agent/spi_host_driver.sv
@@ -88,9 +88,9 @@
// drive data
for (int i = 0; i < req.data.size(); i++) begin
- logic [7:0] host_byte;
- logic [7:0] device_byte;
- int which_bit;
+ bit [7:0] host_byte;
+ bit [7:0] device_byte;
+ int which_bit;
host_byte = req.data[i];
for (int j = 0; j < 8; j++) begin
// drive mosi early so that it is stable at the sampling edge
diff --git a/hw/dv/sv/spi_agent/spi_item.sv b/hw/dv/sv/spi_agent/spi_item.sv
index ddcf0ac..0467386 100755
--- a/hw/dv/sv/spi_agent/spi_item.sv
+++ b/hw/dv/sv/spi_agent/spi_item.sv
@@ -6,7 +6,7 @@
rand spi_trans_type_e item_type;
// byte of data sent or received
- rand logic [7:0] data[$];
+ rand bit [7:0] data[$];
rand uint dummy_clk_cnt;
rand uint dummy_sck_length_ns;
diff --git a/hw/dv/sv/spi_agent/spi_monitor.sv b/hw/dv/sv/spi_agent/spi_monitor.sv
index 6da454b..250d092 100755
--- a/hw/dv/sv/spi_agent/spi_monitor.sv
+++ b/hw/dv/sv/spi_agent/spi_monitor.sv
@@ -53,9 +53,9 @@
// for mode 1 and 3, get the leading edges out of the way
cfg.wait_sck_edge(LeadingEdge);
forever begin
- logic [7:0] host_byte; // from mosi
- logic [7:0] device_byte; // from miso
- int which_bit;
+ bit [7:0] host_byte; // from mosi
+ bit [7:0] device_byte; // from miso
+ int which_bit;
for (int i = 0; i < 8; i++) begin
// wait for the sampling edge
cfg.wait_sck_edge(SamplingEdge);
diff --git a/hw/ip/spi_device/dv/env/seq_lib/spi_device_base_vseq.sv b/hw/ip/spi_device/dv/env/seq_lib/spi_device_base_vseq.sv
index d5aad8e..40f811f 100644
--- a/hw/ip/spi_device/dv/env/seq_lib/spi_device_base_vseq.sv
+++ b/hw/ip/spi_device/dv/env/seq_lib/spi_device_base_vseq.sv
@@ -130,7 +130,7 @@
endtask
// set a byte of data via host agent, receive a byte of data from spi_device
- virtual task spi_host_xfer_byte(logic [7:0] host_data, ref logic [7:0] device_data);
+ virtual task spi_host_xfer_byte(bit [7:0] host_data, ref bit [7:0] device_data);
spi_host_seq m_spi_host_seq;
`uvm_create_on(m_spi_host_seq, p_sequencer.spi_sequencer_h)
`DV_CHECK_RANDOMIZE_WITH_FATAL(m_spi_host_seq,
@@ -141,7 +141,7 @@
endtask
// set a word (32 bits) of data via host agent, receive a word of data from spi_device
- virtual task spi_host_xfer_word(logic [31:0] host_data, ref logic [31:0] device_data);
+ virtual task spi_host_xfer_word(bit [31:0] host_data, ref bit [31:0] device_data);
spi_host_seq m_spi_host_seq;
byte data_bytes[SRAM_WORD_SIZE];
{<<8{data_bytes}} = host_data;
@@ -155,7 +155,7 @@
// set a random chunk of bytes of data via host agent and receive same number of data from device
virtual task spi_host_xfer_bytes(int num_bytes = $urandom_range(1, 512),
- ref logic [7:0] device_data[$]);
+ ref bit [7:0] device_data[$]);
spi_host_seq m_spi_host_seq;
`uvm_create_on(m_spi_host_seq, p_sequencer.spi_sequencer_h)
`DV_CHECK_RANDOMIZE_WITH_FATAL(m_spi_host_seq, data.size() == num_bytes;)
@@ -164,7 +164,7 @@
endtask
// write spi device data to send when incoming host traffic arrives
- virtual task write_device_words_to_send(logic [31:0] device_data[$]);
+ virtual task write_device_words_to_send(bit [31:0] device_data[$]);
bit [TL_DW-1:0] tx_wptr;
uint tx_sram_size_bytes = `get_tx_allocated_sram_size_bytes;
@@ -194,7 +194,7 @@
endtask
// read spi host data received from the host
- virtual task read_host_words_rcvd(uint num_words, ref logic [31:0] host_data[$]);
+ virtual task read_host_words_rcvd(uint num_words, ref bit [31:0] host_data[$]);
bit [TL_DW-1:0] rx_rptr;
uint rx_sram_size_bytes = `get_rx_allocated_sram_size_bytes;
@@ -202,7 +202,7 @@
rx_rptr = ral.rxf_ptr.rptr.get_mirrored_value();
repeat (num_words) begin
bit [TL_DW-1:0] rx_rptr_addr;
- logic [TL_DW-1:0] word_data;
+ bit [TL_DW-1:0] word_data;
bit [TL_DW-1:0] rx_base_addr = ral.rxf_addr.base.get_mirrored_value();
rx_base_addr[1:0] = 0; // ignore lower 2 bits
rx_rptr_addr = cfg.sram_start_addr + rx_base_addr + rx_rptr[SRAM_MSB:0];
diff --git a/hw/ip/spi_device/dv/env/seq_lib/spi_device_fifo_underflow_overflow_vseq.sv b/hw/ip/spi_device/dv/env/seq_lib/spi_device_fifo_underflow_overflow_vseq.sv
index 16514a3..1b96f5d 100644
--- a/hw/ip/spi_device/dv/env/seq_lib/spi_device_fifo_underflow_overflow_vseq.sv
+++ b/hw/ip/spi_device/dv/env/seq_lib/spi_device_fifo_underflow_overflow_vseq.sv
@@ -19,7 +19,7 @@
// there may be some data left due to under/overflow, need to flush out all data
virtual task check_for_tx_rx_idle();
uint tx_avail_bytes, rx_avail_bytes;
- logic [31:0] device_words_q[$];
+ bit [31:0] device_words_q[$];
// flush out all remaining tx data in fifo due to overflow
while (1) begin
diff --git a/hw/ip/spi_device/dv/env/seq_lib/spi_device_sanity_vseq.sv b/hw/ip/spi_device/dv/env/seq_lib/spi_device_sanity_vseq.sv
index a353353..5d4d6c4 100644
--- a/hw/ip/spi_device/dv/env/seq_lib/spi_device_sanity_vseq.sv
+++ b/hw/ip/spi_device/dv/env/seq_lib/spi_device_sanity_vseq.sv
@@ -13,17 +13,17 @@
}
virtual task body();
- logic [31:0] host_data;
- logic [31:0] device_data;
- logic [31:0] device_data_exp;
- uint avail_bytes;
+ bit [31:0] host_data;
+ bit [31:0] device_data;
+ bit [31:0] device_data_exp;
+ uint avail_bytes;
for (int i = 1; i <= num_trans; i++) begin
`uvm_info(`gfn, $sformatf("starting sequence %0d/%0d", i, num_trans), UVM_LOW)
`DV_CHECK_RANDOMIZE_FATAL(this)
spi_device_init();
repeat ($urandom_range(1, 200)) begin
- logic [31:0] host_data_exp_q[$];
+ bit [31:0] host_data_exp_q[$];
`DV_CHECK_STD_RANDOMIZE_FATAL(host_data)
`DV_CHECK_STD_RANDOMIZE_FATAL(device_data)
// check if tx sram full and wait for at least a word to become available
diff --git a/hw/ip/spi_device/dv/env/seq_lib/spi_device_txrx_vseq.sv b/hw/ip/spi_device/dv/env/seq_lib/spi_device_txrx_vseq.sv
index 9506083..9b0d192 100644
--- a/hw/ip/spi_device/dv/env/seq_lib/spi_device_txrx_vseq.sv
+++ b/hw/ip/spi_device/dv/env/seq_lib/spi_device_txrx_vseq.sv
@@ -149,7 +149,7 @@
uint sram_avail_bytes;
uint tx_write_bytes;
while (remaining_bytes > 0) begin
- logic [31:0] device_words_q[$];
+ bit [31:0] device_words_q[$];
`DV_CHECK_MEMBER_RANDOMIZE_FATAL(tx_delay)
cfg.clk_rst_vif.wait_clks(tx_delay);
@@ -188,7 +188,7 @@
uint sram_avail_bytes;
uint rx_read_bytes;
while (remaining_bytes > 0) begin
- logic [31:0] device_words_q[$];
+ bit [31:0] device_words_q[$];
`DV_CHECK_MEMBER_RANDOMIZE_FATAL(rx_delay)
cfg.clk_rst_vif.wait_clks(rx_delay);
@@ -219,7 +219,7 @@
uint sram_avail_bytes;
uint spi_bytes;
bit is_under_over_flow = 0;
- logic [7:0] device_bytes_q[$];
+ bit [7:0] device_bytes_q[$];
`DV_CHECK_MEMBER_RANDOMIZE_FATAL(spi_delay)
cfg.clk_rst_vif.wait_clks(spi_delay);