Notes![what is notes.io? What is notes.io?](/theme/images/whatisnotesio.png)
![]() ![]() Notes - notes.io |
module Controller(input CLK,
input [7:0] HASH, input START, output reg READY, output reg [15:0] MSG2_MSG1,
input CRC0_READY, output reg CRC0_START, output reg [15:0] CRC0_MSG2_MSG1, input [7:0] CRC0_HASH,
input CRC1_READY, output reg CRC1_START, output reg [15:0] CRC1_MSG2_MSG1, input [7:0] CRC1_HASH,
input CRC2_READY, output reg CRC2_START, output reg [15:0] CRC2_MSG2_MSG1, input [7:0] CRC2_HASH,
input CRC3_READY, output reg CRC3_START, output reg [15:0] CRC3_MSG2_MSG1, input [7:0] CRC3_HASH);
// The following code is a counter which will increment on every 32 clocks
reg [13:0] cnt;
reg calc_underway;
initial
begin
READY = 1;
MSG2_MSG1 = 0;
end
always @(posedge CLK)
begin
if(READY == 1)
begin
if(START == 1)
begin
READY = 0;
cnt = 0;
calc_underway = 0;
end
end
else
begin
if(calc_underway == 0)
begin
CRC0_MSG2_MSG1[15:14] = 2'b00; CRC0_MSG2_MSG1[13:0] = cnt;
CRC1_MSG2_MSG1[15:14] = 2'b01; CRC1_MSG2_MSG1[13:0] = cnt;
CRC2_MSG2_MSG1[15:14] = 2'b10; CRC2_MSG2_MSG1[13:0] = cnt;
CRC3_MSG2_MSG1[15:14] = 2'b11; CRC3_MSG2_MSG1[13:0] = cnt;
CRC0_START=1; CRC1_START=1; CRC2_START=1; CRC3_START=1;
calc_underway = 1;
end
else
begin
if(CRC0_READY==1 && CRC1_READY==1 && CRC2_READY==1 && CRC3_READY==1)
begin
calc_underway = 0;
if(CRC0_HASH == HASH)
begin
MSG2_MSG1[15:14] = 2'b00; MSG2_MSG1[13:0] = CRC0_MSG2_MSG1;
READY = 1;
end
else if(CRC1_HASH == HASH)
begin
MSG2_MSG1[15:14] = 2'b01; MSG2_MSG1[13:0] = CRC1_MSG2_MSG1;
READY = 1;
end
else if(CRC2_HASH == HASH)
begin
MSG2_MSG1[15:14] = 2'b10; MSG2_MSG1[13:0] = CRC2_MSG2_MSG1;
READY = 1;
end
else if(CRC3_HASH == HASH)
begin
MSG2_MSG1[15:14] = 2'b11; MSG2_MSG1[13:0] = CRC3_MSG2_MSG1;
READY = 1;
end
else
cnt = cnt + 1;
end
CRC0_START=0; CRC1_START=0; CRC2_START=0; CRC3_START=0;
end
end
end
endmodule
![]() |
Notes is a web-based application for online taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000+ notes created and continuing...
With notes.io;
- * You can take a note from anywhere and any device with internet connection.
- * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
- * You can quickly share your contents without website, blog and e-mail.
- * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
- * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.
Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.
Easy: Notes.io doesn’t require installation. Just write and share note!
Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )
Free: Notes.io works for 14 years and has been free since the day it was started.
You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;
Email: [email protected]
Twitter: http://twitter.com/notesio
Instagram: http://instagram.com/notes.io
Facebook: http://facebook.com/notesio
Regards;
Notes.io Team