【发布时间】:2018-03-31 19:24:25
【问题描述】:
你好,我有一个关于 verilog 的作业。
我的任务是:
''当中断被断言时,s1 寄存器将给出中断子程序中中断的计数器编号。当更多 收到一个中断后,s1 寄存器将给出优先级编码器的输出。''
架构:
我设计了模式并在verilog RTL Schematic中看到了除demux部分。 我怎样才能看到 demux 部分和其他部分?
这是我的verilog top_module 代码。 计数器,优先编码器,picoblaze给我了。
我尝试编写 orgate 部分和 demux 。
module top_module(
input clock,
input reset
);
///////priority_encoder///////
wire [3:0] encoder_in;
wire [2:0] encoder_out;
///////////////////////////
/////picoblaze//////
wire interrupt_ack;
//////////////////////////
//////coder/////////////
reg start1;
reg start2;
reg start3;
reg start4;
///////////////////////
always @ (encoder_out or interrupt_ack )
begin
case(encoder_out)
3'b001:
start1 <=1'b1;
3'b010:
start2 <=1'b1;
3'b011:
start3 <=1'b1;
3'b100:
start4 <=1'b1;
endcase
end
ascode instance_name (
.address(address),
.instruction(instruction),
.clk(clk)
);
kcpsm3 picoblaze (
.address(address),
.instruction(instruction),
.port_id(port_id),
.write_strobe(write_strobe),
.out_port(out_port),
.read_strobe(read_strobe),
.in_port(encoder_out),
.interrupt(interrupt),
.interrupt_ack(interrupt_ack),
.reset(reset),
.clk(clk)
);
priority_encoder p_encoder (
.encoder_in(encoder_in),
.encoder_out(encoder_out)
);
counter c100 (
.clk(clk),
.start(start1),
.count_up_to(100),
.ready(encoder_in[0])
);
counter c200 (
.clk(clk),
.start(start2),
.count_up_to(200),
.ready(encoder_in[1])
);
counter c300 (
.clk(clk),
.start(start3),
.count_up_to(300),
.ready(encoder_in[2])
);
counter c400 (
.clk(clk),
.start(start4),
.count_up_to(400),
.ready(encoder_in[3])
);
orgate orgate (
.r1(encoder_in[0]),
.r2(encoder_in[1]),
.r3(encoder_in[2]),
.r4(encoder_in[3]),
.y(interrupt)
);
endmodule
【问题讨论】:
标签: verilog