|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?注册
x
本帖最后由 flyamo 于 2012-5-17 13:54 编辑
这段程序综合不了,但是可以仿真。问题出在result和finish上面,这两个模块出口的值一定要设计成wire型数据么?可是我改成wire数据还是综合不了,报警说reg型数据不能相加赋值给wire数据。
归到底问题就是:在模块里面,输入值是reg类型的,经过运算后得到输出值,那么这个输出值也是reg类型的了,可是综合时候就一定要认为输出是wire类型的,所以出错综合不了了,这个问题该如何解决呢,谢谢!
程序段如下:
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 10:53:47 05/17/2012
// Design Name:
// Module Name: multiplier8_05
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Dependencies:
//
// Revision:
// Revision 0.01 - File Created
// Additional Comments:
//
//////////////////////////////////////////////////////////////////////////////////
module multiplier8_05(
input clk,
input rst_n,
input [7:0] mul_a,
input [7:0] mul_b,
output [15:0] result,
output finish
);
reg[15:0] result;
reg[15:0] store7;
reg[15:0] store6;
reg[15:0] store5;
reg[15:0] store4;
reg[15:0] store3;
reg[15:0] store2;
reg[15:0] store1;
reg[15:0] store0;
reg finish;
always @ (posedge clk or negedge rst_n)
begin
if(!rst_n)
begin
store7 <= 16'b0;
store6 <= 16'b0;
store5 <= 16'b0;
store4 <= 16'b0;
store3 <= 16'b0;
store2 <= 16'b0;
store1 <= 16'b0;
store0 <= 16'b0;
finish <= 1'b0;
end
else
begin
store7 <= mul_b[7] ? {1'b0,mul_a,7'b0}:16'b0;
store6 <= mul_b[6] ? {2'b0,mul_a,6'b0}:16'b0;
store5 <= mul_b[5] ? {3'b0,mul_a,5'b0}:16'b0;
store4 <= mul_b[4] ? {4'b0,mul_a,4'b0}:16'b0;
store3 <= mul_b[3] ? {5'b0,mul_a,3'b0}:16'b0;
store2 <= mul_b[2] ? {6'b0,mul_a,2'b0}:16'b0;
store1 <= mul_b[1] ? {7'b0,mul_a,1'b0}:16'b0;
store0 <= mul_b[0] ? {8'b0,mul_a}:16'b0;
result <= store0 + store1 + store2 + store3 + store4 + store5 + store6 + store7;
end
end
always @ (result)
finish <= 1'b1;
endmodule |
|