module mu
tiplier2(x, y, clk, q);
input [7:0] x;
input [7:0] y;
input clk;
output [15:0] q;
reg [15:0] q;
parameter s0=0, s1=1, s2=2;
reg [2:0] count;
reg [1:0] state;
reg [15:0] p1, t;
reg [7:0] y_reg,z;
initial state<=s0;
always @(posedge clk) begin
case (state)
s0 : begin
y_reg <= y;
state <= s1;
count <= 0;
`timescale 1ns / 1ps
module tb_mul;
// Inputs
reg [7:0] x;
reg [7:0] y;
reg clk;
// Outputs
wire [15:0] q;
// Instantiate the Unit Under Test (UUT)
mul uut (
.x(x),
.y(y),
.clk(clk),
.q(q)
);
initial begin
clk=0;
forever#50 clk=~clk;
end
initial begin
// Initialize Inputs
x = 0;
y = 0;
clk = 0;
// Wait 100 ns for global reset to finish
#100;
x=8'b00001111;
y=8'b11110000;
#100 stop;
// Add stimulus here
end
//always
endmodule
乘法器的
仿真,,请问是不是 testbench 的错误导致没有波形?
一周热门 更多>