I want to write a memory iterface with different modports.
i want to have a read only mode, that means that for mod port: readonly the signal “wr” will always be to ground/low, because i want to completly avoid a module with a read only interface to do anything else but read.
wr = 1'b0
How can i describe this in system verilog interface modport description ?
interface mem_interface ();
var logic rst, clk, wr; // for signal wr: write=1, read=0
var logic [7:0] dati, dato;
var logic [5:0] addr;
modport readwrite(
output rst, clk, dati, addr, wr,
input dato
);
// for the following modport, how can i always connect WR to the read logical value = 1'b0 ?
modport readonly (
output rst, clk, dati, addr,
input dato
);
modport mem (
input rst, clk, dati, addr, wr,
output dato
);
endinterface: mem_interface
I’m not sure it’s possible to do what you want or if it’s even necessary. Remember that there is only one set of interface signals regardless of the number of modport connections.
So, yes, i think the answer based on what @Dave posted is: it is not possible to do that with the current SV semantics.
I would find it usefull though, cuz then i know that all modules that have a read-only interface can by definition only read the memory, for write is not possible.
It would be useful, i think. :)
Please stop posting answers generated by AI tools without verifying the answers yourself first.
Not only does this provide incorrect and misleading information to the user asking for help, but it provides garbage input to other generative AI tools.