|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?注册
x
verilog代码我在modelsim上面跑过的呀,竟是些奇奇怪怪的问题,郁闷啊
`timescale 1ns/1ns
module codec(vin, out, reset);
input [7:0]vin;
input reset;
output [2:0]out;
reg [2:0]out;
always @(vin or reset)
begin
if (!reset)
case(vin)
8'b00000001: out = 3'b000;
8'b00000010: out = 3'b001;
8'b00000100: out = 3'b010;
8'b00001000: out = 3'b011;
8'b00010000: out = 3'b100;
8'b00100000: out = 3'b101;
8'b01000000: out = 3'b110;
8'b10000000: out = 3'b111;
default : out = 3'bxxx;
endcase
else out = 3'b000;
end
endmodule |
|