Answered step by step
Verified Expert Solution
Question
1 Approved Answer
build me a verilog testbench for this REGISTER ( Address , Out ) ; input [ 1 1 : 0 ] Address; output reg [
build me a verilog testbench for this REGISTERAddress Out; input : Address; output reg : Out; always @ begin Out Address; end endmodule module SourceMemoryData Address, CS; output reg : Data; input: Address; input CS; reg : ROM:; always @negedge CS begin forinteger i;i;ii begin ROMii; end DataROMAddress; end endmodule module RecievingMemory AddressData,CS; input : Address; input : Data; input CS; reg : ROM:; always @ negedge CS begin ROMAddress Data; end endmodule module ERRBLCKDatain Dataout, CLK; input Datain, CLK; output reg Dataout; reg rand; always @negedge CLK begin rand $random; if rand begin Dataout Datain; end else begin Dataout ~Datain; end end endmodule; module transmitter SrcRegDBusIN,ACK,Full,CLKParity,DReq,DataOut,AddressBus; input : SrcReg; input : DBusIN; input ACK, Full, CLK; output reg Parity, D Req; output reg : DataOut; output reg : AddressBus; reg counter; integer i; always @negedge CLK begin AddressBus SrcReg; if Full begin $finish; end else if ACK begin AddressBus AddressBus b; end Parity ; counter; forinteger i; i;i begin ifDBusINicounter; end ifcounter Parity; Req ; for i ; i ; i i begin DataOuti DBusINi; end D DBusIN; end endmodule module receiver DestregDDATAI,Parity,REQ,CLKACK,full,AddressBUS,DataBus; input : Destreg; input D; input : DATAI; input Parity; input REQ; input CLK; output reg ACK; output reg full; output reg : AddressBUS; output reg : DataBus; always @posedge CLK begin AddressBUS Destreg; if REQ begin if AddressBUS begin full ; $finish; end if D DATAI Parity begin ACK ; AddressBUS Destreg ; end end for integer i ; i ; i i begin DataBusi DATAIi; end DataBus D; end endmodule module TopLevel ; input : Address; wire : Out; wire : Data; input :data; input : SrcReg; input : DBusIN; wire : DataOut; wire : AddressBus; input : Destreg; input :DATAI; wire : DataBus ; REGISTER rAddress Out; REGISTER rAddress Out; SourceMemory mData Address, CS; RecievingMemory mAddressData,CS; ERRBLCK errDatain Dataout, CLK; transmitter tSrcRegDBusIN,ACK,Full,CLKParity,DReq,DataOut,AddressBus; receiver reDestregDDATAI,Parity,REQ,CLKACK,full,AddressBus,DataBus; endmodule;
build me a verilog testbench for this REGISTERAddress Out;
input : Address;
output reg : Out;
always @ begin
Out Address;
end
endmodule
module SourceMemoryData Address, CS;
output reg : Data;
input: Address;
input CS;
reg : ROM:;
always @negedge CS
begin
forinteger i;i;ii
begin
ROMii;
end
DataROMAddress;
end
endmodule
module RecievingMemory AddressData,CS;
input : Address;
input : Data;
input CS;
reg : ROM:;
always @ negedge CS begin
ROMAddress Data;
end
endmodule
module ERRBLCKDatain Dataout, CLK;
input Datain, CLK;
output reg Dataout;
reg rand;
always @negedge CLK begin
rand $random;
if rand begin
Dataout Datain;
end else begin
Dataout ~Datain;
end
end
endmodule;
module transmitter SrcRegDBusIN,ACK,Full,CLKParity,DReq,DataOut,AddressBus;
input : SrcReg;
input : DBusIN;
input ACK, Full, CLK;
output reg Parity, D Req;
output reg : DataOut;
output reg : AddressBus;
reg counter;
integer i;
always @negedge CLK begin
AddressBus SrcReg;
if Full begin
$finish;
end else if ACK begin
AddressBus AddressBus b;
end
Parity ;
counter;
forinteger i; i;i begin
ifDBusINicounter;
end
ifcounter Parity;
Req ;
for i ; i ; i i begin
DataOuti DBusINi;
end
D DBusIN;
end
endmodule
module receiver DestregDDATAI,Parity,REQ,CLKACK,full,AddressBUS,DataBus;
input : Destreg;
input D;
input : DATAI;
input Parity;
input REQ;
input CLK;
output reg ACK;
output reg full;
output reg : AddressBUS;
output reg : DataBus;
always @posedge CLK begin
AddressBUS Destreg;
if REQ begin
if AddressBUS begin
full ;
$finish;
end
if D DATAI Parity begin
ACK ;
AddressBUS Destreg ;
end
end
for integer i ; i ; i i begin
DataBusi DATAIi;
end
DataBus D;
end
endmodule
module TopLevel ;
input : Address;
wire : Out;
wire : Data;
input :data;
input : SrcReg;
input : DBusIN;
wire : DataOut;
wire : AddressBus;
input : Destreg;
input :DATAI;
wire : DataBus ;
REGISTER rAddress Out;
REGISTER rAddress Out;
SourceMemory mData Address, CS;
RecievingMemory mAddressData,CS;
ERRBLCK errDatain Dataout, CLK;
transmitter tSrcRegDBusIN,ACK,Full,CLKParity,DReq,DataOut,AddressBus;
receiver reDestregDDATAI,Parity,REQ,CLKACK,full,AddressBus,DataBus;
endmodule;
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access with AI-Powered Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started