Why is iverilog complaining about my testbench module?Data memory unitPart select behaves strangely in simulator when it goes through a wireVerilog Error: output or inout port “Q” must be connected to a structural net expressionHow to use structural unit?How do you manipulate input arrays in an always block (verilog)?iverilog syntax for include?how to solve counter for seg controller faultiverilog testbench error: input is declared as wire, but it isn'tVerilog - Issue with Main Module for Adderregarding always block in implementing ARM cpu in verilogWhy is iverilog complaining about this expression/port width?
The screen of my macbook suddenly broken down how can I do to recover
What is Cash Advance APR?
Multiplicative persistence
Electoral considerations aside, what are potential benefits, for the US, of policy changes proposed by the tweet recognizing Golan annexation?
What was the exact wording from Ivanhoe of this advice on how to free yourself from slavery?
Pre-mixing cryogenic fuels and using only one fuel tank
Closed-form expression for certain product
How much character growth crosses the line into breaking the character
What is this called? Old film camera viewer?
Lowest total scrabble score
Redundant comparison & "if" before assignment
Why should universal income be universal?
lightning-datatable row number error
Loading commands from file
Removing files under particular conditions (number of files, file age)
Is there any references on the tensor product of presentable (1-)categories?
New brakes for 90s road bike
How should I respond when I lied about my education and the company finds out through background check?
Travelling outside the UK without a passport
Yosemite Fire Rings - What to Expect?
How do you make your own symbol when Detexify fails?
What does routing an IP address mean?
Why is it that I can sometimes guess the next note?
How to explain what's wrong with this application of the chain rule?
Why is iverilog complaining about my testbench module?
Data memory unitPart select behaves strangely in simulator when it goes through a wireVerilog Error: output or inout port “Q” must be connected to a structural net expressionHow to use structural unit?How do you manipulate input arrays in an always block (verilog)?iverilog syntax for include?how to solve counter for seg controller faultiverilog testbench error: input is declared as wire, but it isn'tVerilog - Issue with Main Module for Adderregarding always block in implementing ARM cpu in verilogWhy is iverilog complaining about this expression/port width?
I'm writing a verilog module for my CompSci class and this module specifically is the data memory module. Structurally and analytically, I'm looking at it and it should work based off of the other files that I have, but I'm not sure why this one specifically is acting up and giving me all x's. Hoping a fresh set of eyes can help find the error I missed. Thanks in advance.
datamem.v:
module datamem(Ina, Inb, enable, readwrite, dataOut, clk, rst);
input wire [31:0] Ina;
input wire [31:0] Inb;
input wire enable;
input wire readwrite;
input wire clk;
input wire rst;
reg [31:0] memory[0:65535];
output reg [31:0] dataOut;
always @(memory[Ina]) begin
dataOut = memory[Ina];
end
always @(posedge clk) begin
if(1'b1 == readwrite) begin
memory[Ina] = Inb;
end
end
endmodule
datamem_tb.v:
module datamem_tb();
reg [31:0] Ina;
reg [31:0] Inb;
reg enable;
reg readwrite;
reg clk;
reg rst;
wire [31:0] dataOut;
datamem DUT (Ina, Inb, enable, readwrite, dataOut, clk, rst);
initial
begin
Ina <= 32'd0;
Inb <= 32'd0;
enable <= 0;
readwrite <= 0;
#20 Ina <= 32'd1234;
#20 Inb <= 32'd1234;
#20 Ina <= 32'd0517;
#20 Inb <= 32'd10259;
end
always @(Ina or Inb)
#1 $display("| Ina = %d | Inb = %d | dataOut = %d |", Ina, Inb, dataOut);
endmodule
verilog iverilog
add a comment |
I'm writing a verilog module for my CompSci class and this module specifically is the data memory module. Structurally and analytically, I'm looking at it and it should work based off of the other files that I have, but I'm not sure why this one specifically is acting up and giving me all x's. Hoping a fresh set of eyes can help find the error I missed. Thanks in advance.
datamem.v:
module datamem(Ina, Inb, enable, readwrite, dataOut, clk, rst);
input wire [31:0] Ina;
input wire [31:0] Inb;
input wire enable;
input wire readwrite;
input wire clk;
input wire rst;
reg [31:0] memory[0:65535];
output reg [31:0] dataOut;
always @(memory[Ina]) begin
dataOut = memory[Ina];
end
always @(posedge clk) begin
if(1'b1 == readwrite) begin
memory[Ina] = Inb;
end
end
endmodule
datamem_tb.v:
module datamem_tb();
reg [31:0] Ina;
reg [31:0] Inb;
reg enable;
reg readwrite;
reg clk;
reg rst;
wire [31:0] dataOut;
datamem DUT (Ina, Inb, enable, readwrite, dataOut, clk, rst);
initial
begin
Ina <= 32'd0;
Inb <= 32'd0;
enable <= 0;
readwrite <= 0;
#20 Ina <= 32'd1234;
#20 Inb <= 32'd1234;
#20 Ina <= 32'd0517;
#20 Inb <= 32'd10259;
end
always @(Ina or Inb)
#1 $display("| Ina = %d | Inb = %d | dataOut = %d |", Ina, Inb, dataOut);
endmodule
verilog iverilog
add a comment |
I'm writing a verilog module for my CompSci class and this module specifically is the data memory module. Structurally and analytically, I'm looking at it and it should work based off of the other files that I have, but I'm not sure why this one specifically is acting up and giving me all x's. Hoping a fresh set of eyes can help find the error I missed. Thanks in advance.
datamem.v:
module datamem(Ina, Inb, enable, readwrite, dataOut, clk, rst);
input wire [31:0] Ina;
input wire [31:0] Inb;
input wire enable;
input wire readwrite;
input wire clk;
input wire rst;
reg [31:0] memory[0:65535];
output reg [31:0] dataOut;
always @(memory[Ina]) begin
dataOut = memory[Ina];
end
always @(posedge clk) begin
if(1'b1 == readwrite) begin
memory[Ina] = Inb;
end
end
endmodule
datamem_tb.v:
module datamem_tb();
reg [31:0] Ina;
reg [31:0] Inb;
reg enable;
reg readwrite;
reg clk;
reg rst;
wire [31:0] dataOut;
datamem DUT (Ina, Inb, enable, readwrite, dataOut, clk, rst);
initial
begin
Ina <= 32'd0;
Inb <= 32'd0;
enable <= 0;
readwrite <= 0;
#20 Ina <= 32'd1234;
#20 Inb <= 32'd1234;
#20 Ina <= 32'd0517;
#20 Inb <= 32'd10259;
end
always @(Ina or Inb)
#1 $display("| Ina = %d | Inb = %d | dataOut = %d |", Ina, Inb, dataOut);
endmodule
verilog iverilog
I'm writing a verilog module for my CompSci class and this module specifically is the data memory module. Structurally and analytically, I'm looking at it and it should work based off of the other files that I have, but I'm not sure why this one specifically is acting up and giving me all x's. Hoping a fresh set of eyes can help find the error I missed. Thanks in advance.
datamem.v:
module datamem(Ina, Inb, enable, readwrite, dataOut, clk, rst);
input wire [31:0] Ina;
input wire [31:0] Inb;
input wire enable;
input wire readwrite;
input wire clk;
input wire rst;
reg [31:0] memory[0:65535];
output reg [31:0] dataOut;
always @(memory[Ina]) begin
dataOut = memory[Ina];
end
always @(posedge clk) begin
if(1'b1 == readwrite) begin
memory[Ina] = Inb;
end
end
endmodule
datamem_tb.v:
module datamem_tb();
reg [31:0] Ina;
reg [31:0] Inb;
reg enable;
reg readwrite;
reg clk;
reg rst;
wire [31:0] dataOut;
datamem DUT (Ina, Inb, enable, readwrite, dataOut, clk, rst);
initial
begin
Ina <= 32'd0;
Inb <= 32'd0;
enable <= 0;
readwrite <= 0;
#20 Ina <= 32'd1234;
#20 Inb <= 32'd1234;
#20 Ina <= 32'd0517;
#20 Inb <= 32'd10259;
end
always @(Ina or Inb)
#1 $display("| Ina = %d | Inb = %d | dataOut = %d |", Ina, Inb, dataOut);
endmodule
verilog iverilog
verilog iverilog
asked Mar 8 at 4:30
Barnabas BullionBarnabas Bullion
133
133
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
A few things as to why you are getting all 'x:
- You never run the clock, you need to add something like the following to have the clock toggle:
initial begin
clk = 1'b0;
forever #5 clk = ~clk;
end
- You never assert
readwritewhich is required to write to your memory module (you set it to0on line 20 and never change it). Without being written to,memorywill retain its original value of'xfor every element
Aside from that, there are a few other issues with your module:
- Use implicit sensitive lists (instead of
always @(memory[inA])usealways @(*)) - Use non-blocking assignment for your memory write (
memory[inA] <= inB) - Consider using
$monitorinstead of$displayfor your print statements to avoid timing issues, and you only need call it at the beginning of yourinitialblock in your testbench (http://referencedesigner.com/tutorials/verilog/verilog_09.php) - Your
rstandenablearent connected to anything.
Another example of a memory unit implementation can be found here:
Data memory unit
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55056750%2fwhy-is-iverilog-complaining-about-my-testbench-module%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
A few things as to why you are getting all 'x:
- You never run the clock, you need to add something like the following to have the clock toggle:
initial begin
clk = 1'b0;
forever #5 clk = ~clk;
end
- You never assert
readwritewhich is required to write to your memory module (you set it to0on line 20 and never change it). Without being written to,memorywill retain its original value of'xfor every element
Aside from that, there are a few other issues with your module:
- Use implicit sensitive lists (instead of
always @(memory[inA])usealways @(*)) - Use non-blocking assignment for your memory write (
memory[inA] <= inB) - Consider using
$monitorinstead of$displayfor your print statements to avoid timing issues, and you only need call it at the beginning of yourinitialblock in your testbench (http://referencedesigner.com/tutorials/verilog/verilog_09.php) - Your
rstandenablearent connected to anything.
Another example of a memory unit implementation can be found here:
Data memory unit
add a comment |
A few things as to why you are getting all 'x:
- You never run the clock, you need to add something like the following to have the clock toggle:
initial begin
clk = 1'b0;
forever #5 clk = ~clk;
end
- You never assert
readwritewhich is required to write to your memory module (you set it to0on line 20 and never change it). Without being written to,memorywill retain its original value of'xfor every element
Aside from that, there are a few other issues with your module:
- Use implicit sensitive lists (instead of
always @(memory[inA])usealways @(*)) - Use non-blocking assignment for your memory write (
memory[inA] <= inB) - Consider using
$monitorinstead of$displayfor your print statements to avoid timing issues, and you only need call it at the beginning of yourinitialblock in your testbench (http://referencedesigner.com/tutorials/verilog/verilog_09.php) - Your
rstandenablearent connected to anything.
Another example of a memory unit implementation can be found here:
Data memory unit
add a comment |
A few things as to why you are getting all 'x:
- You never run the clock, you need to add something like the following to have the clock toggle:
initial begin
clk = 1'b0;
forever #5 clk = ~clk;
end
- You never assert
readwritewhich is required to write to your memory module (you set it to0on line 20 and never change it). Without being written to,memorywill retain its original value of'xfor every element
Aside from that, there are a few other issues with your module:
- Use implicit sensitive lists (instead of
always @(memory[inA])usealways @(*)) - Use non-blocking assignment for your memory write (
memory[inA] <= inB) - Consider using
$monitorinstead of$displayfor your print statements to avoid timing issues, and you only need call it at the beginning of yourinitialblock in your testbench (http://referencedesigner.com/tutorials/verilog/verilog_09.php) - Your
rstandenablearent connected to anything.
Another example of a memory unit implementation can be found here:
Data memory unit
A few things as to why you are getting all 'x:
- You never run the clock, you need to add something like the following to have the clock toggle:
initial begin
clk = 1'b0;
forever #5 clk = ~clk;
end
- You never assert
readwritewhich is required to write to your memory module (you set it to0on line 20 and never change it). Without being written to,memorywill retain its original value of'xfor every element
Aside from that, there are a few other issues with your module:
- Use implicit sensitive lists (instead of
always @(memory[inA])usealways @(*)) - Use non-blocking assignment for your memory write (
memory[inA] <= inB) - Consider using
$monitorinstead of$displayfor your print statements to avoid timing issues, and you only need call it at the beginning of yourinitialblock in your testbench (http://referencedesigner.com/tutorials/verilog/verilog_09.php) - Your
rstandenablearent connected to anything.
Another example of a memory unit implementation can be found here:
Data memory unit
edited Mar 8 at 5:12
dave_59
20.7k21639
20.7k21639
answered Mar 8 at 4:51
UnnUnn
2,722822
2,722822
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55056750%2fwhy-is-iverilog-complaining-about-my-testbench-module%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown