mirror of
https://github.com/openhwgroup/cva6.git
synced 2025-04-22 21:27:10 -04:00
Implement response side
This commit is contained in:
parent
b7303e41d2
commit
cb848654ff
2 changed files with 23 additions and 3 deletions
|
@ -33,6 +33,11 @@ class dcache_if_driver extends uvm_driver #(dcache_if_seq_item);
|
|||
|
||||
task run_phase(uvm_phase phase);
|
||||
dcache_if_seq_item cmd;
|
||||
logic [11:0] address_index [$];
|
||||
logic [43:0] address_tag [$];
|
||||
logic [55:0] address_out;
|
||||
|
||||
semaphore lock = new(1);
|
||||
|
||||
// --------------
|
||||
// Slave Port
|
||||
|
@ -64,7 +69,24 @@ class dcache_if_driver extends uvm_driver #(dcache_if_seq_item);
|
|||
fork
|
||||
// replay interface
|
||||
mem_read: begin
|
||||
|
||||
// we've got a new request
|
||||
if (m_vif.pck.data_gnt && m_vif.mck.data_req) begin
|
||||
// push the low portion of the address a.k.a. the index
|
||||
address_index.push_back(m_vif.mck.address_index);
|
||||
lock.get(1);
|
||||
// wait a couple of cycles, but at least one
|
||||
@(m_vif.mck);
|
||||
// in this cycle the tag is ready
|
||||
address_tag.push_back(m_vif.mck.address_tag);
|
||||
// randomize rvalid here
|
||||
repeat ($urandom_range(0,2)) @(m_vif.mck);
|
||||
m_vif.mck.data_rvalid <= 1'b1;
|
||||
// compose the address
|
||||
address_out = {address_tag.pop_front(), address_index.pop_front()};
|
||||
// put back the lock
|
||||
lock.put(1);
|
||||
end else
|
||||
m_vif.mck.data_rvalid <= 1'b0;
|
||||
end
|
||||
mem_write: begin
|
||||
|
||||
|
|
|
@ -48,9 +48,7 @@ class mem_if_driver extends uvm_driver #(mem_if_seq_item);
|
|||
|
||||
logic [63:0] address [$];
|
||||
logic [63:0] addr;
|
||||
logic slave_data_gnt;
|
||||
semaphore lock = new(1);
|
||||
slave_data_gnt = 1'b1;
|
||||
|
||||
// we serve all requests from the memory file we store in our configuration object
|
||||
// read memory file
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue