本帖最后由 28182900 于 2016-8-14 16:32 编辑
就是我有7个按键,定义为input[7:0]key;
定义一个wire[1:0]sw1_n;
module key_led(
clk,rst_n,
key,
led
);//
input clk; //主时钟信号,50MHz
input rst_n; //复位信号,低有效
input[7:0]key;//input [7:0] key
output[7:0]led;
wire[1:0]sw1_n;
wire[1:0]sw2_n;
wire[1:0]sw3_n;
wire[1:0]sw4_n;
wire[1:0]sw5_n;
wire[1:0]sw6_n;
wire[1:0]sw7_n;
wire[1:0]sw8_n;
wire[1:0]led1_n;
wire[1:0]led2_n;
wire[1:0]led3_n;
wire[1:0]led4_n;
wire[1:0]led5_n;
wire[1:0]led6_n;
wire[1:0]led7_n;
wire[1:0]led8_n;
assign sw1_n = key[0];
assign sw2_n = key[1];
assign sw3_n = key[2];
assign sw4_n = key[3];
assign sw5_n = key[4];
assign sw6_n = key[5];
assign sw7_n = key[6];
assign sw8_n = key[7];
assign led1_n = led[0];
assign led2_n = led[1];
assign led3_n = led[2];
assign led4_n = led[3];
assign led5_n = led[4];
assign led6_n = led[5];
assign led7_n = led[6];
assign led8_n = led[7];
这样写有问题吗?
assign sw1_n = key[0];这样写是不是就等同于key[0]的变化随之使sw1_n变化?
|