Newbie questions

T

Triste

Guest
Hi,

I'm a beginner in HDL. A GPIO specification is given requiring several
R/W registers driving and monitoring I/O pins on DigiLab board. I'm
not sure what R/W register is. Does it imply using
bi-directional/inout, or one input and one output?

Also, what does exactly GPIO do and what things I need to know before
designing the module.

Thanks very much,
triste
 
"Blackie Beard" <bb@fearlessimmortalwretch.com> wrote in message news:<n8tGc.10759$nc.2672@fed1read03>...
Usually GPIO is just a data reg with a tristateable output. A corresponding
register controls the direction (in vs out) which same signal will also
tristate
the data register output. If the direction is out, a read at the data reg
location
will just give the data reg output contents. If direction reg is in, a read
of the
data reg will give the pin voltage.

reg [7:0] data_out, data_oen; // these are addressable
always @(posedge clk or negedge rstn)
if(~rstn) data <= 8'h0;
else if(write) data <= data;

wire [7:0] data_in;

assign data_in[7:0] = IOPIN[7:0];
assign IOPIN[7:0] = data_oen[7:0] ? data_out[7:0] : 8'hzz;

now when you decode on a read, read data_in.

BB

"Triste" <triste@myrealbox.com> wrote in message
news:6d3232ed.0407010816.9c5686f@posting.google.com...
Hi,

I'm a beginner in HDL. A GPIO specification is given requiring several
R/W registers driving and monitoring I/O pins on DigiLab board. I'm
not sure what R/W register is. Does it imply using
bi-directional/inout, or one input and one output?

Also, what does exactly GPIO do and what things I need to know before
designing the module.

Thanks very much,
triste
Thanks so much for the useful explanation. But there's one related
question, how can it be interfaced with, let's say push button,
7-segment display or LEDs on DigiLab board. Would anyone give me a
simple example?
 
hi,
for push button the corresponding gpio pin should be in read mode.
for 7-segment display/led corresponding gpio pins shouls be write
mode.

For simple example select one pin of GPIO bus, lets us say GPIO[2],
connect
anode of led to this pin. connect the cathode of led through 1K
resistance to ground. Now try to toggle GPIO[2] between logic "0" and
"1", you can see
toggling led display. for push button switch push the switch and read
the corresponding GPIO pin.

Thanks
rao

Thanks so much for the useful explanation. But there's one related
question, how can it be interfaced with, let's say push button,
7-segment display or LEDs on DigiLab board. Would anyone give me a
simple example?
 
Usually GPIO is just a data reg with a tristateable output. A corresponding
register controls the direction (in vs out) which same signal will also
tristate
the data register output. If the direction is out, a read at the data reg
location
will just give the data reg output contents. If direction reg is in, a read
of the
data reg will give the pin voltage.

reg [7:0] data_out, data_oen; // these are addressable
always @(posedge clk or negedge rstn)
if(~rstn) data <= 8'h0;
else if(write) data <= data;

wire [7:0] data_in;

assign data_in[7:0] = IOPIN[7:0];
assign IOPIN[7:0] = data_oen[7:0] ? data_out[7:0] : 8'hzz;

now when you decode on a read, read data_in.

BB

"Triste" <triste@myrealbox.com> wrote in message
news:6d3232ed.0407010816.9c5686f@posting.google.com...
Hi,

I'm a beginner in HDL. A GPIO specification is given requiring several
R/W registers driving and monitoring I/O pins on DigiLab board. I'm
not sure what R/W register is. Does it imply using
bi-directional/inout, or one input and one output?

Also, what does exactly GPIO do and what things I need to know before
designing the module.

Thanks very much,
triste
 
"Blackie Beard" <bb@fearlessimmortalwretch.com> wrote in message news:<n8tGc.10759$nc.2672@fed1read03>...
Usually GPIO is just a data reg with a tristateable output. A corresponding
register controls the direction (in vs out) which same signal will also
tristate
the data register output. If the direction is out, a read at the data reg
location
will just give the data reg output contents. If direction reg is in, a read
of the
data reg will give the pin voltage.

reg [7:0] data_out, data_oen; // these are addressable
always @(posedge clk or negedge rstn)
if(~rstn) data <= 8'h0;
else if(write) data <= data;

wire [7:0] data_in;

assign data_in[7:0] = IOPIN[7:0];
assign IOPIN[7:0] = data_oen[7:0] ? data_out[7:0] : 8'hzz;

now when you decode on a read, read data_in.

BB

"Triste" <triste@myrealbox.com> wrote in message
news:6d3232ed.0407010816.9c5686f@posting.google.com...
Hi,

I'm a beginner in HDL. A GPIO specification is given requiring several
R/W registers driving and monitoring I/O pins on DigiLab board. I'm
not sure what R/W register is. Does it imply using
bi-directional/inout, or one input and one output?

Also, what does exactly GPIO do and what things I need to know before
designing the module.

Thanks very much,
triste
Thanks so much for the useful explanation. But there's one related
question, how can it be interfaced with, let's say push button,
7-segment display or LEDs on DigiLab board. Would anyone give me a
simple example?
 
raonpc@gmail.com (pablo aimar) wrote in message news:<95ef6f72.0407071508.49885412@posting.google.com>...
hi,
for push button the corresponding gpio pin should be in read mode.
for 7-segment display/led corresponding gpio pins shouls be write
mode.

For simple example select one pin of GPIO bus, lets us say GPIO[2],
connect
anode of led to this pin. connect the cathode of led through 1K
resistance to ground. Now try to toggle GPIO[2] between logic "0" and
"1", you can see
toggling led display. for push button switch push the switch and read
the corresponding GPIO pin.

Thanks
rao


Thanks so much for the useful explanation. But there's one related
question, how can it be interfaced with, let's say push button,
7-segment display or LEDs on DigiLab board. Would anyone give me a
simple example?
Thanks so much for all the help. The explanation is quite useful!
 

Welcome to EDABoard.com

Sponsor

Back
Top