请原谅: 代码还没有写完,后面一定补上
module operation(
input clk ,
input rst_n,
output reg [3:0] num_add,
output reg [3:0] num_sub,
output reg [6:0] num_mul,
output reg [3:0] num_div,
output reg [3:0] num_rem,
output reg [9:0] num_bin
);
reg [3:0] num1;
reg [3:0] num2;
reg [9:0] bin_num;
reg [3:0] cnt;
reg [9:0] ans;
// 加减乘除四则运算
always@(posedge clk or negedge rst_n)begin
if(!rst_n)begin
num1<=4'd8;
num2<=4'd2;
end
else begin
num_add<=num1+num2;
num_sub<=num1-num2;
num_mul<=num1*num2;
num_rem<=num1%num2;
num_div<=num1/num2;
end
end
// 十进制如何转化为二进制, 二进制的最开始的余数为低位,后面得到的余数为高位,利用拼接的方法
always@(posedge clk or negedge rst_n)begin
if(!rst_n)begin
bin_num<=10'b0;
cnt<=4'd0;
ans<= ;
end
else begin
<=
end
end
endmodule