informatica:ae:componentidivisoreverilog
Differenze
Queste sono le differenze tra la revisione selezionata e la versione attuale della pagina.
informatica:ae:componentidivisoreverilog [18/10/2017 alle 11:30 (8 anni fa)] – creata Marco Danelutto | informatica:ae:componentidivisoreverilog [18/10/2017 alle 11:34 (8 anni fa)] (versione attuale) – Marco Danelutto | ||
---|---|---|---|
Linea 28: | Linea 28: | ||
endmodule | endmodule | ||
</ | </ | ||
+ | |||
+ | === Commutatore === | ||
+ | <code verilog> | ||
+ | module k2(output [N-1: | ||
+ | input [N-1:0] x, | ||
+ | input [N-1:0] y, | ||
+ | input alpha); | ||
+ | |||
+ | | ||
+ | | ||
+ | | ||
+ | #2 z = (alpha ? y : x); | ||
+ | |||
+ | endmodule | ||
+ | </ | ||
+ | |||
+ | === AluINC === | ||
+ | <code verilog> | ||
+ | module aluinc(output [N-1:0]z, | ||
+ | input [N-1:0] x); | ||
+ | |||
+ | | ||
+ | |||
+ | | ||
+ | | ||
+ | endmodule | ||
+ | </ | ||
+ | |||
+ | === AluMeno === | ||
+ | <code verilog> | ||
+ | module alumeno(output [N-1:0]z, | ||
+ | | ||
+ | input [N-1:0]x, | ||
+ | input [N-1:0]y); | ||
+ | |||
+ | | ||
+ | |||
+ | | ||
+ | | ||
+ | | ||
+ | endmodule | ||
+ | </ | ||
+ | |||
+ | === Indicatore a transizione di livello in ingresso === | ||
+ | <code verilog> | ||
+ | // | ||
+ | // modulo RDY (transizione di livello in ingresso) | ||
+ | // | ||
+ | |||
+ | module rdy(output rdyout, | ||
+ | input rdyin, | ||
+ | input beta, | ||
+ | input clock); | ||
+ | |||
+ | reg stato; | ||
+ | reg inp; | ||
+ | |||
+ | wire in2, out3; | ||
+ | | ||
+ | | ||
+ | begin | ||
+ | stato = 0; | ||
+ | inp = 0; | ||
+ | end | ||
+ | |||
+ | | ||
+ | begin | ||
+ | stato = rdyin; | ||
+ | end | ||
+ | |||
+ | ack contmod2(in2, | ||
+ | comp comp2(out3, | ||
+ | |||
+ | |||
+ | | ||
+ | | ||
+ | |||
+ | endmodule | ||
+ | </ | ||
+ | |||
+ | === Indicatore a transizione di livello in uscita === | ||
+ | <code verilog> | ||
+ | module ack(output ackout, | ||
+ | input beta, | ||
+ | input clock); | ||
+ | |||
+ | reg stato; | ||
+ | |||
+ | | ||
+ | begin | ||
+ | stato = 0; | ||
+ | end | ||
+ | |||
+ | | ||
+ | begin | ||
+ | if(beta) | ||
+ | stato = ~stato; | ||
+ | end | ||
+ | |||
+ | | ||
+ | | ||
+ | |||
+ | endmodule | ||
+ | </ | ||
+ | |||
+ | === Comparatore === | ||
+ | <code verilog> | ||
+ | primitive comp(output z, | ||
+ | input x, | ||
+ | input y); | ||
+ | |||
+ | table | ||
+ | 0 0 : 0; | ||
+ | 0 1 : 1; | ||
+ | 1 0 : 1; | ||
+ | 1 1 : 0; | ||
+ | | ||
+ | |||
+ | endprimitive | ||
+ | </ | ||
+ |
informatica/ae/componentidivisoreverilog.1508326253.txt.gz · Ultima modifica: 18/10/2017 alle 11:30 (8 anni fa) da Marco Danelutto