ready for demo
This commit is contained in:
parent
83f78d1c3d
commit
10ed5b8751
11
src/Core.bsv
11
src/Core.bsv
|
@ -21,12 +21,13 @@ module mkCore(Core#(clkFreq));
|
|||
Real val = fromInteger(clkFreqInt);
|
||||
messageM("mkCore clkFreq" + realToString(val));
|
||||
|
||||
rule second_counter;
|
||||
Bool pulse_every_second = counter == clkFreqUInt;
|
||||
|
||||
rule count;
|
||||
counter <= (counter == clkFreqUInt) ? 0 : counter + 1;
|
||||
tick_second <= True;
|
||||
endrule
|
||||
|
||||
rule update_led(tick_second);
|
||||
rule counting_led(pulse_every_second);
|
||||
led_out <= led_out + 1;
|
||||
endrule
|
||||
|
||||
|
@ -37,7 +38,9 @@ module mkCore(Core#(clkFreq));
|
|||
return led_out;
|
||||
endmethod
|
||||
method Action put_char(Bit#(8) byte_in);
|
||||
uart_out <= byte_in;
|
||||
Bit#(8) value = byte_in;
|
||||
uart_out <= value;
|
||||
// led_out <= value;
|
||||
endmethod
|
||||
endmodule
|
||||
|
||||
|
|
|
@ -41,6 +41,8 @@ module mkDeserialize#(Handle fileHandle)(IDeserializer#(clkFreq, baudRate));
|
|||
shiftReg <= {ftdiRxIn, shiftReg[7:1]};
|
||||
endrule
|
||||
|
||||
// an invariant enforced here is we can't call this method
|
||||
// until shift reg is valid
|
||||
method Bit#(8) get() if (ftdiState == STOP && clkDivider.isAdvancing());
|
||||
return shiftReg;
|
||||
endmethod
|
||||
|
|
20
src/Top.bsv
20
src/Top.bsv
|
@ -43,15 +43,17 @@ module mkTop(ITop);
|
|||
messageM("Hallo!!" + realToString(5));
|
||||
|
||||
// connect up core device
|
||||
rule core_led_o;
|
||||
persist_led <= core.get_led;
|
||||
endrule
|
||||
rule core_char_device_o;
|
||||
serializer.putBit8(core.get_char);
|
||||
endrule
|
||||
rule core_char_device_i;
|
||||
core.put_char(deserializer.get);
|
||||
endrule
|
||||
rule core_led_o;
|
||||
persist_led <= core.get_led;
|
||||
endrule
|
||||
|
||||
rule core_char_device_o;
|
||||
serializer.putBit8(core.get_char);
|
||||
endrule
|
||||
|
||||
rule core_char_device_i;
|
||||
core.put_char(deserializer.get);
|
||||
endrule
|
||||
|
||||
// output methods
|
||||
method Bit#(1) ftdi_rxd;
|
||||
|
|
Loading…
Reference in a new issue