Guest
hi,
i'm looking to create a libre-licensed embedded mobile-class risc-v SoC
(documented here) http://rhombus-tech.net/riscv/shakti/m_class/
most of the parts are, surprisingly (more like amazingly)
already available. the part that's missing (as libre source
code) is a pinmux. so i've started - as literally my first
verilog programming ever (yay!) - to create one.
so the goal is basically to implement - in full - slide 13 of
the following PDF:
https://elinux.org/images/b/b6/Pin_Control_Subsystem_Overview.pdf
however OUTA..D and INA..D will actually be the exact same nets,
therefore i figured that it would be important to have tri-stating
in both the In and Out multiplexers.
starting with one of the building blocks i've put together a
first version tri-stated demultiplexer from various random
tutorials, and i would be most grateful for some review input
from people who know how this stuff actually works when it
comes to not just FPGAs but also ASIC synthesis.
test module not included, here's the code for the demux: is there
anything unreasonable about it? is it appropriate to add in
tri-state bearing in mind that it will be part of a two-way bus line,
multiplexing four separate bus lines (different functions like
Micro-SD, SPI, UART etc.) each of which will be two way, onto
the same two-way IO pad?
bearing in mind that in the proposed design INA=OUTA (same net) INB=OUTB etc.
unlike in the above-referenced slide, my understanding is that for the
multiplexer you would use "!en", that would flip the demuxer to tri-state
when the muxer is not tri-state, and vice-versa.
also do i *actually* need pullup/pulldown here in the actual multiplexer
itself, or should it, as is done in the example slide, actually be on
the pin-pad part?
many thanks in advance for assistance and advice.
l.
// module for tri-state demultiplexing, with:
// - enable (en)
// - pull-up enable and pull-up default value
// - s selector 0-3 will select which of 4 lines that input is routed to
module tridemux (s, I, en,y, enpu, puv);
input[1:0] s;
input I, en, enpu, puv;
output[3:0] y;
wire val;
genvar i;
// prepare value by selecting input if enabled otherwise
// default to pullup if *that* is enabled... otherwise tristate
assign val = en ? I : (enpu ? puv : 'bz);
// now assign value to selected output (s), otherwise tristate
for (i = 0; i < 4; i = i + 1) begin
assign (pull0, pull1) y = (s == i) ? val : 'bz;
end
endmodule
i'm looking to create a libre-licensed embedded mobile-class risc-v SoC
(documented here) http://rhombus-tech.net/riscv/shakti/m_class/
most of the parts are, surprisingly (more like amazingly)
already available. the part that's missing (as libre source
code) is a pinmux. so i've started - as literally my first
verilog programming ever (yay!) - to create one.
so the goal is basically to implement - in full - slide 13 of
the following PDF:
https://elinux.org/images/b/b6/Pin_Control_Subsystem_Overview.pdf
however OUTA..D and INA..D will actually be the exact same nets,
therefore i figured that it would be important to have tri-stating
in both the In and Out multiplexers.
starting with one of the building blocks i've put together a
first version tri-stated demultiplexer from various random
tutorials, and i would be most grateful for some review input
from people who know how this stuff actually works when it
comes to not just FPGAs but also ASIC synthesis.
test module not included, here's the code for the demux: is there
anything unreasonable about it? is it appropriate to add in
tri-state bearing in mind that it will be part of a two-way bus line,
multiplexing four separate bus lines (different functions like
Micro-SD, SPI, UART etc.) each of which will be two way, onto
the same two-way IO pad?
bearing in mind that in the proposed design INA=OUTA (same net) INB=OUTB etc.
unlike in the above-referenced slide, my understanding is that for the
multiplexer you would use "!en", that would flip the demuxer to tri-state
when the muxer is not tri-state, and vice-versa.
also do i *actually* need pullup/pulldown here in the actual multiplexer
itself, or should it, as is done in the example slide, actually be on
the pin-pad part?
many thanks in advance for assistance and advice.
l.
// module for tri-state demultiplexing, with:
// - enable (en)
// - pull-up enable and pull-up default value
// - s selector 0-3 will select which of 4 lines that input is routed to
module tridemux (s, I, en,y, enpu, puv);
input[1:0] s;
input I, en, enpu, puv;
output[3:0] y;
wire val;
genvar i;
// prepare value by selecting input if enabled otherwise
// default to pullup if *that* is enabled... otherwise tristate
assign val = en ? I : (enpu ? puv : 'bz);
// now assign value to selected output (s), otherwise tristate
for (i = 0; i < 4; i = i + 1) begin
assign (pull0, pull1) y = (s == i) ? val : 'bz;
end
endmodule